PostgreSQL 9.6.0 commit log

Stamp 9.6.0.

commit   : a721a1ba9cf6c86cb52f1bf325d5a27b64e870d6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2016 16:26:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2016 16:26:58 -0400    

Click here for diff

M configure
M configure.in
M doc/bug.template
M src/include/pg_config.h.win32

Translation updates

commit   : e77ea9dbd71693c1a26d4962d5bd2f2163c94acc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 26 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 26 Sep 2016 12:00:00 -0400    

Click here for diff

Source-Git-URL: git://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: 5c283d709ce8368fe710f90429b72048ac4c6349  

M src/backend/po/de.po
M src/backend/po/es.po
M src/backend/po/fr.po
M src/backend/po/pl.po
M src/backend/po/ru.po
M src/bin/initdb/po/pt_BR.po
M src/bin/initdb/po/ru.po
M src/bin/pg_basebackup/nls.mk
A src/bin/pg_basebackup/po/ja.po
M src/bin/pg_basebackup/po/pt_BR.po
M src/bin/pg_basebackup/po/ru.po
M src/bin/pg_config/po/pt_BR.po
M src/bin/pg_config/po/ru.po
M src/bin/pg_controldata/po/pt_BR.po
M src/bin/pg_controldata/po/ru.po
M src/bin/pg_ctl/po/ru.po
M src/bin/pg_dump/po/fr.po
M src/bin/pg_dump/po/pt_BR.po
M src/bin/pg_dump/po/ru.po
M src/bin/pg_resetxlog/po/ja.po
M src/bin/pg_resetxlog/po/pt_BR.po
M src/bin/pg_resetxlog/po/ru.po
M src/bin/pg_rewind/nls.mk
M src/bin/pg_rewind/po/fr.po
A src/bin/pg_rewind/po/ja.po
A src/bin/pg_rewind/po/pt_BR.po
M src/bin/pg_rewind/po/ru.po
M src/bin/psql/po/fr.po
M src/bin/psql/po/pl.po
M src/bin/psql/po/ru.po
M src/bin/scripts/po/pt_BR.po
M src/bin/scripts/po/ru.po
M src/interfaces/ecpg/ecpglib/po/ru.po
M src/interfaces/ecpg/preproc/po/de.po
M src/interfaces/ecpg/preproc/po/fr.po
M src/interfaces/ecpg/preproc/po/pl.po
M src/interfaces/ecpg/preproc/po/ru.po
M src/interfaces/libpq/po/pt_BR.po
M src/interfaces/libpq/po/ru.po
M src/interfaces/libpq/po/zh_CN.po
M src/pl/plperl/po/pt_BR.po
M src/pl/plperl/po/ru.po
M src/pl/plpgsql/src/po/pt_BR.po
M src/pl/plpgsql/src/po/ru.po
M src/pl/plpython/po/fr.po
M src/pl/plpython/po/pt_BR.po
M src/pl/plpython/po/ru.po
M src/pl/tcl/po/ru.po

Document has_type_privilege().

commit   : 1d473b567e43a84c60428a9f70602acd4deac530    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2016 11:50:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2016 11:50:35 -0400    

Click here for diff

Evidently an oversight in commit 729205571.  Back-patch to 9.2 where  
privileges for types were introduced.  
  
Report: <[email protected]>  

M doc/src/sgml/func.sgml

Do a final round of updates on the 9.6 release notes.

commit   : fc37e2afa04c612c35e33e0ce447be296ba6bb02    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Sep 2016 16:25:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Sep 2016 16:25:35 -0400    

Click here for diff

Set release date, document a few recent commits, do one last pass of  
copy-editing.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/release-9.6.sgml

Install TAP test infrastructure so it's available for extension testing.

commit   : 5a83e2d4ea7ea064fc5b7d850456bb04db0274ac    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2016 15:50:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2016 15:50:00 -0400    

Click here for diff

When configured with --enable-tap-tests, "make install" will now install  
the Perl support files for TAP testing where PGXS will find them.  
This allows extensions to rely on $(prove_check) even when being built  
out-of-tree.  Back-patch to 9.4 where we first started to support TAP  
testing, to reduce the number of cases extension makefiles need to  
consider.  
  
Craig Ringer  
  
Discussion: <CAMsr+YF[email protected]>  

M src/Makefile
M src/test/Makefile
A src/test/perl/Makefile

Doc: fix examples of # operators so they actually work.

commit   : 94e4cac251927e3ce1f66b3d96a03f1f7c3ba3e7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2016 14:22:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2016 14:22:07 -0400    

Click here for diff

These worked as-is until around 7.0, but fail in newer versions because  
there are more operators named "#".  Besides it's a bit inconsistent that  
only two of the examples on this page lack type names on their constants.  
  
Report: <[email protected]>  

M doc/src/sgml/func.sgml

Fix incorrect logic for excluding range constructor functions in pg_dump.

commit   : 7e02476f337990e68c80b7a1395dcc6af111c034    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2016 13:49:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2016 13:49:26 -0400    

Click here for diff

Faulty AND/OR nesting in the WHERE clause of getFuncs' SQL query led to  
dumping range constructor functions if they are part of an extension  
and we're in binary-upgrade mode.  Actually, we don't want to dump them  
separately even then, since CREATE TYPE AS RANGE will create the range's  
constructor functions regardless.  Per report from Andrew Dunstan.  
  
It looks like this mistake was introduced by me, in commit b985d4877, in  
perhaps-overzealous refactoring to reduce code duplication.  I'm suitably  
embarrassed.  
  
Report: <[email protected]>  

M src/bin/pg_dump/pg_dump.c

Remove useless code.

commit   : a20435fe9aa52cd8c62f3b0ed359077a56824830    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2016 10:44:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2016 10:44:50 -0400    

Click here for diff

Apparent copy-and-pasteo in standby_desc_invalidations() had two  
entries for msg->id == SHAREDINVALRELMAP_ID.  
  
Aleksander Alekseev  
  
Discussion: <20160923090814.GB1238@e733>  

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

Don't trust CreateFileMapping() to clear the error code on success.

commit   : e7f5d8ea1c75cc341a966897760a812e437c4668    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2016 10:09:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2016 10:09:52 -0400    

Click here for diff

We must test GetLastError() even when CreateFileMapping() returns a  
non-null handle.  If that value were left over from some previous system  
call, we might be fooled into thinking the segment already existed.  
Experimentation on Windows 7 suggests that CreateFileMapping() clears  
the error code on success, but it is not documented to do so, so let's  
not rely on that happening in all Windows releases.  
  
Amit Kapila  
  
Discussion: <[email protected]>  

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

Avoid using PostmasterRandom() for DSM control segment ID.

commit   : b251379fb44b4893624999f1ba00986c029f11cf    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2016 09:54:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2016 09:54:11 -0400    

Click here for diff

Commits 470d886c3 et al intended to fix the problem that the postmaster  
selected the same "random" DSM control segment ID on every start.  But  
using PostmasterRandom() for that destroys the intended property that the  
delay between random_start_time and random_stop_time will be unpredictable.  
(Said delay is probably already more predictable than we could wish, but  
that doesn't mean that reducing it by a couple orders of magnitude is OK.)  
Revert the previous patch and add a comment warning against misuse of  
PostmasterRandom.  Fix the original problem by calling srandom() early in  
PostmasterMain, using a low-security seed that will later be overwritten  
by PostmasterRandom.  
  
Discussion: <[email protected]>  

M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/dsm.c
M src/include/postmaster/postmaster.h

Be sure to rewind the tuplestore read pointer in non-leader CTEScan nodes.

commit   : a88fe25f50ae9ce491fe10a90aeef2cbed6f2b9a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Sep 2016 11:34:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Sep 2016 11:34:44 -0400    

Click here for diff

ExecInitCteScan supposed that it didn't have to do anything to the extra  
tuplestore read pointer it gets from tuplestore_alloc_read_pointer.  
However, it needs this read pointer to be positioned at the start of the  
tuplestore, while tuplestore_alloc_read_pointer is actually defined as  
cloning the current position of read pointer 0.  In normal situations  
that accidentally works because we initialize the whole plan tree at once,  
before anything gets read.  But it fails in an EvalPlanQual recheck, as  
illustrated in bug #14328 from Dima Pavlov.  To fix, just forcibly rewind  
the pointer after tuplestore_alloc_read_pointer.  The cost of doing so is  
negligible unless the tuplestore is already in TSS_READFILE state, which  
wouldn't happen in normal cases.  We could consider altering tuplestore's  
API to make that case cheaper, but that would make for a more invasive  
back-patch and it doesn't seem worth it.  
  
This has been broken probably for as long as we've had CTEs, so back-patch  
to all supported branches.  
  
Discussion: <[email protected]>  

M src/backend/executor/nodeCtescan.c
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

Add more parallel query documentation.

commit   : c925e6335e1da58aba3dd764bb9f97fa81d893b8    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 21 Sep 2016 08:37:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 21 Sep 2016 08:37:02 -0400    

Click here for diff

Previously, the individual settings were documented, but there was  
no overall discussion of the capabilities and limitations of the  
feature.  Add that.  
  
Patch by me, reviewed by Peter Eisentraut and Álvaro Herrera.  

M doc/src/sgml/config.sgml
M doc/src/sgml/filelist.sgml
A doc/src/sgml/parallel.sgml
M doc/src/sgml/postgres.sgml

Print test parameters like "foo: 123", and results like "foo = 123".

commit   : 970300faae189c38fbe393dfab1e326fb75c9a49    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 21 Sep 2016 13:24:13 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 21 Sep 2016 13:24:13 +0300    

Click here for diff

The way "latency average" was printed was differently if it was calculated  
from the overall run time or was measured on a per-transaction basis.  
Also, the per-script weight is a test parameter, rather than a result, so  
use the "weight: %f" style for that.  
  
Backpatch to 9.6, since the inconsistency on "latency average" was  
introduced there.  
  
Fabien Coelho  
  
Discussion: <alpine.DEB.2.20.1607131015370.7486@sto>  

M src/bin/pgbench/pgbench.c

Fix pgbench's calculation of average latency, when -T is not used.

commit   : 93834a20f67ee458c98067e253894457c5a958ad    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 21 Sep 2016 13:14:48 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 21 Sep 2016 13:14:48 +0300    

Click here for diff

If the test duration was given in # of transactions (-t or no option),  
rather as a duration (-T), the latency average was always printed as 0.  
It has been broken ever since the display of latency average was added,  
in 9.4.  
  
Fabien Coelho  
  
Discussion: <alpine.DEB.2.20.1607131015370.7486@sto>  

M src/bin/pgbench/pgbench.c

doc: Fix documentation to match actual make output

commit   : 496c90b5e04729916ae9131ac93b2e63b46e3e2f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Sep 2016 12:00:00 -0400    

Click here for diff

based on patch from Takeshi Ideriha <[email protected]>  

M doc/src/sgml/installation.sgml

doc: Correct ALTER USER MAPPING example

commit   : dfddf931707bfc9724179b0f554649dabccf45aa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Sep 2016 12:00:00 -0400    

Click here for diff

The existing example threw an error.  
  
From: gabrielle <[email protected]>  

M doc/src/sgml/ref/alter_user_mapping.sgml

Re-add translation markers that were lost

commit   : 00e1933ef30c212b35d3360aff0e77211352dbd7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Sep 2016 12:00:00 -0400    

Click here for diff

When win32security.c was moved from src/backend/port/win32/security.c,  
the message writing function was changed from write_stderr to log_error,  
but nls.mk was not updated.  We could add log_error to GETTEXT_TRIGGERS,  
but it's also used in src/common/exec.c in a different way and that  
would create some confusion or a larger patch.  For now, just put an  
explicit translation marker onto the strings that were previously  
translated.  

M src/port/win32security.c

Use PostmasterRandom(), not random(), for DSM control segment ID.

commit   : 92668cd4d3df5a7a48408fc722e876a3e1c167d9    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 20 Sep 2016 12:24:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 20 Sep 2016 12:24:44 -0400    

Click here for diff

Otherwise, every startup gets the same "random" value, which is  
definitely not what was intended.  

M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/dsm.c
M src/include/postmaster/postmaster.h

Retry DSM control segment creation if Windows indicates access denied.

commit   : 6bcd26c43c4f0ef718e984643338ddd5b207f9f9    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 20 Sep 2016 12:04:41 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 20 Sep 2016 12:04:41 -0400    

Click here for diff

Otherwise, attempts to run multiple postmasters running on the same  
machine may fail, because Windows sometimes returns ERROR_ACCESS_DENIED  
rather than ERROR_ALREADY_EXISTS when there is an existing segment.  
  
Hitting this bug is much more likely because of another defect not  
fixed by this patch, namely that dsm_postmaster_startup() uses  
random() which returns the same value every time.  But that's not  
a reason not to fix this.  
  
Kyotaro Horiguchi and Amit Kapila, reviewed by Michael Paquier  
  
Discussion: <CAA4eK1J[email protected]>  

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

Fix outdated comments, GIST search queue is not an RBTree anymore.

commit   : fd94ac501f11a747093e0fa5af8514af7408dbc3    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 20 Sep 2016 11:38:25 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 20 Sep 2016 11:38:25 +0300    

Click here for diff

The GiST search queue is implemented as a pairing heap rather than as  
Red-Black Tree, since 9.5 (commit e7032610). I neglected these comments  
in that commit.  

M src/backend/access/gist/gistscan.c
M src/include/access/gist_private.h

Fix latency calculation when there are \sleep commands in the script.

commit   : f65764a04a0cccbcd53bf413d6f73ecedaae21c6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 19 Sep 2016 22:55:43 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 19 Sep 2016 22:55:43 +0300    

Click here for diff

We can't use txn_scheduled to hold the sleep-until time for \sleep, because  
that interferes with calculation of the latency of the transaction as whole.  
  
Backpatch to 9.4, where this bug was introduced.  
  
Fabien COELHO  
  
Discussion: <alpine.DEB.2.20.1608231622170.7102@lancre>  

M src/bin/pgbench/pgbench.c

MSVC: Include pg_recvlogical in client-only install.

commit   : 156f974f56543365b89f96182e9dfa16f4287e9a    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Sep 2016 14:21:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Sep 2016 14:21:48 -0400    

Click here for diff

MauMau, reviewed by Michael Paquier  

M src/tools/msvc/Install.pm

Update recovery_min_apply_delay docs for remote_apply mode.

commit   : 275fe7ecab25ee17ae9389167e161d60a5da6b41    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Sep 2016 13:38:21 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Sep 2016 13:38:21 -0400    

Click here for diff

Bernd Helmle, reviewed by Thomas Munro, tweaked by me.  

M doc/src/sgml/recovery-config.sgml

Fix ecpg -? option on Windows, add -V alias for --version.

commit   : e06728d631a6bb511006d7e85839713abcdbb555    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 18 Sep 2016 13:46:32 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 18 Sep 2016 13:46:32 +0300    

Click here for diff

This makes the -? and -V options work consistently with other binaries.  
--help and --version are now only recognized as the first option, i.e.  
"ecpg --foobar --help" no longer prints the help, but that's consistent  
with most of our other binaries, too.  
  
Backpatch to all supported versions.  
  
Haribabu Kommi  
  
Discussion: <CAJrrPGf[email protected]>  

M src/interfaces/ecpg/preproc/ecpg.c

Fix building with LibreSSL.

commit   : 9895818d5656e3fe775af05df3e2b2cce7346962    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 15 Sep 2016 22:29:39 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 15 Sep 2016 22:29:39 +0300    

Click here for diff

LibreSSL defines OPENSSL_VERSION_NUMBER to claim that it is version 2.0.0,  
but it doesn't have the functions added in OpenSSL 1.1.0. Add autoconf  
checks for the individual functions we need, and stop relying on  
OPENSSL_VERSION_NUMBER.  
  
Backport to 9.5 and 9.6, like the patch that broke this. In the  
back-branches, there are still a few OPENSSL_VERSION_NUMBER checks left,  
to check for OpenSSL 0.9.8 or 0.9.7. I left them as they were - LibreSSL  
has all those functions, so they work as intended.  
  
Per buildfarm member curculio.  
  
Discussion: <[email protected]>  

M configure
M configure.in
M contrib/pgcrypto/openssl.c
M src/backend/libpq/be-secure-openssl.c
M src/include/pg_config.h.in
M src/interfaces/libpq/fe-secure-openssl.c

Make min_parallel_relation_size's default value platform-independent.

commit   : 72ce78162c6c4e52b7a9bb1a2de50daee0a3628e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Sep 2016 11:23:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Sep 2016 11:23:25 -0400    

Click here for diff

The documentation states that the default value is 8MB, but this was  
only true at BLCKSZ = 8kB, because the default was hard-coded as 1024.  
Make the code match the docs by computing the default as 8MB/BLCKSZ.  
  
Oversight in commit 75be66464, noted pursuant to a gripe from Peter E.  
  
Discussion: <[email protected]>  

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

pg_buffercache: Allow huge allocations.

commit   : bea38f34a4e601d2ea803a3a6d6b90ee0fe2d2b6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 15 Sep 2016 09:22:52 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 15 Sep 2016 09:22:52 -0400    

Click here for diff

Otherwise, users who have configured shared_buffers >= 256GB won't  
be able to use this module.  There probably aren't many of those, but  
it doesn't hurt anything to fix it so that it works.  
  
Backpatch to 9.4, where MemoryContextAllocHuge was introduced.  The  
same problem exists in older branches, but there's no easy way to  
fix it there.  
  
KaiGai Kohei  

M contrib/pg_buffercache/pg_buffercache_pages.c

Support OpenSSL 1.1.0.

commit   : fcd93e4af943fc444a5928355c9471d36f077538    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 15 Sep 2016 12:55:38 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 15 Sep 2016 12:55:38 +0300    

Click here for diff

Changes needed to build at all:  
  
- Check for SSL_new in configure, now that SSL_library_init is a macro.  
- Do not access struct members directly. This includes some new code in  
  pgcrypto, to use the resource owner mechanism to ensure that we don't  
  leak OpenSSL handles, now that we can't embed them in other structs  
  anymore.  
- RAND_SSLeay() -> RAND_OpenSSL()  
  
Changes that were needed to silence deprecation warnings, but were not  
strictly necessary:  
  
- RAND_pseudo_bytes() -> RAND_bytes().  
- SSL_library_init() and OpenSSL_config() -> OPENSSL_init_ssl()  
- ASN1_STRING_data() -> ASN1_STRING_get0_data()  
- DH_generate_parameters() -> DH_generate_parameters()  
- Locking callbacks are not needed with OpenSSL 1.1.0 anymore. (Good  
  riddance!)  
  
Also change references to SSLEAY_VERSION_NUMBER with OPENSSL_VERSION_NUMBER,  
for the sake of consistency. OPENSSL_VERSION_NUMBER has existed since time  
immemorial.  
  
Fix SSL test suite to work with OpenSSL 1.1.0. CA certificates must have  
the "CA:true" basic constraint extension now, or OpenSSL will refuse them.  
Regenerate the test certificates with that. The "openssl" binary, used to  
generate the certificates, is also now more picky, and throws an error  
if an X509 extension is specified in "req_extensions", but that section  
is empty.  
  
Backpatch to 9.5 and 9.6, per popular demand. The file structure was  
somewhat different in earlier branches, so I didn't bother to go further  
than that. In back-branches, we still support OpenSSL 0.9.7 and above.  
OpenSSL 0.9.6 should still work too, but I didn't test it. In master, we  
only support 0.9.8 and above.  
  
Patch by Andreas Karlsson, with additional changes by me.  
  
Discussion: <[email protected]>  

M configure
M configure.in
M contrib/pgcrypto/internal.c
M contrib/pgcrypto/openssl.c
M contrib/pgcrypto/pgcrypto.c
M contrib/pgcrypto/pgp-s2k.c
M contrib/pgcrypto/px-crypt.c
M contrib/pgcrypto/px.h
M contrib/sslinfo/sslinfo.c
M src/backend/libpq/be-secure-openssl.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h
M src/test/ssl/Makefile
M src/test/ssl/cas.config
M src/test/ssl/root_ca.config
M src/test/ssl/server-cn-only.config
M src/test/ssl/server-no-names.config
M src/test/ssl/server-revoked.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-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-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 and clarify comments on replacement selection.

commit   : 18ae680632b5c7a1550a768f1a4dc8e31b08215d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 15 Sep 2016 11:51:43 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 15 Sep 2016 11:51:43 +0300    

Click here for diff

These were modified by the patch to only use replacement selection for the  
first run in an external sort.  

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

Docs: assorted minor cleanups.

commit   : 5e1431f94e4c8260c76c061a94c97b0e15956ebe    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Sep 2016 19:19:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Sep 2016 19:19:24 -0400    

Click here for diff

Standardize on "user_name" for a field name in related examples in  
ddl.sgml; before we had variously "user_name", "username", and "user".  
The last is flat wrong because it conflicts with a reserved word.  
  
Be consistent about entry capitalization in a table in func.sgml.  
  
Fix a typo in pgtrgm.sgml.  
  
Back-patch to 9.6 and 9.5 as relevant.  
  
Alexander Law  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/pgtrgm.sgml

Fix copy/pasto in file identification

commit   : 4b47cb35fa516c1bb380ab4edf3131fb6adfacfe    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 12 Sep 2016 09:02:17 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 12 Sep 2016 09:02:17 +0100    

Click here for diff

Daniel Gustafsson  

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

Raise max setting of checkpoint_timeout to 1d

commit   : f2dba881a5e13abc957f0e692749f89c9288134d    
  
author   : Simon Riggs <[email protected]>    
date     : Sun, 11 Sep 2016 23:27:29 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Sun, 11 Sep 2016 23:27:29 +0100    

Click here for diff

Previously checkpoint_timeout was capped at 3600s  
New max setting is 86400s = 24h = 1d  
  
Discussion: [email protected]  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample

Improve unreachability recognition in elog() macro.

commit   : fa7b3a88dd5d7f6d18614eefc6cc0662e31bd451    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 10 Sep 2016 17:54:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 10 Sep 2016 17:54:23 -0400    

Click here for diff

Some experimentation with an older version of gcc showed that it is able  
to determine whether "if (elevel_ >= ERROR)" is compile-time constant  
if elevel_ is declared "const", but otherwise not so much.  We had  
accounted for that in ereport() but were too miserly with braces to  
make it so in elog().  I don't know how many currently-interesting  
compilers have the same quirk, but in case it will save some code  
space, let's make sure that elog() is on the same footing as ereport()  
for this purpose.  
  
Back-patch to 9.3 where we introduced pg_unreachable() calls into  
elog/ereport.  

M src/include/utils/elog.h

Fix miserable coding in pg_stat_get_activity().

commit   : 7a142b6bbf20c5ad54d11ea45e7a74ce02c510f0    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 10 Sep 2016 13:49:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 10 Sep 2016 13:49:04 -0400    

Click here for diff

Commit dd1a3bccc replaced a test on whether a subroutine returned a  
null pointer with a test on whether &pointer->backendStatus was null.  
This accidentally failed to fail, at least on common compilers, because  
backendStatus is the first field in the struct; but it was surely trouble  
waiting to happen.  Commit f91feba87 then messed things up further,  
changing the logic to  
  
	local_beentry = pgstat_fetch_stat_local_beentry(curr_backend);  
	if (!local_beentry)  
		continue;  
	beentry = &local_beentry->backendStatus;  
	if (!beentry)  
	{  
  
where the second "if" is now dead code, so that the intended behavior of  
printing a row with "<backend information not available>" cannot occur.  
  
I suspect this is all moot because pgstat_fetch_stat_local_beentry  
will never actually return null in this function's usage, but it's still  
very poor coding.  Repair back to 9.4 where the original problem was  
introduced.  

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

Fix locking a tuple updated by an aborted (sub)transaction

commit   : c3656c9ff3aa20ce5144ae77b5f6669f09c9362b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 9 Sep 2016 15:54:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 9 Sep 2016 15:54:29 -0300    

Click here for diff

When heap_lock_tuple decides to follow the update chain, it tried to  
also lock any version of the tuple that was created by an update that  
was subsequently rolled back.  This is pointless, since for all intents  
and purposes that tuple exists no more; and moreover it causes  
misbehavior, as reported independently by Marko Tiikkaja and Marti  
Raudsepp: some SELECT FOR UPDATE/SHARE queries may fail to return  
the tuples, and assertion-enabled builds crash.  
  
Fix by having heap_lock_updated_tuple test the xmin and return success  
immediately if the tuple was created by an aborted transaction.  
  
The condition where tuples become invisible occurs when an updated tuple  
chain is followed by heap_lock_updated_tuple, which reports the problem  
as HeapTupleSelfUpdated to its caller heap_lock_tuple, which in turn  
propagates that code outwards possibly leading the calling code  
(ExecLockRows) to believe that the tuple exists no longer.  
  
Backpatch to 9.3.  Only on 9.5 and newer this leads to a visible  
failure, because of commit 27846f02c176; before that, heap_lock_tuple  
skips the whole dance when the tuple is already locked by the same  
transaction, because of the ancient HeapTupleSatisfiesUpdate behavior.  
Still, the buggy condition may also exist in more convoluted scenarios  
involving concurrent transactions, so it seems safer to fix the bug in  
the old branches too.  
  
Discussion:  
	https://www.postgresql.org/message-id/CABRT[email protected]  
	https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/heap/heapam.c
M src/test/regress/expected/combocid.out
M src/test/regress/sql/combocid.sql

Fix corruption of 2PC recovery with subxacts

commit   : 1fef3d576e3a8ac69f90faf192997858f1d82f64    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 9 Sep 2016 13:11:25 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 9 Sep 2016 13:11:25 +0100    

Click here for diff

Reading 2PC state files during recovery was borked, causing corruptions during  
recovery. Effect limited to servers with 2PC, subtransactions and  
recovery/replication.  
  
Stas Kelvich, reviewed by Michael Paquier and Pavan Deolasee  

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

Fix VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL

commit   : 1fa42debe676146f1f3e4809ef42e9a0f300e112    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 9 Sep 2016 11:43:08 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 9 Sep 2016 11:43:08 +0100    

Click here for diff

lazy_truncate_heap() was waiting for  
VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL, but in microseconds  
not milliseconds as originally intended.  
  
Found by code inspection.  
  
Simon Riggs  

M src/backend/commands/vacuumlazy.c

Correct TABLESAMPLE docs

commit   : 9796882e68367a9259b6d5e84bd0a227b579d586    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 9 Sep 2016 11:20:36 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 9 Sep 2016 11:20:36 +0100    

Click here for diff

Revert to original use of word “sample”, though with clarification,  
per Tom Lane.  
  
Discussion: [email protected]  

M doc/src/sgml/ref/select.sgml

Fix mdtruncate() to close fd.c handle of deleted segments.

commit   : f6802936a53671c9db24273ab2ae94291a68afcd    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 8 Sep 2016 16:51:09 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 8 Sep 2016 16:51:09 -0700    

Click here for diff

mdtruncate() forgot to FileClose() a segment's mdfd_vfd, when deleting  
it. That lead to a fd.c handle to a truncated file being kept open until  
backend exit.  
  
The issue appears to have been introduced way back in 1a5c450f3024ac5,  
before that the handle was closed inside FileUnlink().  
  
The impact of this bug is limited - only VACUUM and ON COMMIT TRUNCATE  
for temporary tables, truncate files in place (i.e. TRUNCATE itself is  
not affected), and the relation has to be bigger than 1GB. The  
consequences of a leaked fd.c handle aren't severe either.  
  
Discussion: <[email protected]>  
Backpatch: all supported releases  

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

Fix two src/test/modules Makefiles

commit   : e012e7845423a6428ce82bf3a21f6efc958351fb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 8 Sep 2016 14:39:05 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 8 Sep 2016 14:39:05 -0300    

Click here for diff

commit_ts and test_pg_dump were declaring targets before including the  
PGXS stanza, which meant that the "all" target customarily defined as  
the first (and therefore default target) was not the default anymore.  
Fix that by moving those target definitions to after PGXS.  
  
commit_ts was initially good, but I broke it in commit 9def031bd2;  
test_pg_dump was born broken, probably copying from commit_ts' mistake.  
  
In passing, fix a comment mistake in test_pg_dump/Makefile.  
  
Backpatch to 9.6.  
  
Noted by Tom Lane.  

M src/test/modules/commit_ts/Makefile
M src/test/modules/test_pg_dump/Makefile

Allow pg_dump to dump non-extension members of an extension-owned schema.

commit   : 31eb14504de311c98db2d1306ac61427bcdad863    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 8 Sep 2016 13:12:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 8 Sep 2016 13:12:01 -0400    

Click here for diff

Previously, if a schema was created by an extension, a normal pg_dump run  
(not --binary-upgrade) would summarily skip every object in that schema.  
In a case where an extension creates a schema and then users create other  
objects within that schema, this does the wrong thing: we want pg_dump  
to skip the schema but still create the non-extension-owned objects.  
  
There's no easy way to fix this pre-9.6, because in earlier versions the  
"dump" status for a schema is just a bool and there's no way to distinguish  
"dump me" from "dump my members".  However, as of 9.6 we do have enough  
state to represent that, so this is a simple correction of the logic in  
selectDumpableNamespace.  
  
In passing, make some cosmetic fixes in nearby code.  
  
Martín Marqués, reviewed by Michael Paquier  
  
Discussion: <[email protected]>  

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

Don't print database's tablespace in pg_dump -C --no-tablespaces output.

commit   : a88cee90fdfb2c125d56cb08164ca9a9ca39a75d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 8 Sep 2016 10:48:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 8 Sep 2016 10:48:03 -0400    

Click here for diff

If the database has a non-default tablespace, we emitted a TABLESPACE  
clause in the CREATE DATABASE command emitted by -C, even if  
--no-tablespaces was also specified.  This seems wrong, and it's  
inconsistent with what pg_dumpall does, so change it.  Per bug #14315  
from Danylo Hlynskyi.  
  
Back-patch to 9.5.  The bug is much older, but it'd be a more invasive  
change before 9.5 because dumpDatabase() hasn't got an easy way to get  
to the outputNoTablespaces flag.  Doesn't seem worth the work given  
the lack of previous complaints.  
  
Report: <[email protected]>  

M src/bin/pg_dump/pg_dump.c

Fix minor memory leak in Standby startup

commit   : d7c45172a673be1fc9e51e98e45a44c14d1ee78d    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 8 Sep 2016 11:20:21 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 8 Sep 2016 11:20:21 +0100    

Click here for diff

StandbyRecoverPreparedTransactions() leaked the buffer  
used for two phase state file. This was leaked once  
at startup and at every shutdown checkpoint seen.  
  
Backpatch to 9.6  
  
Stas Kelvich  

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

9.6 release notes: correct summary item about freeze

commit   : 5c8cb8c01f0a8d484de301f58e673ed9c732fbbe    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 7 Sep 2016 20:51:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 7 Sep 2016 20:51:28 -0400    

Click here for diff

Previously it less precisely talked about autovacuum.  
  
Backpatch-through: 9.6  

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

Doc: minor documentation improvements about extensions.

commit   : 01280ee203b7c34b48e61f874b497951cc63d8a7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Sep 2016 13:36:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Sep 2016 13:36:08 -0400    

Click here for diff

Document the formerly-undocumented behavior that schema and comment  
control-file entries for an extension are honored only during initial  
installation, whereas other properties are also honored during updates.  
  
While at it, do some copy-editing on the recently-added docs for CREATE  
EXTENSION ... CASCADE, use links for some formerly vague cross references,  
and make a couple other minor improvements.  
  
Back-patch to 9.6 where CASCADE was added.  The other parts of this  
could go further back, but they're probably not important enough to  
bother.  

M doc/src/sgml/extend.sgml
M doc/src/sgml/ref/create_extension.sgml

Doc: small improvements for documentation about VACUUM freezing.

commit   : ed3598f33f4c2a9eb07678bd29a90919e6c63938    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Sep 2016 17:50:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Sep 2016 17:50:53 -0400    

Click here for diff

Mostly, explain how row xmin's used to be replaced by FrozenTransactionId  
and no longer are.  Do a little copy-editing on the side.  
  
Per discussion with Egor Rogov.  Back-patch to 9.4 where the behavioral  
change occurred.  
  
Discussion: <[email protected]>  

M doc/src/sgml/maintenance.sgml

Guard against possible memory allocation botch in batchmemtuples().

commit   : 96ba40c0f15aa1e950b35536387fde30ebbc4547    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Sep 2016 15:50:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Sep 2016 15:50:31 -0400    

Click here for diff

Negative availMemLessRefund would be problematic.  It's not entirely  
clear whether the case can be hit in the code as it stands, but this  
seems like good future-proofing in any case.  While we're at it,  
insist that the value be not merely positive but not tiny, so as to  
avoid doing a lot of repalloc work for little gain.  
  
Peter Geoghegan  
  
Discussion: <CAM3SWZR[email protected]>  

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

Add regression test coverage for non-default timezone abbreviation sets.

commit   : 512c197b21aa86b1827bfc433f4aebc1469648fe    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Sep 2016 20:02:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Sep 2016 20:02:16 -0400    

Click here for diff

After further reflection about the mess cleaned up in commit 39b691f25,  
I decided the main bit of test coverage that was still missing was to  
check that the non-default abbreviation-set files we supply are usable.  
Add that.  
  
Back-patch to supported branches, just because it seems like a good  
idea to keep this all in sync.  

M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/timestamptz.sql
M src/timezone/README

Remove vestigial references to "zic" in favor of "IANA database".

commit   : 06b185d181897c4a9672e26b93d5abc89de52f85    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Sep 2016 19:42:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Sep 2016 19:42:08 -0400    

Click here for diff

Commit b2cbced9e instituted a policy of referring to the timezone database  
as the "IANA timezone database" in our user-facing documentation.  
Propagate that wording into a couple of places that were still using "zic"  
to refer to the database, which is definitely not right (zic is the  
compilation tool, not the data).  
  
Back-patch, not because this is very important in itself, but because  
we routinely cherry-pick updates to the tznames files and I don't want  
to risk future merge failures.  

M src/timezone/tznames/Africa.txt
M src/timezone/tznames/America.txt
M src/timezone/tznames/Asia.txt
M src/timezone/tznames/Australia
M src/timezone/tznames/Australia.txt
M src/timezone/tznames/Default
M src/timezone/tznames/Etc.txt
M src/timezone/tznames/Europe.txt
M src/timezone/tznames/Pacific.txt
M src/tools/RELEASE_CHANGES

Update release notes to mention need for ALTER EXTENSION UPDATE.

commit   : 7bdf63ccdc70e7168740bdc426195b3b5d508f29    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Sep 2016 13:19:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Sep 2016 13:19:55 -0400    

Click here for diff

Maybe we ought to make pg_upgrade do this for you, but it won't happen  
in 9.6, so call out the need for it as a migration consideration.  

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

Fix corrupt GIN_SEGMENT_ADDITEMS WAL records on big-endian hardware.

commit   : 36646d3aff0cf6ff9f26033e38808d23e27426e8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Sep 2016 13:28:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Sep 2016 13:28:53 -0400    

Click here for diff

computeLeafRecompressWALData() tried to produce a uint16 WAL log field by  
memcpy'ing the first two bytes of an int-sized variable.  That accidentally  
works on little-endian hardware, but not at all on big-endian.  Replay then  
thinks it's looking at an ADDITEMS action with zero entries, and reads the  
first two bytes of the first TID therein as the next segno/action,  
typically leading to "unexpected GIN leaf action" errors during replay.  
Even if replay failed to crash, the resulting GIN index page would surely  
be incorrect.  To fix, just declare the variable as uint16 instead.  
  
Per bug #14295 from Spencer Thomason (much thanks to Spencer for turning  
his problem into a self-contained test case).  This likely also explains  
a previous report of the same symptom from Bernd Helmle.  
  
Back-patch to 9.4 where the problem was introduced (by commit 14d02f0bb).  
  
Discussion: <[email protected]>  
Possible-Report: <[email protected]>  

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

Fix wording of logical decoding concepts

commit   : 33befe035d86d833a5bc7289612722a4e650227d    
  
author   : Simon Riggs <[email protected]>    
date     : Sat, 3 Sep 2016 16:19:41 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Sat, 3 Sep 2016 16:19:41 +0100    

Click here for diff

Be specific about conditions under which we emit >1 copy of message  
  
Craig Ringer  

M doc/src/sgml/logicaldecoding.sgml

Don't require dynamic timezone abbreviations to match underlying time zone.

commit   : 32c9950b39981026774cfd1e1c3e717ee71f7826    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Sep 2016 17:29:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Sep 2016 17:29:31 -0400    

Click here for diff

Previously, we threw an error if a dynamic timezone abbreviation did not  
match any abbreviation recorded in the referenced IANA time zone entry.  
That seemed like a good consistency check at the time, but it turns out  
that a number of the abbreviations in the IANA database are things that  
Olson and crew made up out of whole cloth.  Their current policy is to  
remove such names in favor of using simple numeric offsets.  Perhaps  
unsurprisingly, a lot of these made-up abbreviations have varied in meaning  
over time, which meant that our commit b2cbced9e and later changes made  
them into dynamic abbreviations.  So with newer IANA database versions  
that don't mention these abbreviations at all, we fail, as reported in bug  
#14307 from Neil Anderson.  It's worse than just a few unused-in-the-wild  
abbreviations not working, because the pg_timezone_abbrevs view stops  
working altogether (since its underlying function tries to compute the  
whole view result in one call).  
  
We considered deleting these abbreviations from our abbreviations list, but  
the problem with that is that we can't stay ahead of possible future IANA  
changes.  Instead, let's leave the abbreviations list alone, and treat any  
"orphaned" dynamic abbreviation as just meaning the referenced time zone.  
It will behave a bit differently than it used to, in that you can't any  
longer override the zone's standard vs. daylight rule by using the "wrong"  
abbreviation of a pair, but that's better than failing entirely.  (Also,  
this solution can be interpreted as adding a small new feature, which is  
that any abbreviation a user wants can be defined as referencing a time  
zone name.)  
  
Back-patch to all supported branches, since this problem affects all  
of them when using tzdata 2016f or newer.  
  
Report: <[email protected]>  
Discussion: <[email protected]>  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/datetime.sgml
M src/backend/utils/adt/datetime.c
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/timestamptz.sql

Prevent starting a standalone backend with standby_mode on.

commit   : 3fc489cb36a53bc246271107450c5cf5fcd5b009    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2016 08:52:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2016 08:52:13 -0400    

Click here for diff

This can't really work because standby_mode expects there to be more  
WAL arriving, which there will not ever be because there's no WAL  
receiver process to fetch it.  Moreover, if standby_mode is on then  
hot standby might also be turned on, causing even more strangeness  
because that expects read-only sessions to be executing in parallel.  
Bernd Helmle reported a case where btree_xlog_delete_get_latestRemovedXid  
got confused, but rather than band-aiding individual problems it seems  
best to prevent getting anywhere near this state in the first place.  
Back-patch to all supported branches.  
  
In passing, also fix some omissions of errcodes in other ereport's in  
readRecoveryCommandFile().  
  
Michael Paquier (errcode hacking by me)  
  
Discussion: <[email protected]>  

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

Update comments to reflect code rearrangement.

commit   : a66be67820063dc3d880b2a5408714b877eec8ae    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 31 Aug 2016 12:36:18 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 31 Aug 2016 12:36:18 +0530    

Click here for diff

Commit f9143d102ffd0947ca904c62b1d3d6fd587e0c80 falsified these.  
  
KaiGai Kohei  

M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h

Fix initdb misbehavior when user mis-enters superuser password.

commit   : d9720e4377911d9d4157221ff362226f2169fe4c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 30 Aug 2016 15:25:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 30 Aug 2016 15:25:01 -0400    

Click here for diff

While testing simple_prompt() revisions, I happened to notice that  
current initdb behaves rather badly when --pwprompt is specified and  
the user miskeys the second password.  It complains about the mismatch,  
does "rm -rf" on the data directory, and exits.  The problem is that  
since commit c4a8812cf, there's a standalone backend sitting waiting  
for commands at that point.  It gets unhappy about its datadir having  
gone away, and spews a PANIC message at the user, which is not nice.  
(And the shell then adds to the mess with meaningless bleating about a  
core dump...)  We don't really want that sort of thing to happen unless  
there's an internal failure in initdb, which this surely is not.  
  
The best fix seems to be to move the collection of the password  
earlier, so that it's done essentially as part of argument collection,  
rather than at the rather ad-hoc time it was done before.  
  
Back-patch to 9.6 where the problem was introduced.  

M src/bin/initdb/initdb.c

Stamp 9.6rc1.

commit   : 7961c31aa76b1ce9adaac7ee98c67c149c1a4eef    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Aug 2016 16:22:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Aug 2016 16:22:24 -0400    

Click here for diff

M configure
M configure.in
M doc/bug.template
M src/include/pg_config.h.win32

Translation updates

commit   : 7e3aad82e0b4dc7ed491b8bb7082c39f7a0212e9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Aug 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Aug 2016 12:00:00 -0400    

Click here for diff

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

M src/backend/po/de.po
M src/backend/po/pl.po
M src/backend/po/ru.po
M src/bin/psql/po/de.po
M src/bin/psql/po/ru.po
M src/pl/plpython/po/ru.po

Doc: improve 9.6 description of SP-GiST traverse values.

commit   : 9100f534030c543f95c11a2f9c5f1571f55999b9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Aug 2016 08:57:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Aug 2016 08:57:34 -0400    

Click here for diff

Sync relevant parts of commit d2ddee63b back to 9.6 branch.  

M doc/src/sgml/spgist.sgml

Fix pg_receivexlog --synchronous

commit   : 216fd7fe77c693a9595bb7550de2927dde650218    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 29 Aug 2016 12:18:12 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 29 Aug 2016 12:18:12 +0100    

Click here for diff

Make pg_receivexlog work correctly with —-synchronous without slots  
  
Backpatch to 9.5  
  
Gabriele Bartolini, reviewed by Michael Paquier and Simon Riggs  

M src/bin/pg_basebackup/receivelog.c

Fix pg_xlogdump so that it handles cross-page XLP_FIRST_IS_CONTRECORD record.

commit   : 2802b02a540c0f5bc2d11e801dc527d4240ed404    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 29 Aug 2016 14:34:58 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 29 Aug 2016 14:34:58 +0900    

Click here for diff

Previously pg_xlogdump failed to dump the contents of the WAL file  
if the file starts with the continuation WAL record which spans  
more than one pages. Since pg_xlogdump assumed that the continuation  
record always fits on a page, it could not find the valid WAL record to  
start reading from in that case.  
  
This patch changes pg_xlogdump so that it can handle a continuation  
WAL record which crosses a page boundary and find the valid record  
to start reading from.  
  
Back-patch to 9.3 where pg_xlogdump was introduced.  
  
Author: Pavan Deolasee  
Reviewed-By: Michael Paquier and Craig Ringer  
Discussion: CABO[email protected]  

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

Fix stray reference to the old genbki.sh script.

commit   : 9595bffc59831cfca1339b4eca35eac39e188209    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 Aug 2016 17:44:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 Aug 2016 17:44:29 -0400    

Click here for diff

Per Tomas Vondra.  

M src/include/catalog/pg_foreign_table.h

Make another editorial pass over the 9.6 release notes.

commit   : 1e17ceba093dbb3aecedb62ef879934514524db3    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 Aug 2016 17:40:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 Aug 2016 17:40:06 -0400    

Click here for diff

I think they're pretty much release-quality now.  

M doc/src/sgml/func.sgml
M doc/src/sgml/release-9.6.sgml

Update 9.6 release notes through today.

commit   : 197e8b7fa4eca5267f45c715419c52522dfc600f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 Aug 2016 12:37:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 Aug 2016 12:37:23 -0400    

Click here for diff

M doc/src/sgml/config.sgml
M doc/src/sgml/release-9.6.sgml

Add macros to make AllocSetContextCreate() calls simpler and safer.

commit   : b9fe6cbc81ea120a39be755f23d6615486c11618    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 27 Aug 2016 17:50:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 27 Aug 2016 17:50:38 -0400    

Click here for diff

I found that half a dozen (nearly 5%) of our AllocSetContextCreate calls  
had typos in the context-sizing parameters.  While none of these led to  
especially significant problems, they did create minor inefficiencies,  
and it's now clear that expecting people to copy-and-paste those calls  
accurately is not a great idea.  Let's reduce the risk of future errors  
by introducing single macros that encapsulate the common use-cases.  
Three such macros are enough to cover all but two special-purpose contexts;  
those two calls can be left as-is, I think.  
  
While this patch doesn't in itself improve matters for third-party  
extensions, it doesn't break anything for them either, and they can  
gradually adopt the simplified notation over time.  
  
In passing, change TopMemoryContext to use the default allocation  
parameters.  Formerly it could only be extended 8K at a time.  That was  
probably reasonable when this code was written; but nowadays we create  
many more contexts than we did then, so that it's not unusual to have a  
couple hundred K in TopMemoryContext, even without considering various  
dubious code that sticks other things there.  There seems no good reason  
not to let it use growing blocks like most other contexts.  
  
Back-patch to 9.6, mostly because that's still close enough to HEAD that  
it's easy to do so, and keeping the branches in sync can be expected to  
avoid some future back-patching pain.  The bugs fixed by these changes  
don't seem to be significant enough to justify fixing them further back.  
  
Discussion: <[email protected]>  

M contrib/bloom/blinsert.c
M contrib/dblink/dblink.c
M contrib/file_fdw/file_fdw.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/sepgsql/uavc.c
M contrib/test_decoding/test_decoding.c
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/common/printtup.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginscan.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/gistscan.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/copy.c
M src/backend/commands/event_trigger.c
M src/backend/commands/indexcmds.c
M src/backend/commands/policy.c
M src/backend/commands/trigger.c
M src/backend/commands/vacuum.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeHash.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/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/hba.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/util/clauses.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/walsender.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/reinit.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/smgr/md.c
M src/backend/tcop/postgres.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/jsonfuncs.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/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/hash/dynahash.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/sort/tuplesort.c
M src/include/utils/memutils.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/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_typeio.c
M src/pl/tcl/pltcl.c

Add a nonlocalized version of the severity field to client error messages.

commit   : e796d0abab0f9508326c0aa721fe1475548fbe4e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Aug 2016 16:20:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Aug 2016 16:20:17 -0400    

Click here for diff

This has been requested a few times, but the use-case for it was never  
entirely clear.  The reason for adding it now is that transmission of  
error reports from parallel workers fails when NLS is active, because  
pq_parse_errornotice() wrongly assumes that the existing severity field  
is nonlocalized.  There are other ways we could have fixed that, but the  
other options were basically kluges, whereas this way provides something  
that's at least arguably a useful feature along with the bug fix.  
  
Per report from Jakob Egger.  Back-patch into 9.6, because otherwise  
parallel query is essentially unusable in non-English locales.  The  
problem exists in 9.5 as well, but we don't want to risk changing  
on-the-wire behavior in 9.5 (even though the possibility of new error  
fields is specifically called out in the protocol document).  It may  
be sufficient to leave the issue unfixed in 9.5, given the very limited  
usefulness of pq_parse_errornotice in that version.  
  
Discussion: <[email protected]>  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/protocol.sgml
M src/backend/libpq/pqmq.c
M src/backend/utils/error/elog.c
M src/include/postgres_ext.h
M src/interfaces/libpq/fe-exec.c

Fix potential memory leakage from HandleParallelMessages().

commit   : bef2d627f30c0d854d02dc860b0d54fa3309d4ee    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Aug 2016 15:04:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Aug 2016 15:04:05 -0400    

Click here for diff

HandleParallelMessages leaked memory into the caller's context.  Since it's  
called from ProcessInterrupts, there is basically zero certainty as to what  
CurrentMemoryContext is, which means we could be leaking into long-lived  
contexts.  Over the processing of many worker messages that would grow to  
be a problem.  Things could be even worse than just a leak, if we happened  
to service the interrupt while ErrorContext is current: elog.c thinks it  
can reset that on its own whim, possibly yanking storage out from under  
HandleParallelMessages.  
  
Give HandleParallelMessages its own dedicated context instead, which we can  
reset during each call to ensure there's no accumulation of wasted memory.  
  
Discussion: <[email protected]>  

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

Put static forward declarations in elog.c back into same order as code.

commit   : 42ebdc8129f038e06e17d7b3da7fc11897323814    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Aug 2016 14:19:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Aug 2016 14:19:03 -0400    

Click here for diff

The guiding principle for the last few patches in this area apparently  
involved throwing darts.  
  
Cosmetic only, but back-patch to 9.6 because there is no reason for  
9.6 and HEAD to diverge yet in this file.  

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

Fix assorted small bugs in ThrowErrorData().

commit   : 6e47c6cf7de30b9f6a6b31eb7d4af80039a16920    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Aug 2016 14:15:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Aug 2016 14:15:47 -0400    

Click here for diff

Copy the palloc'd strings into the correct context, ie ErrorContext  
not wherever the source ErrorData is.  This would be a large bug,  
except that it appears that all catchers of thrown errors do either  
EmitErrorReport or CopyErrorData before doing anything that would  
cause transient memory contexts to be cleaned up.  Still, it's wrong  
and it will bite somebody someday.  
  
Fix failure to copy cursorpos and internalpos.  
  
Utter the appropriate incantations involving recursion_depth, so that  
we'll behave sanely if we get an error inside pstrdup.  (In general,  
the body of this function ought to act like, eg, errdetail().)  
  
Per code reading induced by Jakob Egger's report.  

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

Fix logic for adding "parallel worker" context line to worker errors.

commit   : 9dca62e9ff3db2f482c829884b24a425692a5a18    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Aug 2016 10:07:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Aug 2016 10:07:28 -0400    

Click here for diff

The previous coding here was capable of adding a "parallel worker" context  
line to errors that were not, in fact, returned from a parallel worker.  
Instead of using an errcontext callback to add that annotation, just paste  
it onto the message by hand; this looks uglier but is more reliable.  
  
Discussion: <[email protected]>  

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

Fix instability in parallel regression tests.

commit   : e6bd440688af13449bcb1b80698e6ef4b16245a6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Aug 2016 09:57:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Aug 2016 09:57:09 -0400    

Click here for diff

Commit f0c7b789a added a test case in case.sql that creates and then drops  
both an '=' operator and the type it's for.  Given the right timing, that  
can cause a "cache lookup failed for type" failure in concurrent sessions,  
which see the '=' operator as a potential match for '=' in a query, but  
then the type is gone by the time they inquire into its properties.  
It might be nice to make that behavior more robust someday, but as a  
back-patchable solution, adjust the new test case so that the operator  
is never visible to other sessions.  Like the previous commit, back-patch  
to all supported branches.  
  
Discussion: <[email protected]>  

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

Fix small query-lifespan memory leak in bulk updates.

commit   : 006fb80a569179d3df4932857818925667e8d581    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 24 Aug 2016 22:20:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 24 Aug 2016 22:20:01 -0400    

Click here for diff

When there is an identifiable REPLICA IDENTITY index on the target table,  
heap_update leaks the id_attrs bitmapset.  That's not many bytes, but it  
adds up over enough rows, since the code typically runs in a query-lifespan  
context.  Bug introduced in commit e55704d8b, which did a rather poor job  
of cloning the existing use-pattern for RelationGetIndexAttrBitmap().  
  
Per bug #14293 from Zhou Digoal.  Back-patch to 9.4 where the bug was  
introduced.  
  
Report: <[email protected]>  

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

doc: more replacement of <literal> with something better

commit   : 1414d490f7eee23bf3544953a47340e9b54fcf29    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 24 Aug 2016 21:11:44 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 24 Aug 2016 21:11:44 -0400    

Click here for diff

Reported-by: Alexander Law  
  
Author: Alexander Law  
  
Backpatch-through: 9.6  

M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/create_sequence.sgml
M doc/src/sgml/ref/set_role.sgml
M doc/src/sgml/ref/set_session_auth.sgml
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/xfunc.sgml

Fix improper repetition of previous results from a hashed aggregate.

commit   : 616be05dfea09e8221e190086c0d75351f3a57ca    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 24 Aug 2016 14:37:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 24 Aug 2016 14:37:50 -0400    

Click here for diff

ExecReScanAgg's check for whether it could re-use a previously calculated  
hashtable neglected the possibility that the Agg node might reference  
PARAM_EXEC Params that are not referenced by its input plan node.  That's  
okay if the Params are in upper tlist or qual expressions; but if one  
appears in aggregate input expressions, then the hashtable contents need  
to be recomputed when the Param's value changes.  
  
To avoid unnecessary performance degradation in the case of a Param that  
isn't within an aggregate input, add logic to the planner to determine  
which Params are within aggregate inputs.  This requires a new field in  
struct Agg, but fortunately we never write plans to disk, so this isn't  
an initdb-forcing change.  
  
Per report from Jeevan Chalke.  This has been broken since forever,  
so back-patch to all supported branches.  
  
Andrew Gierth, with minor adjustments by me  
  
Report: <CAM2+6=V[email protected]>  

M src/backend/executor/nodeAgg.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/subselect.c
M src/include/nodes/plannodes.h
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Remove unnecessary #include.

commit   : eaae83c123f5e8e103abbbe822fe73b791d9d5c9    
  
author   : Kevin Grittner <[email protected]>    
date     : Wed, 24 Aug 2016 13:20:25 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Wed, 24 Aug 2016 13:20:25 -0500    

Click here for diff

Accidentally added in 8b65cf4c5edabdcae45ceaef7b9ac236879aae50.  
  
Pointed out by Álvaro Herrera  

M src/include/storage/bufmgr.h

Build libpgfeutils before pg_isready.

commit   : be84c12ae9d65be85765c2b70bf14773d133c4f0    
  
author   : Noah Misch <[email protected]>    
date     : Tue, 23 Aug 2016 23:40:38 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Tue, 23 Aug 2016 23:40:38 -0400    

Click here for diff

Every program having -lpgfeutils in LDFLAGS must have this dependency,  
whether or not the program uses a libpgfeutils symbol.  Back-patch to  
9.6, where libpgfeutils was introduced.  

M src/bin/scripts/Makefile

Suppress compiler warnings in non-cassert builds.

commit   : 5c0b74240cb1f25a09b9b38d7cb665c0935a5d81    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2016 23:21:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2016 23:21:10 -0400    

Click here for diff

With Asserts off, these variables are set but never used, resulting  
in warnings from pickier compilers.  Fix that with our standard solution.  
Per report from Jeff Janes.  

M src/backend/access/gist/gistutil.c
M src/backend/utils/adt/amutils.c

doc: fix incorrect 'literal' tags

commit   : fcf1ed48ef0b2a92f903104160f792b5c10c6595    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 23 Aug 2016 12:45:33 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 23 Aug 2016 12:45:33 -0400    

Click here for diff

Discussion: [email protected]  
  
Author: Alexander Law <[email protected]>  
  
Backpatch-through: 9.6  

M doc/src/sgml/pgstandby.sgml
M doc/src/sgml/ref/pg_xlogdump.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/psql-ref.sgml

doc: fix typo in recent patch

commit   : 221d63c8d0decb58b9b08e265d24700385a9cdbc    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 22 Aug 2016 17:20:44 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 22 Aug 2016 17:20:44 -0400    

Click here for diff

Reported-by: Jeff Janes  
  
Backpatch-through: 9.6  

M doc/src/sgml/runtime.sgml

Fix possible sorting error when aborting use of abbreviated keys.

commit   : 48b9ca0b60ce4e92caf6b2ad68d40d09f1795fca    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 22 Aug 2016 15:22:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 22 Aug 2016 15:22:11 -0400    

Click here for diff

Due to an error in the abbreviated key abort logic, the most recently  
processed SortTuple could be incorrectly marked NULL, resulting in an  
incorrect final sort order.  
  
In the worst case, this could result in a corrupt btree index, which  
would need to be rebuild using REINDEX.  However, abbrevation doesn't  
abort very often, not all data types use it, and only one tuple would  
end up in the wrong place, so the practical impact of this mistake may  
be somewhat limited.  
  
Report and patch by Peter Geoghegan.  

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

Guard against parallel-restricted functions in VALUES expressions.

commit   : c3813268a7eca8000b8963c079e521eccd960620    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Aug 2016 14:35:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Aug 2016 14:35:32 -0400    

Click here for diff

Obvious brain fade in set_rel_consider_parallel().  Noticed it while  
adjusting the adjacent RTE_FUNCTION case.  
  
In 9.6, also make the code look more like what I just did in HEAD  
by removing the unnecessary function_rte_parallel_ok subroutine  
(it does nothing that expression_tree_walker wouldn't do).  

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

reorderbuffer: preserve errno while reporting error

commit   : 0440f49523fb88a3ecbc1672d8fcee20197c5c40    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 19 Aug 2016 14:38:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 19 Aug 2016 14:38:55 -0300    

Click here for diff

Clobbering errno during cleanup after an error is an oft-repeated, easy  
to make mistake.  Deal with it here as everywhere else, by saving it  
aside and restoring after cleanup, before ereport'ing.  
  
In passing, add a missing errcode declaration in another ereport() call  
in the same file, which I noticed while skimming the file looking for  
similar problems.  
  
Backpatch to 9.4, where this code was introduced.  

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

doc: requirepeer is a way to avoid spoofing

commit   : 2b4ae9c29d42ce7b1b7bb947c585b78a21535aa2    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 18 Aug 2016 21:41:10 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 18 Aug 2016 21:41:10 -0400    

Click here for diff

We already mentioned unix_socket_directories as an option.  
  
Reported-by: https://www.postgresql.org/message-id/45016837-6cf3-3136-f959-763d06a28076%402ndquadrant.com  
  
Backpatch-through: 9.6  

M doc/src/sgml/runtime.sgml

Add alternative output for ON CONFLICT toast isolation test.

commit   : 0d5afd3f21e1f3bfb76a50aa613620b9caba4a4e    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 18 Aug 2016 17:30:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 18 Aug 2016 17:30:14 -0700    

Click here for diff

On some buildfarm animals the isolationtest added in 07ef0351 failed, as  
the order in which processes are run after unlocking is not  
guaranteed. Add an alternative output for that.  
  
Discussion: <[email protected]>  
Backpatch: 9.6, like the test in the aforementioned commit  

A src/test/isolation/expected/insert-conflict-toast_1.out

Update line count totals for psql help displays.

commit   : 6ab10fe2afa7690e84a5845ede51b81690020064    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2016 16:04:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2016 16:04:35 -0400    

Click here for diff

As usual, we've been pretty awful about maintaining these counts.  
They're not all that critical, perhaps, but let's get them right  
at release time.  Also fix 9.5, which I notice is just as bad.  
It's probably wrong further back, but the lack of --help=foo  
options before 9.5 makes it too painful to count.  

M src/bin/psql/help.c

In plpgsql, don't try to convert int2vector or oidvector to expanded array.

commit   : c81c71d8846fa1667e67b45559ce4c72a8e076d9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2016 14:48:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2016 14:48:51 -0400    

Click here for diff

These types are storage-compatible with real arrays, but they don't support  
toasting, so of course they can't support expansion either.  
  
Per bug #14289 from Michael Overmeyer.  Back-patch to 9.5 where expanded  
arrays were introduced.  
  
Report: <[email protected]>  

M src/include/utils/array.h
M src/pl/plpgsql/src/pl_comp.c

Update Windows timezone mapping from Windows 7 and 10

commit   : 191d45793df71d69b83cfa3c8c2747f7597ba1b7    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 18 Aug 2016 12:32:42 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 18 Aug 2016 12:32:42 +0200    

Click here for diff

This adds a couple of new timezones that are present in the newer  
versions of Windows. It also updates comments to reference UTC rather  
than GMT, as this change has been made in Windows.  
  
Michael Paquier  

M src/bin/initdb/findtimezone.c

Fix deletion of speculatively inserted TOAST on conflict

commit   : e79aaebccd1bd12c477af838015252059f989b2b    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 17 Aug 2016 17:03:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 17 Aug 2016 17:03:36 -0700    

Click here for diff

INSERT ..  ON CONFLICT runs a pre-check of the possible conflicting  
constraints before performing the actual speculative insertion.  In case  
the inserted tuple included TOASTed columns the ON CONFLICT condition  
would be handled correctly in case the conflict was caught by the  
pre-check, but if two transactions entered the speculative insertion  
phase at the same time, one would have to re-try, and the code for  
aborting a speculative insertion did not handle deleting the  
speculatively inserted TOAST datums correctly.  
  
TOAST deletion would fail with "ERROR: attempted to delete invisible  
tuple" as we attempted to remove the TOAST tuples using  
simple_heap_delete which reasoned that the given tuples should not be  
visible to the command that wrote them.  
  
This commit updates the heap_abort_speculative() function which aborts  
the conflicting tuple to use itself, via toast_delete, for deleting  
associated TOAST datums.  Like before, the inserted toast rows are not  
marked as being speculative.  
  
This commit also adds a isolationtester spec test, exercising the  
relevant code path. Unfortunately 9.5 cannot handle two waiting  
sessions, and thus cannot execute this test.  
  
Reported-By: Viren Negi, Oskari Saarenmaa  
Author: Oskari Saarenmaa, edited a bit by me  
Bug: #14150  
Discussion: <[email protected]>  
Backpatch: 9.5, where ON CONFLICT was introduced  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/tuptoaster.c
M src/backend/utils/time/tqual.c
M src/include/access/tuptoaster.h
A src/test/isolation/expected/insert-conflict-toast.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/insert-conflict-toast.spec

Properly re-initialize replication slot shared memory upon creation.

commit   : 8cb23dba8d75d9be8f1cc58bdfcbcd8e410be39a    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 17 Aug 2016 13:15:03 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 17 Aug 2016 13:15:03 -0700    

Click here for diff

Slot creation did not clear all fields upon creation. After start the  
memory is zeroed, but when a physical replication slot was created in  
the shared memory of a previously existing logical slot, catalog_xmin  
would not be cleared. That in turn would prevent vacuum from doing its  
duties.  
  
To fix initialize all the fields. To make similar future bugs less  
likely, zero all of ReplicationSlotPersistentData, and re-order the  
rest of the initialization to be in struct member order.  
  
Analysis: Andrew Gierth  
Reported-By: [email protected]  
Author: Michael Paquier  
Discussion: <[email protected]>  
Backpatch: 9.4, where replication slots were introduced  

M src/backend/replication/slot.c

Fix -e option in contrib/intarray/bench/bench.pl.

commit   : d715b76d12fa516370ce0b56a708fe1521605b66    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Aug 2016 15:51:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Aug 2016 15:51:10 -0400    

Click here for diff

As implemented, -e ran an EXPLAIN but then discarded the output, which  
certainly seems pointless.  Make it print to stdout instead.  It's been  
like that forever, so back-patch to all supported branches.  
  
Daniel Gustafsson, reviewed by Andreas Scherbaum  
  
Patch: <[email protected]>  

M contrib/intarray/bench/bench.pl

Disable update_process_title by default on Windows

commit   : 9b33c7e80d5ac9d85cbb9330f172a5e606876b1c    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 17 Aug 2016 10:39:22 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 17 Aug 2016 10:39:22 +0200    

Click here for diff

The performance overhead of this can be significant on Windows, and most  
people don't have the tools to view it anyway as Windows does not have  
native support for process titles.  
  
Discussion: <0A3221C70F24FB45833433255569204D1F5BE3E8@G01JPEXMBYT05>  
  
Takayuki Tsunakawa  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc.c
M src/bin/initdb/initdb.c

docs: my third pass over the 9.6 release notes

commit   : dd028e904c67dae5f5d51da73628a8bd3cb1f5f1    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 16 Aug 2016 23:04:50 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 16 Aug 2016 23:04:50 -0400    

Click here for diff

Backpatch-through: 9.6  

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

Suppress -Wunused-result warning for strtol().

commit   : f1222ad61a362e67ebb9284d0265470d05b5e338    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Aug 2016 16:14:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Aug 2016 16:14:16 -0400    

Click here for diff

I'm not sure which bozo thought it's a problem to use strtol() only  
for its endptr result, but silence the warning using same method  
used elsewhere.  
  
Report: <[email protected]>  

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

Fix assorted places in psql to print version numbers >= 10 in new style.

commit   : 32b99efd6a39ca06abe0514865da5f75e2e3f69b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Aug 2016 15:58:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Aug 2016 15:58:30 -0400    

Click here for diff

This is somewhat cosmetic, since as long as you know what you are looking  
at, "10.0" is a serviceable substitute for "10".  But there is a potential  
for confusion between version numbers with minor numbers and those without  
--- we don't want people asking "why is psql saying 10.0 when my server is  
10.2".  Therefore, back-patch as far as practical, which turns out to be  
9.3.  I could have redone the patch to use fprintf(stderr) in place of  
psql_error(), but it seems more work than is warranted for branches that  
will be EOL or nearly so by the time v10 comes out.  
  
Although only psql seems to contain any code that needs this, I chose  
to put the support function into fe_utils, since it seems likely we'll  
need it in other client programs in future.  (In 9.3-9.5, use dumputils.c,  
the predecessor of fe_utils/string_utils.c.)  
  
In HEAD, also fix the backend code that whines about loadable-library  
version mismatch.  I don't see much need to back-patch that.  

M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/describe.c
M src/fe_utils/string_utils.c
M src/include/fe_utils/string_utils.h

doc: Remove some confusion from pg_archivecleanup doc

commit   : 203bf7f4078451c2a75c21251882227cf67e1cd3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 Aug 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 Aug 2016 12:00:00 -0400    

Click here for diff

From: Jeff Janes <[email protected]>  

M doc/src/sgml/ref/pgarchivecleanup.sgml

Fix typos

commit   : 7c7630c2022156d54adf6c1d27c30f2b75138f03    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 Aug 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 Aug 2016 12:00:00 -0400    

Click here for diff

From: Alexander Law <[email protected]>  

M doc/src/sgml/release-9.6.sgml
M doc/src/sgml/runtime.sgml
M src/backend/access/transam/multixact.c
M src/backend/utils/adt/tsquery.c
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Fix possible crash due to incorrect allocation context.

commit   : 0aa1e9a44db0b8f8b08acadf2833c724489bd279    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 16 Aug 2016 13:23:32 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 16 Aug 2016 13:23:32 -0400    

Click here for diff

Commit af33039317ddc4a0e38a02e2255c2bf453115fd2 aimed to reduce  
leakage from tqueue.c, which is good.  Unfortunately, by changing the  
memory context in which all of gather_readnext() executes, it also  
changed the context in which ExecShutdownGatherWorkers executes, which  
is not good, because that function eventually causes a call to  
ExecParallelRetrieveInstrumentation, which proceeds to allocate  
planstate->worker_instrument in a short-lived context, causing a  
crash.  
  
Rushabh Lathia, reviewed by Amit Kapila and by me.  

M src/backend/executor/execParallel.c

Doc: copy-editing in create_access_method.sgml.

commit   : d95a7c3fbcfd5e65802f7fb0bee31a914160d9ed    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Aug 2016 11:35:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Aug 2016 11:35:36 -0400    

Click here for diff

Improve shaky English grammar.  And markup.  

M doc/src/sgml/ref/create_access_method.sgml

Doc: remove out-of-date claim that pg_am rows must be inserted by hand.

commit   : 23e0d97d1ca5dc4c455fec01cf4bb65158bb2484    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Aug 2016 10:59:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Aug 2016 10:59:14 -0400    

Click here for diff

Commit 473b93287 added a sentence about that, but neglected to remove  
the adjacent sentence it had falsified.  Per Alexander Law.  

M doc/src/sgml/indexam.sgml

Disable parallel query by default.

commit   : f85b1a84152f7bf019fd7a2c5eede97867dcddbb    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 16 Aug 2016 08:09:15 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 16 Aug 2016 08:09:15 -0400    

Click here for diff

Per discussion, set the default value of max_parallel_workers_per_gather  
to 0 in 9.6 only.  We'll leave it enabled in master so that it gets  
more testing and in the hope that it can be enable by default in v10.  

M doc/src/sgml/config.sgml
M src/backend/optimizer/path/costsize.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample

Final pgindent + perltidy run for 9.6.

commit   : b5bce6c1ec6061c8a4f730d927e162db7e2ce365    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Aug 2016 13:42:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Aug 2016 13:42:51 -0400    

Click here for diff

M src/backend/access/brin/brin_validate.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/tuptoaster.c
M src/backend/commands/variable.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/syncrep.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/sort/tuplesort.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/commands/async.h
M src/include/tsearch/ts_type.h
M src/pl/plpython/plpy_plpymodule.c
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/PostgresNode.pm
M src/test/recovery/t/003_recovery_targets.pl
M src/tools/msvc/Install.pm
M src/tools/msvc/vcregress.pl
M src/tools/pgindent/typedefs.list

Simplify the process of perltidy'ing our Perl files.

commit   : 05d8dec690e9719ff9a1830f5492864104275b5e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Aug 2016 11:32:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Aug 2016 11:32:09 -0400    

Click here for diff

Wrap the perltidy invocation into a shell script to reduce the risk of  
copy-and-paste errors.  Include removal of *.bak files in the script,  
so they don't accidentally get committed.  Improve the directions in  
the README file.  

M src/tools/pgindent/README
M src/tools/pgindent/exclude_file_patterns
A src/tools/pgindent/pgperltidy

Remove bogus dependencies on NUMERIC_MAX_PRECISION.

commit   : 9389fbd0385776adf3252eb8cfe6e37a640fdff4    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 Aug 2016 15:06:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 Aug 2016 15:06:01 -0400    

Click here for diff

NUMERIC_MAX_PRECISION is a purely arbitrary constraint on the precision  
and scale you can write in a numeric typmod.  It might once have had  
something to do with the allowed range of a typmod-less numeric value,  
but at least since 9.1 we've allowed, and documented that we allowed,  
any value that would physically fit in the numeric storage format;  
which is something over 100000 decimal digits, not 1000.  
  
Hence, get rid of numeric_in()'s use of NUMERIC_MAX_PRECISION as a limit  
on the allowed range of the exponent in scientific-format input.  That was  
especially silly in view of the fact that you can enter larger numbers as  
long as you don't use 'e' to do it.  Just constrain the value enough to  
avoid localized overflow, and let make_result be the final arbiter of what  
is too large.  Likewise adjust ecpg's equivalent of this code.  
  
Also get rid of numeric_recv()'s use of NUMERIC_MAX_PRECISION to limit the  
number of base-NBASE digits it would accept.  That created a dump/restore  
hazard for binary COPY without doing anything useful; the wire-format  
limit on number of digits (65535) is about as tight as we would want.  
  
In HEAD, also get rid of pg_size_bytes()'s unnecessary intimacy with what  
the numeric range limit is.  That code doesn't exist in the back branches.  
  
Per gripe from Aravind Kumar.  Back-patch to all supported branches,  
since they all contain the documentation claim about allowed range of  
NUMERIC (cf commit cabf5d84b).  
  
Discussion: <[email protected]>  

M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/numeric.c
M src/include/utils/numeric.h
M src/interfaces/ecpg/pgtypeslib/numeric.c
M src/test/regress/expected/dbsize.out

Fix assorted bugs in contrib/bloom.

commit   : d6c9e05cb7db64239887fac65b243229594f331d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Aug 2016 22:24:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Aug 2016 22:24:48 -0400    

Click here for diff

In blinsert(), cope with the possibility that a page we pull from the  
notFullPage list is marked BLOOM_DELETED.  This could happen if VACUUM  
recently marked it deleted but hasn't (yet) updated the metapage.  
We can re-use such a page safely, but we *must* reinitialize it so that  
it's no longer marked deleted.  
  
Fix blvacuum() so that it updates the notFullPage list even if it's  
going to update it to empty.  The previous "optimization" of skipping  
the update seems pretty dubious, since it means that the next blinsert()  
will uselessly visit whatever pages we left in the list.  
  
Uniformly treat PageIsNew pages the same as deleted pages.  This should  
allow proper recovery if a crash occurs just after relation extension.  
  
Properly use vacuum_delay_point, not assorted ad-hoc CHECK_FOR_INTERRUPTS  
calls, in the blvacuum() main loop.  
  
Fix broken tuple-counting logic: blvacuum.c counted the number of live  
index tuples over again in each scan, leading to VACUUM VERBOSE reporting  
some multiple of the actual number of surviving index tuples after any  
vacuum that removed any tuples (since they'd be counted in blvacuum, maybe  
more than once, and then again in blvacuumcleanup, without ever zeroing the  
counter).  It's sufficient to count them in blvacuumcleanup.  
  
stats->estimated_count is a boolean, not a counter, and we don't want  
to set it true, so don't add tuple counts to it.  
  
Add a couple of Asserts that we don't overrun available space on a bloom  
page.  I don't think there's any bug there today, but the way the  
FreeBlockNumberArray size calculation is set up is scarily fragile, and  
BloomPageGetFreeSpace isn't much better.  The Asserts should help catch  
any future mistakes.  
  
Per investigation of a report from Jeff Janes.  I think the first item  
above may explain his report; the other changes were things I noticed  
while casting about for an explanation.  
  
Report: <CAMkU=1x[email protected]>  

M contrib/bloom/blinsert.c
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c

Add SQL-accessible functions for inspecting index AM properties.

commit   : ed0097e4f9e6b1227935e01fa67f12a238b66064    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Aug 2016 18:31:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Aug 2016 18:31:14 -0400    

Click here for diff

Per discussion, we should provide such functions to replace the lost  
ability to discover AM properties by inspecting pg_am (cf commit  
65c5fcd35).  The added functionality is also meant to displace any code  
that was looking directly at pg_index.indoption, since we'd rather not  
believe that the bit meanings in that field are part of any client API  
contract.  
  
As future-proofing, define the SQL API to not assume that properties that  
are currently AM-wide or index-wide will remain so unless they logically  
must be; instead, expose them only when inquiring about a specific index  
or even specific index column.  Also provide the ability for an index  
AM to override the behavior.  
  
In passing, document pg_am.amtype, overlooked in commit 473b93287.  
  
Andrew Gierth, with kibitzing by me and others  
  
Discussion: <[email protected]>  

M contrib/bloom/blutils.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistutil.c
M src/backend/access/hash/hash.c
M src/backend/access/index/amapi.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/spgist/spgutils.c
M src/backend/catalog/index.c
M src/backend/commands/opclasscmds.c
M src/backend/executor/execAmi.c
M src/backend/utils/adt/Makefile
A src/backend/utils/adt/amutils.c
M src/include/access/amapi.h
M src/include/access/gist_private.h
M src/include/access/nbtree.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h
A src/test/regress/expected/amutils.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/amutils.sql

Doc: clarify that DROP ... CASCADE is recursive.

commit   : 499787819309293f3d2cd7219aee334a0e7d5069    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Aug 2016 18:45:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Aug 2016 18:45:18 -0400    

Click here for diff

Apparently that's not obvious to everybody, so let's belabor the point.  
  
In passing, document that DROP POLICY has CASCADE/RESTRICT options (which  
it does, per gram.y) but they do nothing (I assume, anyway).  Also update  
some long-obsolete commentary in gram.y.  
  
Discussion: <[email protected]>  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_domain.sgml
M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/drop_access_method.sgml
M doc/src/sgml/ref/drop_aggregate.sgml
M doc/src/sgml/ref/drop_collation.sgml
M doc/src/sgml/ref/drop_domain.sgml
M doc/src/sgml/ref/drop_event_trigger.sgml
M doc/src/sgml/ref/drop_extension.sgml
M doc/src/sgml/ref/drop_foreign_data_wrapper.sgml
M doc/src/sgml/ref/drop_foreign_table.sgml
M doc/src/sgml/ref/drop_function.sgml
M doc/src/sgml/ref/drop_index.sgml
M doc/src/sgml/ref/drop_language.sgml
M doc/src/sgml/ref/drop_materialized_view.sgml
M doc/src/sgml/ref/drop_opclass.sgml
M doc/src/sgml/ref/drop_operator.sgml
M doc/src/sgml/ref/drop_opfamily.sgml
M doc/src/sgml/ref/drop_owned.sgml
M doc/src/sgml/ref/drop_policy.sgml
M doc/src/sgml/ref/drop_rule.sgml
M doc/src/sgml/ref/drop_schema.sgml
M doc/src/sgml/ref/drop_sequence.sgml
M doc/src/sgml/ref/drop_server.sgml
M doc/src/sgml/ref/drop_table.sgml
M doc/src/sgml/ref/drop_transform.sgml
M doc/src/sgml/ref/drop_trigger.sgml
M doc/src/sgml/ref/drop_tsconfig.sgml
M doc/src/sgml/ref/drop_tsdictionary.sgml
M doc/src/sgml/ref/drop_tsparser.sgml
M doc/src/sgml/ref/drop_tstemplate.sgml
M doc/src/sgml/ref/drop_type.sgml
M doc/src/sgml/ref/drop_view.sgml
M src/backend/parser/gram.y

Fix inappropriate printing of never-measured times in EXPLAIN.

commit   : 4b234fd8bf21cd6f5ff44f1f1c613bf40860998d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Aug 2016 12:13:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Aug 2016 12:13:04 -0400    

Click here for diff

EXPLAIN (ANALYZE, TIMING OFF) would print an elapsed time of zero for  
a trigger function, because no measurement has been taken but it printed  
the field anyway.  This isn't what EXPLAIN does elsewhere, so suppress it.  
  
In the same vein, EXPLAIN (ANALYZE, BUFFERS) with non-text output format  
would print buffer I/O timing numbers even when no measurement has been  
taken because track_io_timing is off.  That seems not per policy, either,  
so change it.  
  
Back-patch to 9.2 where these features were introduced.  
  
Maksim Milyutin  
  
Discussion: <[email protected]>  

M src/backend/commands/explain.c

Code cleanup in SyncRepWaitForLSN()

commit   : e05f6f75dbe00a7349dccf1116b5ed983b4728c0    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 12 Aug 2016 12:43:45 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 12 Aug 2016 12:43:45 +0100    

Click here for diff

Commit 14e8803f1 removed LWLocks when accessing MyProc->syncRepState  
but didn't clean up the surrounding code and comments.  
  
Cleanup and backpatch to 9.5, to keep code similar.  
  
Julien Rouhaud, improved by suggestion from Michael Paquier,  
implemented trivially by myself.  

M src/backend/replication/syncrep.c

Correct TABLESAMPLE docs

commit   : 6e75559ea9cb0bc8fd07543567cd02d4ec85ca20    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 12 Aug 2016 10:34:43 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 12 Aug 2016 10:34:43 +0100    

Click here for diff

Original wording was correct but not the intended meaning.  
  
Reported by Patrik Wenger  

M doc/src/sgml/ref/select.sgml

Add ID property to replication slots' sect2

commit   : 371b572df2d7e24750f8d0fc2e45d673ac70beec    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 11 Aug 2016 15:09:24 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 11 Aug 2016 15:09:24 -0400    

Click here for diff

M doc/src/sgml/logicaldecoding.sgml

Trivial cosmetic cleanup in bloom/blutils.c.

commit   : e3049285a3b8790e26e584fdf1ca31ea2e2eb4bc    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Aug 2016 12:23:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Aug 2016 12:23:35 -0400    

Click here for diff

Don't spell "InvalidOid" as "0".  Initialize method fields in the same  
order as amapi.h declares them (and every other AM handler initializes  
them).  

M contrib/bloom/blutils.c

Fix busted Assert for CREATE MATVIEW ... WITH NO DATA.

commit   : 0f249fe5f5cb3c83fd8e05743740b35ff5d34196    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Aug 2016 11:22:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Aug 2016 11:22:25 -0400    

Click here for diff

Commit 874fe3aea changed the command tag returned for CREATE MATVIEW/CREATE  
TABLE AS ... WITH NO DATA, but missed that there was code in spi.c that  
expected the command tag to always be "SELECT".  Fortunately, the  
consequence was only an Assert failure, so this oversight should have no  
impact in production builds.  
  
Since this code path was evidently un-exercised, add a regression test.  
  
Per report from Shivam Saxena. Back-patch to 9.3, like the previous commit.  
  
Michael Paquier  
  
Report: <[email protected]>  

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

docs: my second pass over the 9.6 release notes

commit   : fd5a2db774c1952567f75603dffb6d9fb0b0013d    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 10 Aug 2016 23:08:44 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 10 Aug 2016 23:08:44 -0400    

Click here for diff

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

Doc: write some for adminpack.

commit   : ff2fd6b06ac00a3c5d451063e0a87dca6156db4e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Aug 2016 21:39:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Aug 2016 21:39:50 -0400    

Click here for diff

Previous contents of adminpack.sgml were rather far short of project norms.  
Not to mention being outright wrong about the signature of pg_file_read().  

M doc/src/sgml/adminpack.sgml

Fix typo

commit   : ab0a23c7c9a4b6dfba7fbffe798452299a6444b9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 Aug 2016 19:07:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 Aug 2016 19:07:24 -0400    

Click here for diff

M contrib/pgcrypto/px.c

docs: my first pass over the 9.6 release notes

commit   : 2abf92bc698558699c199ff14261b00ee92e98dd    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 9 Aug 2016 18:36:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 9 Aug 2016 18:36:16 -0400    

Click here for diff

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

Doc: clarify description of CREATE/ALTER FUNCTION ... SET FROM CURRENT.

commit   : e775d35317590793863327fedcf3737c3ab838d4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Aug 2016 13:39:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Aug 2016 13:39:24 -0400    

Click here for diff

Per discussion with David Johnston.  

M doc/src/sgml/ref/alter_function.sgml
M doc/src/sgml/ref/create_function.sgml

Stamp 9.6beta4.

commit   : 67c08c0d704a5f828492642bf9d133cbb2af3661    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2016 16:25:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2016 16:25:04 -0400    

Click here for diff

M configure
M configure.in
M doc/bug.template
M src/include/pg_config.h.win32

doc: update list of pg_trgm authors

commit   : cfdadf5f930c4e613e3a13ab09673856aa59351e    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 8 Aug 2016 14:02:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 8 Aug 2016 14:02:16 -0400    

Click here for diff

Author: Oleg Bartunov  

M doc/src/sgml/pgtrgm.sgml

Update 9.6 release notes through today.

commit   : de4b3ea16d8b053e95eb9d862075b0de123e45b9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2016 13:13:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2016 13:13:05 -0400    

Click here for diff

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

Last-minute updates for release notes.

commit   : 9b8271c5a655ef1c35141b266d5039da8d3b2337    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2016 11:56:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2016 11:56:10 -0400    

Click here for diff

Security: CVE-2016-5423, CVE-2016-5424  

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 doc/src/sgml/release-9.4.sgml
M doc/src/sgml/release-9.5.sgml

Fix several one-byte buffer over-reads in to_number

commit   : 9a46324fd46506c86b190d3163902ed90072c53c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 8 Aug 2016 11:12:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 8 Aug 2016 11:12:59 -0400    

Click here for diff

Several places in NUM_numpart_from_char(), which is called from the SQL  
function to_number(text, text), could accidentally read one byte past  
the end of the input buffer (which comes from the input text datum and  
is not null-terminated).  
  
1. One leading space character would be skipped, but there was no check  
   that the input was at least one byte long.  This does not happen in  
   practice, but for defensiveness, add a check anyway.  
  
2. Commit 4a3a1e2cf apparently accidentally doubled that code that skips  
   one space character (so that two spaces might be skipped), but there  
   was no overflow check before skipping the second byte.  Fix by  
   removing that duplicate code.  
  
3. A logic error would allow a one-byte over-read when looking for a  
   trailing sign (S) placeholder.  
  
In each case, the extra byte cannot be read out directly, but looking at  
it might cause a crash.  
  
The third item was discovered by Piotr Stefaniak, the first two were  
found and analyzed by Tom Lane and Peter Eisentraut.  

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

Translation updates

commit   : 34927b2920a865559be743836c1aa60a3621c133    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 8 Aug 2016 11:08:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 8 Aug 2016 11:08:00 -0400    

Click here for diff

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

M src/backend/po/de.po
M src/backend/po/es.po
M src/backend/po/pl.po
M src/bin/initdb/po/de.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_config/po/de.po
M src/bin/pg_controldata/po/de.po
M src/bin/pg_ctl/po/de.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_resetxlog/po/de.po
M src/bin/pg_rewind/po/de.po
M src/bin/psql/po/de.po
M src/bin/psql/po/pl.po
M src/bin/scripts/po/de.po
M src/interfaces/ecpg/ecpglib/po/de.po
M src/interfaces/ecpg/preproc/po/de.po
M src/interfaces/libpq/po/de.po
M src/pl/plperl/po/de.po
M src/pl/plpgsql/src/po/de.po
M src/pl/plpgsql/src/po/pl.po
M src/pl/plpython/po/de.po
M src/pl/plpython/po/pl.po
M src/pl/tcl/po/de.po

Fix two errors with nested CASE/WHEN constructs.

commit   : f0c7b789ab12fbc8248b671c7882dd96ac932ef4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2016 10:33:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2016 10:33:46 -0400    

Click here for diff

ExecEvalCase() tried to save a cycle or two by passing  
&econtext->caseValue_isNull as the isNull argument to its sub-evaluation of  
the CASE value expression.  If that subexpression itself contained a CASE,  
then *isNull was an alias for econtext->caseValue_isNull within the  
recursive call of ExecEvalCase(), leading to confusion about whether the  
inner call's caseValue was null or not.  In the worst case this could lead  
to a core dump due to dereferencing a null pointer.  Fix by not assigning  
to the global variable until control comes back from the subexpression.  
Also, avoid using the passed-in isNull pointer transiently for evaluation  
of WHEN expressions.  (Either one of these changes would have been  
sufficient to fix the known misbehavior, but it's clear now that each of  
these choices was in itself dangerous coding practice and best avoided.  
There do not seem to be any similar hazards elsewhere in execQual.c.)  
  
Also, it was possible for inlining of a SQL function that implements the  
equality operator used for a CASE comparison to result in one CASE  
expression's CaseTestExpr node being inserted inside another CASE  
expression.  This would certainly result in wrong answers since the  
improperly nested CaseTestExpr would be caused to return the inner CASE's  
comparison value not the outer's.  If the CASE values were of different  
data types, a crash might result; moreover such situations could be abused  
to allow disclosure of portions of server memory.  To fix, teach  
inline_function to check for "bare" CaseTestExpr nodes in the arguments of  
a function to be inlined, and avoid inlining if there are any.  
  
Heikki Linnakangas, Michael Paquier, Tom Lane  
  
Report: https://github.com/greenplum-db/gpdb/pull/327  
Report: <[email protected]>  
Security: CVE-2016-5423  

M src/backend/executor/execQual.c
M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/case.out
M src/test/regress/sql/case.sql

Obstruct shell, SQL, and conninfo injection via database and role names.

commit   : fcd15f13581f6d75c63d213220d5a94889206c1b    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 8 Aug 2016 10:07:46 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 8 Aug 2016 10:07:46 -0400    

Click here for diff

Due to simplistic quoting and confusion of database names with conninfo  
strings, roles with the CREATEDB or CREATEROLE option could escalate to  
superuser privileges when a superuser next ran certain maintenance  
commands.  The new coding rule for PQconnectdbParams() calls, documented  
at conninfo_array_parse(), is to pass expand_dbname=true and wrap  
literal database names in a trivial connection string.  Escape  
zero-length values in appendConnStrVal().  Back-patch to 9.1 (all  
supported versions).  
  
Nathan Bossart, Michael Paquier, and Noah Misch.  Reviewed by Peter  
Eisentraut.  Reported by Nathan Bossart.  
  
Security: CVE-2016-5424  

M src/bin/pg_basebackup/streamutil.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_db.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/test.sh
M src/bin/pg_upgrade/version.c
M src/bin/psql/command.c
M src/bin/scripts/clusterdb.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/fe_utils/string_utils.c
M src/include/fe_utils/string_utils.h
M src/interfaces/libpq/fe-connect.c
M src/tools/msvc/vcregress.pl

Promote pg_dumpall shell/connstr quoting functions to src/fe_utils.

commit   : 41f18f021a0882eccbeca62e2ed4b66c6b96e9c9    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 8 Aug 2016 10:07:46 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 8 Aug 2016 10:07:46 -0400    

Click here for diff

Rename these newly-extern functions with terms more typical of their new  
neighbors.  No functional changes; a subsequent commit will use them in  
more places.  Back-patch to 9.1 (all supported versions).  Back branches  
lack src/fe_utils, so instead rename the functions in place; the  
subsequent commit will copy them into the other programs using them.  
  
Security: CVE-2016-5424  

M src/bin/pg_dump/pg_dumpall.c
M src/fe_utils/string_utils.c
M src/include/fe_utils/string_utils.h
M src/port/system.c

Fix Windows shell argument quoting.

commit   : bd65371851b7a9964b4b265d06fe1304315e37c1    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 8 Aug 2016 10:07:46 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 8 Aug 2016 10:07:46 -0400    

Click here for diff

The incorrect quoting may have permitted arbitrary command execution.  
At a minimum, it gave broader control over the command line to actors  
supposed to have control over a single argument.  Back-patch to 9.1 (all  
supported versions).  
  
Security: CVE-2016-5424  

M src/bin/pg_dump/pg_dumpall.c

Reject, in pg_dumpall, names containing CR or LF.

commit   : 142c24c23447f212e642a0ffac9af878b93f490d    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 8 Aug 2016 10:07:46 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 8 Aug 2016 10:07:46 -0400    

Click here for diff

These characters prematurely terminate Windows shell command processing,  
causing the shell to execute a prefix of the intended command.  The  
chief alternative to rejecting these characters was to bypass the  
Windows shell with CreateProcess(), but the ability to use such names  
has little value.  Back-patch to 9.1 (all supported versions).  
  
This change formally revokes support for these characters in database  
names and roles names.  Don't document this; the error message is  
self-explanatory, and too few users would benefit.  A future major  
release may forbid creation of databases and roles so named.  For now,  
check only at known weak points in pg_dumpall.  Future commits will,  
without notice, reject affected names from other frontend programs.  
  
Also extend the restriction to pg_dumpall --dbname=CONNSTR arguments and  
--file arguments.  Unlike the effects on role name arguments and  
database names, this does not reflect a broad policy change.  A  
migration to CreateProcess() could lift these two restrictions.  
  
Reviewed by Peter Eisentraut.  
  
Security: CVE-2016-5424  

M src/bin/pg_dump/pg_dumpall.c

Field conninfo strings throughout src/bin/scripts.

commit   : c400717172d77e5b07e51e04c5e5e13da181572e    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 8 Aug 2016 10:07:46 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 8 Aug 2016 10:07:46 -0400    

Click here for diff

These programs nominally accepted conninfo strings, but they would  
proceed to use the original dbname parameter as though it were an  
unadorned database name.  This caused "reindexdb dbname=foo" to issue an  
SQL command that always failed, and other programs printed a conninfo  
string in error messages that purported to print a database name.  Fix  
both problems by using PQdb() to retrieve actual database names.  
Continue to print the full conninfo string when reporting a connection  
failure.  It is informative there, and if the database name is the sole  
problem, the server-side error message will include the name.  Beyond  
those user-visible fixes, this allows a subsequent commit to synthesize  
and use conninfo strings without that implementation detail leaking into  
messages.  As a side effect, the "vacuuming database" message now  
appears after, not before, the connection attempt.  Back-patch to 9.1  
(all supported versions).  
  
Reviewed by Michael Paquier and Peter Eisentraut.  
  
Security: CVE-2016-5424  

M src/bin/scripts/clusterdb.c
M src/bin/scripts/createlang.c
M src/bin/scripts/droplang.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c

Introduce a psql "\connect -reuse-previous=on|off" option.

commit   : 9d924e9a64b91571e04252424c01210fc0f6f6d9    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 8 Aug 2016 10:07:46 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 8 Aug 2016 10:07:46 -0400    

Click here for diff

The decision to reuse values of parameters from a previous connection  
has been based on whether the new target is a conninfo string.  Add this  
means of overriding that default.  This feature arose as one component  
of a fix for security vulnerabilities in pg_dump, pg_dumpall, and  
pg_upgrade, so back-patch to 9.1 (all supported versions).  In 9.3 and  
later, comment paragraphs that required update had already-incorrect  
claims about behavior when no connection is open; fix those problems.  
  
Security: CVE-2016-5424  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/startup.c

Sort out paired double quotes in \connect, \password and \crosstabview.

commit   : 984e5beb38a7c79a5a9243865d9598c405df17f6    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 8 Aug 2016 10:07:46 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 8 Aug 2016 10:07:46 -0400    

Click here for diff

In arguments, these meta-commands wrongly treated each pair as closing  
the double quoted string.  Make the behavior match the documentation.  
This is a compatibility break, but I more expect to find software with  
untested reliance on the documented behavior than software reliant on  
today's behavior.  Back-patch to 9.1 (all supported versions).  
  
Reviewed by Tom Lane and Peter Eisentraut.  
  
Security: CVE-2016-5424  

M src/bin/psql/psqlscanslash.l
M src/test/regress/expected/psql_crosstab.out
M src/test/regress/sql/psql_crosstab.sql

doc: Update benchmark results

commit   : a1f8b6bd14adb724365d91dcc58079ac3a2293e7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 8 Aug 2016 09:27:20 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 8 Aug 2016 09:27:20 -0400    

Click here for diff

From: Alexander Law <[email protected]>  

M doc/src/sgml/pgcrypto.sgml

Make format() error messages consistent again

commit   : 8a56d4e361d4566ce5d6b55f25c3f23aa44f4741    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 8 Aug 2016 08:15:41 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 8 Aug 2016 08:15:41 -0400    

Click here for diff

07d25a964 changed only one occurrence.  Change the other one as well.  

M src/backend/utils/adt/varlena.c
M src/test/regress/expected/text.out

Update 9.6 release notes through today.

commit   : be7f7ee5ea73626c037600b515087e8f98038140    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2016 22:24:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2016 22:24:44 -0400    

Click here for diff

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

Correct column name in information schema

commit   : d8710f18f4a63947874301311f5558e7d3d93438    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Aug 2016 21:53:16 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Aug 2016 21:53:16 -0400    

Click here for diff

Although the standard has routines.result_cast_character_set_name, given  
the naming of the surrounding columns, we concluded that this must have  
been a mistake and that result_cast_char_set_name was intended, so  
change the implementation.  The documentation was already using the new  
name.  
  
found by Clément Prévost <[email protected]>  

M src/backend/catalog/information_schema.sql

Release notes for 9.5.4, 9.4.9, 9.3.14, 9.2.18, 9.1.23.

commit   : 19322c0a785f656b82a780c3db44920dcc9bd658    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2016 21:31:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2016 21:31:01 -0400    

Click here for diff

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 doc/src/sgml/release-9.4.sgml
M doc/src/sgml/release-9.5.sgml

doc: Move mention of rsync of temp tables to better place

commit   : 4a1f42f287c33e457cb3f081e692853a65dc0efb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Aug 2016 21:27:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Aug 2016 21:27:36 -0400    

Click here for diff

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

Fix misestimation of n_distinct for a nearly-unique column with many nulls.

commit   : 95bee941be4c009ebbc29162a0dc9664f40de12f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2016 18:52:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2016 18:52:02 -0400    

Click here for diff

If ANALYZE found no repeated non-null entries in its sample, it set the  
column's stadistinct value to -1.0, intending to indicate that the entries  
are all distinct.  But what this value actually means is that the number  
of distinct values is 100% of the table's rowcount, and thus it was  
overestimating the number of distinct values by however many nulls there  
are.  This could lead to very poor selectivity estimates, as for example  
in a recent report from Andreas Joseph Krogh.  We should discount the  
stadistinct value by whatever we've estimated the nulls fraction to be.  
(That is what will happen if we choose to use a negative stadistinct for  
a column that does have repeated entries, so this code path was just  
inconsistent.)  
  
In addition to fixing the stadistinct entries stored by several different  
ANALYZE code paths, adjust the logic where get_variable_numdistinct()  
forces an "all distinct" estimate on the basis of finding a relevant unique  
index.  Unique indexes don't reject nulls, so there's no reason to assume  
that the null fraction doesn't apply.  
  
Back-patch to all supported branches.  Back-patching is a bit of a judgment  
call, but this problem seems to affect only a few users (else we'd have  
identified it long ago), and it's bad enough when it does happen that  
destabilizing plan choices in a worse direction seems unlikely.  
  
Patch by me, with documentation wording suggested by Dean Rasheed  
  
Report: <VisenaEmail.26.df42f82acae38a58.156463942b8@tc7-visena>  
Discussion: <[email protected]>  

M doc/src/sgml/catalogs.sgml
M src/backend/commands/analyze.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/selfuncs.c
M src/include/catalog/pg_statistic.h

Fix crash when pg_get_viewdef_name_ext() is passed a non-view relation.

commit   : 8a8c6b53810026641a1e12f60f873a7bd3cea5e3    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2016 17:56:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2016 17:56:34 -0400    

Click here for diff

Oversight in commit 976b24fb4.  
  
Andreas Seltenreich  
  
Report: <[email protected]>  

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

Fix TOAST access failure in RETURNING queries.

commit   : 9ee1cf04ab6bcefe03a11837b53f29ca9dc24c7a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2016 17:46:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2016 17:46:08 -0400    

Click here for diff

Discussion of commit 3e2f3c2e4 exposed a problem that is of longer  
standing: since we don't detoast data while sticking it into a portal's  
holdStore for PORTAL_ONE_RETURNING and PORTAL_UTIL_SELECT queries, and we  
release the query's snapshot as soon as we're done loading the holdStore,  
later readout of the holdStore can do TOAST fetches against data that can  
no longer be seen by any of the session's live snapshots.  This means that  
a concurrent VACUUM could remove the TOAST data before we can fetch it.  
Commit 3e2f3c2e4 exposed the problem by showing that sometimes we had *no*  
live snapshots while fetching TOAST data, but we'd be at risk anyway.  
  
I believe this code was all right when written, because our management of a  
session's exposed xmin was such that the TOAST references were safe until  
end of transaction.  But that's no longer true now that we can advance or  
clear our PGXACT.xmin intra-transaction.  
  
To fix, copy the query's snapshot during FillPortalStore() and save it in  
the Portal; release it only when the portal is dropped.  This essentially  
implements a policy that we must hold a relevant snapshot whenever we  
access potentially-toasted data.  We had already come to that conclusion  
in other places, cf commits 08e261cbc94ce9a7 and ec543db77b6b72f2.  
  
I'd have liked to add a regression test case for this, but I didn't see  
a way to make one that's not unreasonably bloated; it seems to require  
returning a toasted value to the client, and those will be big.  
  
In passing, improve PortalRunUtility() so that it positively verifies  
that its ending PopActiveSnapshot() call will pop the expected snapshot,  
removing a rather shaky assumption about which utility commands might  
do their own PopActiveSnapshot().  There's no known bug here, but now  
that we're actively referencing the snapshot it's almost free to make  
this code a bit more bulletproof.  
  
We might want to consider back-patching something like this into older  
branches, but it would be prudent to let it prove itself more in HEAD  
beforehand.  
  
Discussion: <[email protected]>  

M src/backend/commands/portalcmds.c
M src/backend/tcop/pquery.c
M src/backend/utils/mmgr/portalmem.c
M src/include/utils/portal.h

Avoid crashing in GetOldestSnapshot() if there are no known snapshots.

commit   : 07a601eedab7c5fa4d62055fa3efacef2f38e446    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2016 14:36:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2016 14:36:02 -0400    

Click here for diff

The sole caller expects NULL to be returned in such a case, so make  
it so and document it.  
  
Per reports from Andreas Seltenreich and Regina Obe.  This doesn't  
really fix their problem, as now their RETURNING queries will say  
"ERROR: no known snapshots", but in any case this function should  
not dump core in a reasonably-foreseeable situation.  
  
Report: <[email protected]>  
Report: <[email protected]>  

M src/backend/utils/time/snapmgr.c

Don't propagate a null subtransaction snapshot up to parent transaction.

commit   : bcbecbce2fde3c6dfa9080db11663877808a007d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2016 13:15:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2016 13:15:55 -0400    

Click here for diff

This oversight could cause logical decoding to fail to decode an outer  
transaction containing changes, if a subtransaction had an XID but no  
actual changes.  Per bug #14279 from Marko Tiikkaja.  Patch by Marko  
based on analysis by Andrew Gierth.  
  
Discussion: <[email protected]>  

M contrib/test_decoding/expected/xact.out
M contrib/test_decoding/sql/xact.sql
M src/backend/replication/logical/reorderbuffer.c

First-draft release notes for 9.5.4.

commit   : 3676631c687009c2fadcb35e7d312e9eb8a98182    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Aug 2016 22:08:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Aug 2016 22:08:31 -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-9.5.sgml

In B-tree page deletion, clean up properly after page deletion failure.

commit   : e89526d4f3567c58c2a69fa1b1d9e44df89349fb    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Aug 2016 14:28:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Aug 2016 14:28:37 -0400    

Click here for diff

In _bt_unlink_halfdead_page(), we might fail to find an immediate left  
sibling of the target page, perhaps because of corruption of the page  
sibling links.  The code intends to cope with this by just abandoning  
the deletion attempt; but what actually happens is that it fails outright  
due to releasing the same buffer lock twice.  (And error recovery masks  
a second problem, which is possible leakage of a pin on another page.)  
Seems to have been introduced by careless refactoring in commit efada2b8e.  
Since there are multiple cases to consider, let's make releasing the buffer  
lock in the failure case the responsibility of _bt_unlink_halfdead_page()  
not its caller.  
  
Also, avoid fetching the leaf page's left-link again after we've dropped  
lock on the page.  This is probably harmless, but it's not exactly good  
coding practice.  
  
Per report from Kyotaro Horiguchi.  Back-patch to 9.4 where the faulty code  
was introduced.  
  
Discussion: <[email protected]>  

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

Teach libpq to decode server version correctly from future servers.

commit   : 69dc5ae408f68c302029a6b43912a2cc16b1256c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2016 18:58:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2016 18:58:12 -0400    

Click here for diff

Beginning with the next development cycle, PG servers will report two-part  
not three-part version numbers.  Fix libpq so that it will compute the  
correct numeric representation of such server versions for reporting by  
PQserverVersion().  It's desirable to get this into the field and  
back-patched ASAP, so that older clients are more likely to understand the  
new server version numbering by the time any such servers are in the wild.  
  
(The results with an old client would probably not be catastrophic anyway  
for a released server; for example "10.1" would be interpreted as 100100  
which would be wrong in detail but would not likely cause an old client to  
misbehave badly.  But "10devel" or "10beta1" would result in sversion==0  
which at best would result in disabling all use of modern features.)  
  
Extracted from a patch by Peter Eisentraut; comments added by me  
  
Patch: <[email protected]>  

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

Fix copy-and-pasteo in 81c766b3fd41c78c634d78ebae8d316808dfc630.

commit   : fc509cd82443a4cf338032492f6b1bd6e8698f8d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2016 16:21:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2016 16:21:38 -0400    

Click here for diff

M src/include/utils/tqual.h

Make array_to_tsvector() sort and de-duplicate the given strings.

commit   : f10eab73df2b94c860dea4a906c54e3c903f42e2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2016 16:09:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2016 16:09:06 -0400    

Click here for diff

This is required for the result to be a legal tsvector value.  
Noted while fooling with Andreas Seltenreich's ts_delete() crash.  
  
Discussion: <[email protected]>  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/tsvector_op.c
M src/test/regress/expected/tstypes.out
M src/test/regress/sql/tstypes.sql

Fix ts_delete(tsvector, text[]) to cope with duplicate array entries.

commit   : c50d192ce33c10fa06411306f8644b4f47ce9a06    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2016 15:14:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2016 15:14:08 -0400    

Click here for diff

Such cases either failed an Assert, or produced a corrupt tsvector in  
non-Assert builds, as reported by Andreas Seltenreich.  The reason is  
that tsvector_delete_by_indices() just assumed that its input array had  
no duplicates.  Fix by explicitly de-duping.  
  
In passing, improve some comments, and fix a number of tests for null  
values to use ERRCODE_NULL_VALUE_NOT_ALLOWED not  
ERRCODE_INVALID_PARAMETER_VALUE.  
  
Discussion: <[email protected]>  

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

Re-pgindent tsvector_op.c.

commit   : 33fe7360afdc0bb1820743ea5bfe3fc7d522f6c4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2016 14:58:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2016 14:58:13 -0400    

Click here for diff

Messed up by recent commits --- this is annoying me while trying to fix  
some bugs here.  

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

docs: re-add spaces before units removed

commit   : 5ebad9a580d8f80943fd7095db14621278cc009c    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 5 Aug 2016 14:35:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 5 Aug 2016 14:35:09 -0400    

Click here for diff

This reverts the spaces before k/M/G/TB units removed for consistency in  
commit ca0c37b56f4a80ad758774e34c86cc4335583d29.  
  
Discussion: [email protected]  

M doc/src/sgml/bloom.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/storage.sgml
M doc/src/sgml/wal.sgml

Update time zone data files to tzdata release 2016f.

commit   : a629330b2990c2e76cc8e45a78ede0920c16e0bf    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2016 12:58:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2016 12:58:17 -0400    

Click here for diff

DST law changes in Kemerovo and Novosibirsk.  Historical corrections for  
Azerbaijan, Belarus, and Morocco.  Asia/Novokuznetsk and Asia/Novosibirsk  
now use numeric time zone abbreviations instead of invented ones.  Zones  
for Antarctic bases and other locations that have been uninhabited for  
portions of the time span known to the tzdata database now report "-00"  
rather than "zzz" as the zone abbreviation for those time spans.  
  
Also, I decided to remove some of the timezone/data/ files that we don't  
use.  At one time that subdirectory was a complete copy of what IANA  
distributes in the tzdata tarballs, but that hasn't been true for a long  
time.  There seems no good reason to keep shipping those specific files  
but not others; they're just bloating our tarballs.  

M src/timezone/data/africa
M src/timezone/data/antarctica
M src/timezone/data/asia
M src/timezone/data/australasia
M src/timezone/data/backzone
M src/timezone/data/europe
D src/timezone/data/iso3166.tab
D src/timezone/data/leapseconds
M src/timezone/data/northamerica
M src/timezone/data/southamerica
D src/timezone/data/yearistype.sh
D src/timezone/data/zone.tab
D src/timezone/data/zone1970.tab
M src/timezone/known_abbrevs.txt
M src/timezone/tznames/Asia.txt
M src/timezone/tznames/Default

Change InitToastSnapshot to a macro.

commit   : 81c766b3fd41c78c634d78ebae8d316808dfc630    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 5 Aug 2016 11:57:00 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 5 Aug 2016 11:57:00 -0400    

Click here for diff

tqual.h is included in some front-end compiles, and a static inline  
breaks on buildfarm member castoroides.  Since the macro is never  
referenced, it should dodge that problem, although this doesn't  
seem like the cleanest way of hiding things from front-end compiles.  
  
Report and review by Tom Lane; patch by me.  

M src/backend/access/heap/tuptoaster.c
M src/include/utils/tqual.h

Fix hard to hit race condition in heapam's tuple locking code.

commit   : e7caacf733f3ee77a555aa715ab6fbf4434e6b52    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 4 Aug 2016 20:07:16 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 4 Aug 2016 20:07:16 -0700    

Click here for diff

As mentioned in its commit message, eca0f1db left open a race condition,  
where a page could be marked all-visible, after the code checked  
PageIsAllVisible() to pin the VM, but before the page is locked.  Plug  
that hole.  
  
Reviewed-By: Robert Haas, Andres Freund  
Author: Amit Kapila  
Discussion: CAEep[email protected]  
Backpatch: -  

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

docs: mention rsync of temp and unlogged tables

commit   : 4eb4b3f24561cb115b24984c755b2a75155afedf    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 4 Aug 2016 18:55:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 4 Aug 2016 18:55:16 -0400    

Click here for diff

This happens when using rsync to pg_upgrade slaves.  
  
Reported-by: Jerry Sievers  
  
Discussion: [email protected]  

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

Fix bogus coding in WaitForBackgroundWorkerShutdown().

commit   : 8d498a5c8a4c702ca71463a5c76bb4f319872378    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Aug 2016 16:06:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Aug 2016 16:06:14 -0400    

Click here for diff

Some conditions resulted in "return" directly out of a PG_TRY block,  
which left the exception stack dangling, and to add insult to injury  
failed to restore the state of set_latch_on_sigusr1.  
  
This is a bug only in 9.5; in HEAD it was accidentally fixed by commit  
db0f6cad4, which removed the surrounding PG_TRY block.  However, I (tgl)  
chose to apply the patch to HEAD as well, because the old coding was  
gratuitously different from WaitForBackgroundWorkerStartup(), and there  
would indeed have been no bug if it were done like that to start with.  
  
Dmitry Ivanov  
  
Discussion: <1637882.WfYN5gPf1A@abook>  

M src/backend/postmaster/bgworker.c

doc: Move indexterms to avoid whitespace issue in man pages

commit   : 81568a971f2634bc447af2788eafee899f2db2a1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Aug 2016 17:02:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Aug 2016 17:02:00 -0400    

Click here for diff

M doc/src/sgml/ref/create_view.sgml

Prevent "snapshot too old" from trying to return pruned TOAST tuples.

commit   : 3e2f3c2e423b3ae906668c186bac79522b8e3e29    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 3 Aug 2016 16:41:43 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 3 Aug 2016 16:41:43 -0400    

Click here for diff

Previously, we tested for MVCC snapshots to see whether they were too  
old, but not TOAST snapshots, which can lead to complaints about missing  
TOAST chunks if those chunks are subject to early pruning.  Ideally,  
the threshold lsn and timestamp for a TOAST snapshot would be that of  
the corresponding MVCC snapshot, but since we have no way of deciding  
which MVCC snapshot was used to fetch the TOAST pointer, use the oldest  
active or registered snapshot instead.  
  
Reported by Andres Freund, who also sketched out what the fix should  
look like.  Patch by me, reviewed by Amit Kapila.  

M src/backend/access/heap/tuptoaster.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/snapmgr.h
M src/include/utils/tqual.h

Make INSERT-from-multiple-VALUES-rows handle targetlist indirection better.

commit   : a3c7a993d5eb29df4d33075b83c75ae25f257897    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Aug 2016 16:37:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Aug 2016 16:37:03 -0400    

Click here for diff

Previously, if an INSERT with multiple rows of VALUES had indirection  
(array subscripting or field selection) in its target-columns list, the  
parser handled that by applying transformAssignedExpr() to each element  
of each VALUES row independently.  This led to having ArrayRef assignment  
nodes or FieldStore nodes in each row of the VALUES RTE.  That works for  
simple cases, but in bug #14265 Nuri Boardman points out that it fails  
if there are multiple assignments to elements/fields of the same target  
column.  For such cases to work, rewriteTargetListIU() has to nest the  
ArrayRefs or FieldStores together to produce a single expression to be  
assigned to the column.  But it failed to find them in the top-level  
targetlist and issued an error about "multiple assignments to same column".  
  
We could possibly fix this by teaching the rewriter to apply  
rewriteTargetListIU to each VALUES row separately, but that would be messy  
(it would change the output rowtype of the VALUES RTE, for example) and  
inefficient.  Instead, let's fix the parser so that the VALUES RTE outputs  
are just the user-specified values, cast to the right type if necessary,  
and then the ArrayRefs or FieldStores are applied in the top-level  
targetlist to Vars representing the RTE's outputs.  This is the same  
parsetree representation already used for similar cases with INSERT/SELECT  
syntax, so it allows simplifications in ruleutils.c, which no longer needs  
to treat INSERT-from-multiple-VALUES as its own special case.  
  
This implementation works by applying transformAssignedExpr to the VALUES  
entries as before, and then stripping off any ArrayRefs or FieldStores it  
adds.  With lots of VALUES rows it would be noticeably more efficient to  
not add those nodes in the first place.  But that's just an optimization  
not a bug fix, and there doesn't seem to be any good way to do it without  
significant refactoring.  (A non-invasive answer would be to apply  
transformAssignedExpr + stripping to just the first VALUES row, and then  
just forcibly cast remaining rows to the same data types exposed in the  
first row.  But this way would lead to different, not-INSERT-specific  
errors being reported in casting failure cases, so it doesn't seem very  
nice.)  So leave that for later; this patch at least isn't making the  
per-row parsing work worse, and it does make the finished parsetree  
smaller, saving rewriter and planner work.  
  
Catversion bump because stored rules containing such INSERTs would need  
to change.  Because of that, no back-patch, even though this is a very  
long-standing bug.  
  
Report: <[email protected]>  
Discussion: <[email protected]>  

M src/backend/parser/analyze.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/test/regress/expected/insert.out
M src/test/regress/sql/insert.sql

Do not let PostmasterContext survive into background workers.

commit   : ef1b5af82339a49564037be656a3ff657fb2a246    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Aug 2016 14:48:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Aug 2016 14:48:05 -0400    

Click here for diff

We don't want postmaster child processes to contain a copy of the  
postmaster's PostmasterContext.  That would be a waste of memory at least,  
and at worst a security issue, since there are copies of the semi-sensitive  
pg_hba and pg_ident data in there.  All other child process types delete  
the PostmasterContext after forking, but the original coding of the  
background worker patch (commit da07a1e85) did not do so.  It appears  
that the only reason for that was to avoid copying the bgworker's  
MyBgworkerEntry out of that context; but the couple of additional  
statements needed to do so are hardly good justification for it.  Hence,  
copy that data and then clear the context as other child processes do.  
  
Because this patch changes the memory context in which a bgworker function  
gains control, back-patching it would be a bit risky, so we won't fix this  
in back branches.  The "security" complaint is pretty thin anyway for  
generic bgworkers; only with the introduction of parallel query is there  
any question of running untrusted code in a bgworker process.  
  
Discussion: <[email protected]>  

M src/backend/postmaster/postmaster.c
M src/backend/utils/mmgr/README

Add missing casts in information schema

commit   : 6a9e09c49e1405c47b0870de73fec5748302f92d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Aug 2016 14:41:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Aug 2016 14:41:01 -0400    

Click here for diff

From: Clément Prévost <[email protected]>  

M src/backend/catalog/information_schema.sql

doc: Remove documentation of nonexistent information schema columns

commit   : 2b8fd4fa67693b0b07c412eed34c6b6da6c74d43    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Aug 2016 13:45:55 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Aug 2016 13:45:55 -0400    

Click here for diff

These were probably copied in by accident.  
  
From: Clément Prévost <[email protected]>  

M doc/src/sgml/information_schema.sgml

Fix assorted problems in recovery tests

commit   : b26f7fa6ae2b4e5d64525b3d5bc66a0ddccd9e24    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 Aug 2016 13:21:23 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 Aug 2016 13:21:23 -0400    

Click here for diff

In test 001_stream_rep we're using pg_stat_replication.write_location to  
determine catch-up status, but we care about xlog having been applied  
not just received, so change that to apply_location.  
  
In test 003_recovery_targets, we query the database for a recovery  
target specification and later for the xlog position supposedly  
corresponding to that recovery specification.  If for whatever reason  
more WAL is written between the two queries, the recovery specification  
is earlier than the xlog position used by the query in the test harness,  
so we wait forever, leading to test failures.  Deal with this by using a  
single query to extract both items.  In 2a0f89cd717 we tried to deal  
with it by giving them more tests to run, but in hindsight that was  
obviously doomed to failure (no revert of that, though).  
  
Per hamster buildfarm failures.  
  
Author: Michaël Paquier  

M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/003_recovery_targets.pl

doc: Change recommendation to put NOTIFY into a rule

commit   : 69bdfc4090816d77a3d08684a30bfb05f8b1e104    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Aug 2016 12:29:15 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Aug 2016 12:29:15 -0400    

Click here for diff

Suggest a statement trigger instead.  

M doc/src/sgml/ref/notify.sgml

Add OldSnapshotTimeMapLock to wait_event table in docs.

commit   : c93d8737be47667091b36f5852fd706146514008    
  
author   : Kevin Grittner <[email protected]>    
date     : Wed, 3 Aug 2016 09:58:50 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Wed, 3 Aug 2016 09:58:50 -0500    

Click here for diff

Ashutosh Sharma with minor fixes by me.  

M doc/src/sgml/monitoring.sgml

C comment: fix typo

commit   : 6eb5b05d225006adaf38adc9f30637ee22521881    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 3 Aug 2016 10:32:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 3 Aug 2016 10:32:32 -0400    

Click here for diff

Author: Amit Langote  

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

doc: Remove slightly confusing xreflabels

commit   : 0a4d67b16cd6a0d435169e66a1b4911007cb6aef    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Aug 2016 22:34:45 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Aug 2016 22:34:45 -0400    

Click here for diff

It seems clearer to refer to these tables in the normal way.  

M doc/src/sgml/monitoring.sgml

Small wording tweaks

commit   : 071049919566c22a276ae6441097c436e382a679    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Aug 2016 22:33:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Aug 2016 22:33:56 -0400    

Click here for diff

Dmitry Igrishin  

M doc/src/sgml/catalogs.sgml
M src/interfaces/libpq/fe-protocol3.c

Remove duplicate InitPostmasterChild() call while starting a bgworker.

commit   : c6ea616ff702862fc6923323a49dd24a0e0ae2d9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Aug 2016 18:39:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Aug 2016 18:39:14 -0400    

Click here for diff

This is apparently harmless on Windows, but on Unix it results in an  
assertion failure.  We'd not noticed because this code doesn't get  
used on Unix unless you build with -DEXEC_BACKEND.  Bug was evidently  
introduced by sloppy refactoring in commit 31c453165.  
  
Thomas Munro  
  
Discussion: <CAEepm=1[email protected]>  

M src/backend/postmaster/postmaster.c

doc: OS collation changes can break indexes

commit   : a253a88594f6805168261ea1986df1cd6b9b25e0    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 2 Aug 2016 17:13:10 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 2 Aug 2016 17:13:10 -0400    

Click here for diff

Discussion: [email protected]  
  
Reviewed-by: Christoph Berg  
  
Backpatch-through: 9.1  

M doc/src/sgml/runtime.sgml

Block interrupts during HandleParallelMessages().

commit   : b6a97b91ffe8e0c6b6557eb4aef85bcbd423ad5f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Aug 2016 16:39:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Aug 2016 16:39:16 -0400    

Click here for diff

As noted by Alvaro, there are CHECK_FOR_INTERRUPTS() calls in the shm_mq.c  
functions called by HandleParallelMessages().  I believe they're all  
unreachable since we always pass nowait = true, but it doesn't seem like  
a great idea to assume that no such call will ever be reachable from  
HandleParallelMessages().  If that did happen, there would be a risk of a  
recursive call to HandleParallelMessages(), which it does not appear to be  
designed for --- for example, there's nothing that would prevent  
out-of-order processing of received messages.  And certainly such cases  
cannot easily be tested.  So let's prevent it by holding off interrupts for  
the duration of the function.  Back-patch to 9.5 which contains identical  
code.  
  
Discussion: <[email protected]>  

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

Change minimum max_worker_processes from 1 to 0

commit   : c4d3a039f0ea735c4c21831a74b753678c0e6794    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Aug 2016 13:15:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Aug 2016 13:15:35 -0400    

Click here for diff

Setting it to 0 is probably not useful in practice, but it allows  
testing of situations without available background worker slots.  

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

Fix pg_dump's handling of public schema with both -c and -C options.

commit   : e2e95f5ef3c17197e319e4bbee70486f6a33e7d1    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Aug 2016 12:48:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Aug 2016 12:48:51 -0400    

Click here for diff

Since -c plus -C requests dropping and recreating the target database  
as a whole, not dropping individual objects in it, we should assume that  
the public schema already exists and need not be created.  The previous  
coding considered only the state of the -c option, so it would emit  
"CREATE SCHEMA public" anyway, leading to an unexpected error in restore.  
  
Back-patch to 9.2.  Older versions did not accept -c with -C so the  
issue doesn't arise there.  (The logic being patched here dates to 8.0,  
cf commit 2193121fa, so it's not really wrong that it didn't consider  
the case at the time.)  
  
Note that versions before 9.6 will still attempt to emit REVOKE/GRANT  
on the public schema; but that happens without -c/-C too, and doesn't  
seem to be the focus of this complaint.  I considered extending this  
stanza to also skip the public schema's ACL, but that would be a  
misfeature, as it'd break cases where users intentionally changed that  
ACL.  The real fix for this aspect is Stephen Frost's work to not dump  
built-in ACLs, and that's not going to get back-ported.  
  
Per bugs #13804 and #14271.  Solution found by David Johnston and later  
rediscovered by me.  
  
Report: <[email protected]>  
Report: <[email protected]>  

M src/bin/pg_dump/pg_backup_archiver.c

doc: Whitespace fixes in man pages

commit   : e9888c2a48d490ae75d8692db1b1f12c3740c21b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Aug 2016 12:35:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Aug 2016 12:35:35 -0400    

Click here for diff

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

Consistently capitalize names of recovery tests

commit   : f6ced51f9188ad5806219471a0b40a91dde923aa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Aug 2016 10:47:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Aug 2016 10:47:03 -0400    

Click here for diff

M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/007_sync_rep.pl

Minor cleanup for access/transam/parallel.c.

commit   : a5fe473ad79d8d2c85a625621c165e8c601274e4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Aug 2016 16:12:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Aug 2016 16:12:01 -0400    

Click here for diff

ParallelMessagePending *must* be marked volatile, because it's set  
by a signal handler.  On the other hand, it's pointless for  
HandleParallelMessageInterrupt to save/restore errno; that must be,  
and is, done at the outer level of the SIGUSR1 signal handler.  
  
Calling CHECK_FOR_INTERRUPTS() inside HandleParallelMessages, which itself  
is called from CHECK_FOR_INTERRUPTS(), seems both useless and hazardous.  
The comment claiming that this is needed to handle the error queue going  
away is certainly misguided, in any case.  
  
Improve a couple of error message texts, and use  
ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE to report loss of parallel worker  
connection, since that's what's used in e.g. tqueue.c.  (Maybe it would be  
worth inventing a dedicated ERRCODE for this type of failure?  But I do not  
think ERRCODE_INTERNAL_ERROR is appropriate.)  
  
Minor stylistic cleanups.  

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

Don't CHECK_FOR_INTERRUPTS between WaitLatch and ResetLatch.

commit   : 887feefe87b9099eeeec2967ec31ce20df4dfa9b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Aug 2016 15:13:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Aug 2016 15:13:53 -0400    

Click here for diff

This coding pattern creates a race condition, because if an interesting  
interrupt happens after we've checked InterruptPending but before we reset  
our latch, the latch-setting done by the signal handler would get lost,  
and then we might block at WaitLatch in the next iteration without ever  
noticing the interrupt condition.  You can put the CHECK_FOR_INTERRUPTS  
before WaitLatch or after ResetLatch, but not between them.  
  
Aside from fixing the bugs, add some explanatory comments to latch.h  
to perhaps forestall the next person from making the same mistake.  
  
In HEAD, also replace gather_readnext's direct call of  
HandleParallelMessages with CHECK_FOR_INTERRUPTS.  It does not seem clean  
or useful for this one caller to bypass ProcessInterrupts and go straight  
to HandleParallelMessages; not least because that fails to consider the  
InterruptPending flag, resulting in useless work both here  
(if InterruptPending isn't set) and in the next CHECK_FOR_INTERRUPTS call  
(if it is).  
  
This thinko seems to have been introduced in the initial coding of  
storage/ipc/shm_mq.c (commit ec9037df2), and then blindly copied into all  
the subsequent parallel-query support logic.  Back-patch relevant hunks  
to 9.4 to extirpate the error everywhere.  
  
Discussion: <[email protected]>  

M src/backend/executor/nodeGather.c
M src/backend/libpq/pqmq.c
M src/backend/storage/ipc/shm_mq.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

Remove unused arguments from pg_replication_origin_xact_reset function.

commit   : dd5eb805d5e5384963f09c9986845a544ef41810    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 2 Aug 2016 02:43:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 2 Aug 2016 02:43:17 +0900    

Click here for diff

The document specifies that pg_replication_origin_xact_reset function  
doesn't have any argument variables. But previously it was actually  
defined so as to have two argument variables, though they were not  
used at all. That is, the pg_proc entry for that function was incorrect.  
This patch fixes the pg_proc entry and removes those two arguments  
from the function definition.  
  
No back-patch because this change needs a catalog version bump  
although the issue exists in 9.5 as well. Instead, a note about those  
unused argument variables will be added to 9.5 document later.  
  
Catalog version bumped due to the change of pg_proc.  

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

pg_rewind docs: clarify handling of remote servers

commit   : 878bd9accb553f6eee32af8acdb7ee3e54a74e23    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 1 Aug 2016 12:52:22 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 1 Aug 2016 12:52:22 -0400    

Click here for diff

M doc/src/sgml/ref/pg_rewind.sgml

Fixed array checking code for "unsigned long long" datatypes in libecpg.

commit   : 3ebc88e568053fa16766e05155eb005cc72978db    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 1 Aug 2016 06:36:27 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 1 Aug 2016 06:36:27 +0200    

Click here for diff

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

Fix pg_basebackup so that it accepts 0 as a valid compression level.

commit   : 74d8c95b7456faefdd4244acf854361711fb42ce    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 1 Aug 2016 17:36:14 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 1 Aug 2016 17:36:14 +0900    

Click here for diff

The help message for pg_basebackup specifies that the numbers 0 through 9  
are accepted as valid values of -Z option. But, previously -Z 0 was rejected  
as an invalid compression level.  
  
Per discussion, it's better to make pg_basebackup treat 0 as valid  
compression level meaning no compression, like pg_dump.  
  
Back-patch to all supported versions.  
  
Reported-By: Jeff Janes  
Reviewed-By: Amit Kapila  
Discussion: CAMk[email protected]  

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

Doc: remove claim that hash index creation depends on effective_cache_size.

commit   : 11653cd87f66fc55ab79683a3ba7e6fe1a299596    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2016 18:32:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2016 18:32:34 -0400    

Click here for diff

This text was added by commit ff213239c, and not long thereafter obsoleted  
by commit 4adc2f72a (which made the test depend on NBuffers instead); but  
nobody noticed the need for an update.  Commit 9563d5b5e adds some further  
dependency on maintenance_work_mem, but the existing verbiage seems to  
cover that with about as much precision as we really want here.  Let's  
just take it all out rather than leaving ourselves open to more errors of  
omission in future.  (That solution makes this change back-patchable, too.)  
  
Noted by Peter Geoghegan.  
  
Discussion: <CAM3SWZR[email protected]>  

M doc/src/sgml/ref/create_index.sgml

Code review for tqueue.c: fix memory leaks, speed it up, other fixes.

commit   : a9ed875fdc2c44b5793a07727274786b417fc924    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2016 16:05:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2016 16:05:12 -0400    

Click here for diff

When doing record typmod remapping, tqueue.c did fresh catalog lookups  
for each tuple it processed, which was pretty horrible performance-wise  
(it seemed to about halve the already none-too-quick speed of bulk reads  
in parallel mode).  Worse, it insisted on putting bits of that data into  
TopMemoryContext, from where it never freed them, causing a  
session-lifespan memory leak.  (I suppose this was coded with the idea  
that the sender process would quit after finishing the query ---  
but the receiver uses the same code.)  
  
Restructure to avoid repetitive catalog lookups and to keep that data  
in a query-lifespan context, in or below the context where the  
TQueueDestReceiver or TupleQueueReader itself lives.  
  
Fix some other bugs such as continuing to use a tupledesc after  
releasing our refcount on it.  Clean up cavalier datatype choices  
(typmods are int32, please, not int, and certainly not Oid).  Improve  
comments and error message wording.  

M src/backend/executor/tqueue.c

Correctly handle owned sequences with extensions

commit   : f9e439b1ca81e3305b677d93c67299549625370c    
  
author   : Stephen Frost <[email protected]>    
date     : Sun, 31 Jul 2016 10:57:15 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sun, 31 Jul 2016 10:57:15 -0400    

Click here for diff

With the refactoring of pg_dump to handle components, getOwnedSeqs needs  
to be a bit more intelligent regarding which components to dump when.  
Specifically, we can't simply use the owning table's components as the  
set of components to dump as the table might only be including certain  
components while all components of the sequence should be dumped, for  
example, when the table is a member of an extension while the sequence  
is not.  
  
Handle this by combining the set of components to be dumped for the  
sequence explicitly and those to be dumped for the table when setting  
the components to be dumped for the sequence.  
  
Also add a number of regression tests around this to, hopefully, catch  
any future changes which break the expected behavior.  
  
Discovered by: Philippe BEAUDOIN  
Reviewed by: Michael Paquier  

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

doc: improve wording of Error Message Style Guide

commit   : 6335c80ef417b58f657fe9bc21f99edd79511f30    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 30 Jul 2016 21:34:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 30 Jul 2016 21:34:28 -0400    

Click here for diff

Reported-by: Daniel Gustafsson  
  
Discussion: [email protected]  
  
Author: Daniel Gustafsson  

M doc/src/sgml/sources.sgml

pgbench docs: fix incorrect "last two" fields text

commit   : 9e765bb10fcb1438806bc139e243871234990423    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 30 Jul 2016 16:59:34 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 30 Jul 2016 16:59:34 -0400    

Click here for diff

Reported-by: Alexander Law  
  
Discussion: [email protected]  
  
Backpatch-through: 9.4  

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

docs: properly capitalize and space kB, MB, GB, TB

commit   : ca0c37b56f4a80ad758774e34c86cc4335583d29    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 30 Jul 2016 12:27:27 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 30 Jul 2016 12:27:27 -0400    

Click here for diff

M doc/src/sgml/bloom.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/ltree.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/storage.sgml
M doc/src/sgml/wal.sgml

Fix worst memory leaks in tqueue.c.

commit   : af33039317ddc4a0e38a02e2255c2bf453115fd2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Jul 2016 19:31:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Jul 2016 19:31:06 -0400    

Click here for diff

TupleQueueReaderNext() leaks like a sieve if it has to do any tuple  
disassembly/reconstruction.  While we could try to clean up its allocations  
piecemeal, it seems like a better idea just to insist that it should be run  
in a short-lived memory context, so that any transient space goes away  
automatically.  I chose to have nodeGather.c switch into its existing  
per-tuple context before the call, rather than inventing a separate  
context inside tqueue.c.  
  
This is sufficient to stop all leakage in the simple case I exhibited  
earlier today (see link below), but it does not deal with leaks induced  
in more complex cases by tqueue.c's insistence on using TopMemoryContext  
for data that it's not actually trying hard to keep track of.  That issue  
is intertwined with another major source of inefficiency, namely failure  
to cache lookup results across calls, so it seems best to deal with it  
separately.  
  
In passing, improve some comments, and modify gather_readnext's method for  
deciding when it's visited all the readers so that it's more obviously  
correct.  (I'm not actually convinced that the previous code *is*  
correct in the case of a reader deletion; it certainly seems fragile.)  
  
Discussion: <[email protected]>  

M src/backend/executor/nodeGather.c
M src/backend/executor/tqueue.c
M src/include/executor/tqueue.h

Fix tqueue.c's range-remapping code.

commit   : bf4ae685ae6f37b7fe83336abacf44298431b2f0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Jul 2016 14:13:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Jul 2016 14:13:19 -0400    

Click here for diff

It's depressingly clear that nobody ever tested this.  

M src/backend/executor/tqueue.c
M src/test/regress/expected/rangetypes.out
M src/test/regress/sql/rangetypes.sql

Fix pq_putmessage_noblock() to not block.

commit   : 80b346c2084928c11b6f9e495a7e9d559d96703d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Jul 2016 12:52:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Jul 2016 12:52:57 -0400    

Click here for diff

An evident copy-and-pasteo in commit 2bd9e412f broke the non-blocking  
aspect of pq_putmessage_noblock(), causing it to behave identically to  
pq_putmessage().  That function is nowadays used only in walsender.c,  
so that the net effect was to cause walsenders to hang up waiting for  
the receiver in situations where they should not.  
  
Kyotaro Horiguchi  
  
Patch: <[email protected]>  

M src/include/libpq/libpq.h

Eliminate a few more user-visible "cache lookup failed" errors.

commit   : 3153b1a52f8f2d1efe67306257aec15aaaf9e94c    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Jul 2016 12:06:18 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Jul 2016 12:06:18 -0400    

Click here for diff

Michael Paquier  

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

Documentation spell checking and markup improvements

commit   : 5676da2d01bb6ba437cf05d748f04b3d31676922    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Jul 2016 22:46:15 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Jul 2016 22:46:15 -0400    

Click here for diff

M doc/src/sgml/bloom.sgml
M doc/src/sgml/brin.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/indices.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/release-9.6.sgml
M doc/src/sgml/sources.sgml
M doc/src/sgml/textsearch.sgml

Guard against empty buffer in gets_fromFile()'s check for a newline.

commit   : ed0b228d7a6b5186adc099f6a31dc33c499ff077    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Jul 2016 18:57:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Jul 2016 18:57:24 -0400    

Click here for diff

Per the fgets() specification, it cannot return without reading some data  
unless it reports EOF or error.  So the code here assumed that the data  
buffer would necessarily be nonempty when we go to check for a newline  
having been read.  However, Agostino Sarubbo noticed that this could fail  
to be true if the first byte of the data is a NUL (\0).  The fgets() API  
doesn't really work for embedded NULs, which is something I don't feel  
any great need for us to worry about since we generally don't allow NULs  
in SQL strings anyway.  But we should not access off the end of our own  
buffer if the case occurs.  Normally this would just be a harmless read,  
but if you were unlucky the byte before the buffer would contain '\n'  
and we'd overwrite it with '\0', and if you were really unlucky that  
might be valuable data and psql would crash.  
  
Agostino reported this to pgsql-security, but after discussion we concluded  
that it isn't worth treating as a security bug; if you can control the  
input to psql you can do far more interesting things than just maybe-crash  
it.  Nonetheless, it is a bug, so back-patch to all supported versions.  

M src/bin/psql/input.c

Teach parser to transform "x IS [NOT] DISTINCT FROM NULL" to a NullTest.

commit   : 8d19d0e139238cdcb3f1f7e1adc4ff959562822f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Jul 2016 17:23:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Jul 2016 17:23:03 -0400    

Click here for diff

Now that we've nailed down the principle that NullTest with !argisrow  
is fully equivalent to SQL's IS [NOT] DISTINCT FROM NULL, let's teach  
the parser about it.  This produces a slightly more compact parse tree  
and is much more amenable to optimization than a DistinctExpr, since  
the planner knows a good deal about NullTest and next to nothing about  
DistinctExpr.  
  
I'm not sure that there are all that many queries in the wild that could  
be improved by this, but at least one source of such cases is the patch  
just made to postgres_fdw to emit IS [NOT] DISTINCT FROM NULL when  
IS [NOT] NULL isn't semantically correct.  
  
No back-patch, since to the extent that this does affect planning results,  
it might be considered undesirable plan destabilization.  

M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/include/nodes/parsenodes.h

Message style improvements

commit   : ef5d4a3cfacb009526aac3e01a26f4b54d70bfd7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Jul 2016 16:18:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Jul 2016 16:18:35 -0400    

Click here for diff

M src/backend/access/brin/brin_validate.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/access/transam/twophase.c
M src/backend/executor/tqueue.c
M src/backend/tsearch/spell.c

Fix assorted fallout from IS [NOT] NULL patch.

commit   : 9492cf86e40288395a2ec6d81f7f5417e0e1b4fa    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Jul 2016 16:09:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Jul 2016 16:09:15 -0400    

Click here for diff

Commits 4452000f3 et al established semantics for NullTest.argisrow that  
are a bit different from its initial conception: rather than being merely  
a cache of whether we've determined the input to have composite type,  
the flag now has the further meaning that we should apply field-by-field  
testing as per the standard's definition of IS [NOT] NULL.  If argisrow  
is false and yet the input has composite type, the construct instead has  
the semantics of IS [NOT] DISTINCT FROM NULL.  Update the comments in  
primnodes.h to clarify this, and fix ruleutils.c and deparse.c to print  
such cases correctly.  In the case of ruleutils.c, this merely results in  
cosmetic changes in EXPLAIN output, since the case can't currently arise  
in stored rules.  However, it represents a live bug for deparse.c, which  
would formerly have sent a remote query that had semantics different  
from the local behavior.  (From the user's standpoint, this means that  
testing a remote nested-composite column for null-ness could have had  
unexpected recursive behavior much like that fixed in 4452000f3.)  
  
In a related but somewhat independent fix, make plancat.c set argisrow  
to false in all NullTest expressions constructed to represent "attnotnull"  
constructs.  Since attnotnull is actually enforced as a simple null-value  
check, this is a more accurate representation of the semantics; we were  
previously overpromising what it meant for composite columns, which might  
possibly lead to incorrect planner optimizations.  (It seems that what the  
SQL spec expects a NOT NULL constraint to mean is an IS NOT NULL test, so  
arguably we are violating the spec and should fix attnotnull to do the  
other thing.  If we ever do, this part should get reverted.)  
  
Back-patch, same as the previous commit.  
  
Discussion: <[email protected]>  

M contrib/postgres_fdw/deparse.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/primnodes.h
M src/test/regress/expected/rowtypes.out

Improve documentation about CREATE TABLE ... LIKE.

commit   : 46b773d4fe0f0c880a1073cb5366efa02efa8ef8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Jul 2016 13:26:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Jul 2016 13:26:58 -0400    

Click here for diff

The docs failed to explain that LIKE INCLUDING INDEXES would not preserve  
the names of indexes and associated constraints.  Also, it wasn't mentioned  
that EXCLUDE constraints would be copied by this option.  The latter  
oversight seems enough of a documentation bug to justify back-patching.  
  
In passing, do some minor copy-editing in the same area, and add an entry  
for LIKE under "Compatibility", since it's not exactly a faithful  
implementation of the standard's feature.  
  
Discussion: <[email protected]>  

M doc/src/sgml/ref/create_table.sgml
M src/backend/parser/parse_utilcmd.c

Register atexit hook only once in pg_upgrade.

commit   : d9e74959a7fabe57e38bdda430aa662445bd1dd6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Jul 2016 11:39:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Jul 2016 11:39:10 -0400    

Click here for diff

start_postmaster() registered stop_postmaster_atexit as an atexit(3)  
callback each time through, although the obvious intention was to do  
so only once per program run.  The extra registrations were harmless,  
so long as we didn't exceed ATEXIT_MAX, but still it's a bug.  
  
Artur Zakirov, with bikeshedding by Kyotaro Horiguchi and me  
  
Discussion: <[email protected]>  

M src/bin/pg_upgrade/server.c

Fix incorrect description of udt_privileges view in documentation.

commit   : de8c92e6caf0cd8683b23a222d4bd88a90496840    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 28 Jul 2016 22:34:42 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 28 Jul 2016 22:34:42 +0900    

Click here for diff

The description of udt_privileges view contained an incorrect copy-pasted word.  
  
Back-patch to 9.2 where udt_privileges view was added.  
  
Author: Alexander Law  

M doc/src/sgml/information_schema.sgml

tqueue.c's record-typmod hashtables need the HASH_BLOBS option.

commit   : e1a93dd6ae114669669e3a77167dc3d3bd91e035    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Jul 2016 02:08:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Jul 2016 02:08:52 -0400    

Click here for diff

The keys are integers, not strings.  The code accidentally worked on  
little-endian machines, at least up to 256 distinct record types within  
a session, but failed utterly on big-endian.  This was unexpectedly  
exposed by a test case added by commit 4452000f3, which apparently is the  
only parallelizable query in the regression suite that uses more than one  
anonymous record type.  Fortunately, buildfarm member mandrill is  
big-endian and is running with force_parallel_mode on, so it failed.  

M src/backend/executor/tqueue.c

Fix cost_rescan() to account for multi-batch hashing correctly.

commit   : 69995c3b3fd64361bb4d3938315f3e88ccc01e53    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 Jul 2016 17:44:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 Jul 2016 17:44:34 -0400    

Click here for diff

cost_rescan assumed that we don't need to rebuild the hash table when  
rescanning a hash join.  However, that's currently only true for  
single-batch joins; for a multi-batch join we must charge full freight.  
  
This probably has escaped notice because we'd be unlikely to put a hash  
join on the inside of a nestloop anyway.  Nonetheless, it's wrong.  
Fix in HEAD, but don't backpatch for fear of destabilizing plans in  
stable releases.  

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

Fix thinko in copyParamList.

commit   : b31875b1fe7131ac29f118efd81c9aba7255eced    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Jul 2016 10:16:26 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Jul 2016 10:16:26 -0400    

Click here for diff

There's no point in consulting retval->paramMask; it's always NULL.  
Instead, we should consult from->paramMask.  
  
Reported by Andrew Gierth.  

M src/backend/nodes/params.c

Allow functions that return sets of tuples to return simple NULLs.

commit   : d8411a6c8b6e5f74b362ef2496723f7f88593737    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Jul 2016 21:33:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Jul 2016 21:33:49 -0400    

Click here for diff

ExecMakeTableFunctionResult(), which is used in SELECT FROM function(...)  
cases, formerly treated a simple NULL output from a function that both  
returnsSet and returnsTuple as a violation of the SRF protocol.  What seems  
better is to treat a NULL output as equivalent to ROW(NULL,NULL,...).  
Without this, cases such as SELECT FROM unnest(...) on an array of  
composite are vulnerable to unexpected and not-very-helpful failures.  
Old code comments here suggested an alternative of just ignoring  
simple-NULL outputs, but that doesn't seem very principled.  
  
This change had been hung up for a long time due to uncertainty about  
how much we wanted to buy into the equivalence of simple NULL and  
ROW(NULL,NULL,...).  I think that's been mostly resolved by the discussion  
around bug #14235, so let's go ahead and do it.  
  
Per bug #7808 from Joe Van Dyk.  Although this is a pretty old report,  
fixing it smells a bit more like a new feature than a bug fix, and the  
lack of other similar complaints suggests that we shouldn't take much risk  
of destabilization by back-patching.  (Maybe that could be revisited once  
this patch has withstood some field usage.)  
  
Andrew Gierth and Tom Lane  
  
Report: <[email protected]>  

M src/backend/executor/execQual.c
M src/test/regress/expected/rangefuncs.out
M src/test/regress/sql/rangefuncs.sql

Change various deparsing functions to return NULL for invalid input.

commit   : 976b24fb477464907737d28cdf18e202fa3b1a5b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 26 Jul 2016 16:07:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 26 Jul 2016 16:07:02 -0400    

Click here for diff

Previously, some functions returned various fixed strings and others  
failed with a cache lookup error.  Per discussion, standardize on  
returning NULL.  Although user-exposed "cache lookup failed" error  
messages might normally qualify for bug-fix treatment, no back-patch;  
the risk of breaking user code which is accustomed to the current  
behavior seems too high.  
  
Michael Paquier  

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

Repair damage done by citext--1.1--1.2.sql.

commit   : fe5e3fce798dccf3f298b65c5d9a132e9646712a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 26 Jul 2016 15:32:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 26 Jul 2016 15:32:57 -0400    

Click here for diff

That script is incorrect in that it sets the combine function for  
max(citext) twice instead of setting the combine function for  
max(citext) once and the combine functon for min(citext) once.  The  
consequence is that if you install 1.0 or 1.1 and then update to 1.2,  
you end up with min(citext) not having a combine function, contrary to  
what was intended.  If you install 1.2 directly, you're OK.  
  
Fix things up by defining a new 1.3 version.  Upgrading from 1.2 to  
1.3 won't change anything for people who first installed the 1.2  
version, but people upgrading from 1.0 or 1.1 will get the right  
catalog contents once they reach 1.3.  
  
Report and patch by David Rowley, reviewed by Andreas Karlsson.  

M contrib/citext/Makefile
A contrib/citext/citext–1.2–1.3.sql
R100 contrib/citext/citext–1.2.sql contrib/citext/citext–1.3.sql
M contrib/citext/citext.control

Fix constant-folding of ROW(...) IS [NOT] NULL with composite fields.

commit   : 4452000f310b8c1c947ee724618c1bc31ed20242    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Jul 2016 15:25:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Jul 2016 15:25:02 -0400    

Click here for diff

The SQL standard appears to specify that IS [NOT] NULL's tests of field  
nullness are non-recursive, ie, we shouldn't consider that a composite  
field with value ROW(NULL,NULL) is null for this purpose.  
ExecEvalNullTest got this right, but eval_const_expressions did not,  
leading to weird inconsistencies depending on whether the expression  
was such that the planner could apply constant folding.  
  
Also, adjust the docs to mention that IS [NOT] DISTINCT FROM NULL can be  
used as a substitute test if a simple null check is wanted for a rowtype  
argument.  That motivated reordering things so that IS [NOT] DISTINCT FROM  
is described before IS [NOT] NULL.  In HEAD, I went a bit further and added  
a table showing all the comparison-related predicates.  
  
Per bug #14235.  Back-patch to all supported branches, since it's certainly  
undesirable that constant-folding should change the semantics.  
  
Report and patch by Andrew Gierth; assorted wordsmithing and revised  
regression test cases by me.  
  
Report: <[email protected]>  

M doc/src/sgml/func.sgml
M src/backend/executor/execQual.c
M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/rowtypes.out
M src/test/regress/sql/rowtypes.sql

Fix improper example of using psql() function in TAP tests documentation.

commit   : c1a95425780ef8e72c2f65504a7e90bcb223ca4a    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 26 Jul 2016 21:17:38 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 26 Jul 2016 21:17:38 +0900    

Click here for diff

In an example of TAP test scripts, there is the test checking whether  
the result of the query is expected or not. But, in previous example,  
the exit code of psql instead of the query result was checked unexpectedly.  
  
Author: Ildar Musin  

M src/test/perl/README

Fix typo

commit   : 43c2c404978a89e9e5ea51aca5759a35f3f302f9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 25 Jul 2016 22:07:53 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 25 Jul 2016 22:07:53 -0400    

Click here for diff

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

Message style improvements

commit   : 40fcfec82cf695d520f2dd91ee437fa75dea4ca7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 25 Jul 2016 22:07:44 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 25 Jul 2016 22:07:44 -0400    

Click here for diff

M contrib/earthdistance/expected/earthdistance.out
M src/backend/commands/extension.c
M src/backend/executor/nodeAgg.c
M src/backend/utils/adt/acl.c
M src/test/modules/test_extensions/expected/test_extensions.out

Fix typo in comment.

commit   : 1804d1555f56fcad4ce62e160bab17bdff6c94aa    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 25 Jul 2016 17:51:26 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 25 Jul 2016 17:51:26 +0900    

Click here for diff

Author: Masahiko Sawada  

M contrib/postgres_fdw/deparse.c

Give recovery tests more time to finish

commit   : 2a0f89cd717ce6d49cdc47850577823682167e87    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Jul 2016 01:34:35 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Jul 2016 01:34:35 -0400    

Click here for diff

These tests are currently only running in buildfarm member hamster,  
which is purposefully very slow.  This suite has failed a couple of  
times recently because of timeouts, so increase the allowed number of  
iterations to avoid spurious failures.  
  
Author: Michaël Paquier  

M src/test/perl/PostgresNode.pm

Make the AIX case of Makefile.shlib safe for parallel make.

commit   : e8564ef034333c6ba6fd3d0c6ecf18214a4e988b    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 23 Jul 2016 20:30:03 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 23 Jul 2016 20:30:03 -0400    

Click here for diff

Use our typical approach, from src/backend/parser.  Back-patch to 9.1  
(all supported versions).  

M src/Makefile.shlib

Correctly set up aggregate FILTER expression in partial-aggregation plans.

commit   : 6d85bb1ba79c2792214df9fa17bcc8fac229c11c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Jul 2016 20:16:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Jul 2016 20:16:48 -0400    

Click here for diff

The aggfilter expression should be removed from the parent (combining)  
Aggref, since it's not supposed to apply the filter, and indeed cannot  
because any Vars used in the filter would not be available after the  
lower-level aggregation step.  Per report from Jeff Janes.  
  
(This has been broken since the introduction of partial aggregation,  
I think.  The error became obvious after commit 59a3795c2, when setrefs.c  
began processing the parent Aggref's fields normally and thus would detect  
such Vars.  The special-case coding previously used in setrefs.c skipped  
over the parent's aggfilter field without processing it.  That was broken  
in its own way because no other setrefs.c processing got applied either;  
though since the executor would not execute the filter expression, only  
initialize it, that oversight might not have had any visible symptoms at  
present.)  
  
Report: <CAMkU=1x[email protected]>  

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

Fix regression tests to work in Welsh locale.

commit   : 9d7abca901f855d96d823b6edb893b2b4ccf8c2f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Jul 2016 15:41:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Jul 2016 15:41:39 -0400    

Click here for diff

Welsh (cy_GB) apparently sorts 'dd' after 'f', creating problems  
analogous to the odd sorting of 'aa' in Danish.  Adjust regression  
test case to not use data that provokes that.  
  
Jeff Janes  
  
Patch: <CAMkU=1z[email protected]>  

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

Remove GetUserMappingId() and GetUserMappingById().

commit   : 13bf801a255aaa18c43f0d17e24ffdb03a77ca31    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Jul 2016 11:32:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Jul 2016 11:32:23 -0400    

Click here for diff

These functions were added in commits fbe5a3fb7 and a104a017f,  
but commit 45639a052 removed their only callers.  Put the related  
code in foreign.c back to the way it was in 9.5, to avoid pointless  
cross-version diffs.  
  
Etsuro Fujita  
  
Patch: <[email protected]>  

M doc/src/sgml/fdwhandler.sgml
M src/backend/foreign/foreign.c
M src/include/foreign/foreign.h

Make contrib regression tests safe for Danish locale.

commit   : d70d119151d8e3442500be5e372439ef8805ec2b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Jul 2016 16:52:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Jul 2016 16:52:35 -0400    

Click here for diff

In btree_gin and citext, avoid some not-particularly-interesting  
dependencies on the sorting of 'aa'.  In tsearch2, use COLLATE "C" to  
remove an uninteresting dependency on locale sort order (and thereby  
allow removal of a variant expected-file).  
  
Also, in citext, avoid assuming that lower('I') = 'i'.  This isn't relevant  
to Danish but it does fail in Turkish.  

M contrib/btree_gin/expected/bytea.out
M contrib/btree_gin/expected/text.out
M contrib/btree_gin/expected/varchar.out
M contrib/btree_gin/sql/bytea.sql
M contrib/btree_gin/sql/text.sql
M contrib/btree_gin/sql/varchar.sql
M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/citext/sql/citext.sql
M contrib/tsearch2/expected/tsearch2.out
D contrib/tsearch2/expected/tsearch2_1.out
M contrib/tsearch2/sql/tsearch2.sql

Make pltcl regression tests safe for Danish locale.

commit   : 95810ed8ee4223cfbad257f2d5f5f7d7da60c971    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Jul 2016 14:24:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Jul 2016 14:24:07 -0400    

Click here for diff

Another peculiarity of Danish locale is that it has an unusual idea  
of how to sort upper vs. lower case.  One of the pltcl test cases has  
an issue with that.  Now that COLLATE works in all supported branches,  
we can just change the test to be locale-independent, and get rid of  
the variant expected file that used to support non-C locales.  

M src/pl/tcl/expected/pltcl_queries.out
D src/pl/tcl/expected/pltcl_queries_1.out
M src/pl/tcl/sql/pltcl_queries.sql

Make core regression tests safe for Danish locale.

commit   : b3399cb0f68855886aa1a13a246fa5fc46e304e8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Jul 2016 13:11:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Jul 2016 13:11:00 -0400    

Click here for diff

Some tests added in 9.5 depended on 'aa' sorting before 'bb', which  
doesn't hold true in Danish.  Use slightly different test data to  
avoid the problem.  
  
Jeff Janes  
  
Report: <CAMkU=1w[email protected]>  

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

Remove unused structure member.

commit   : 1091402b5aa4873cf8321e204f929731765c82bc    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 21 Jul 2016 11:53:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 21 Jul 2016 11:53:44 -0400    

Click here for diff

Michael Paquier  

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

Fix typos

commit   : 094ea692ee46c2af8c4d249b8fae6e4289102828    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 20 Jul 2016 10:39:18 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 20 Jul 2016 10:39:18 +0200    

Click here for diff

Alexander Law  

M doc/src/sgml/ref/pg_receivexlog.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml

Remove very-obsolete estimates of shmem usage from postgresql.conf.sample.

commit   : 79a84743096d661c6d085f40065c4b13b63acf6c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Jul 2016 18:41:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Jul 2016 18:41:30 -0400    

Click here for diff

runtime.sgml used to contain a table of estimated shared memory consumption  
rates for max_connections and some other GUCs.  Commit 390bfc643 removed  
that on the well-founded grounds that (a) we weren't maintaining the  
entries well and (b) it no longer mattered so much once we got out from  
under SysV shmem limits.  But it missed that there were even-more-obsolete  
versions of some of those numbers in comments in postgresql.conf.sample.  
Remove those too.  Back-patch to 9.3 where the aforesaid commit went in.  

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

Add comment & docs about no vacuum truncation with sto.

commit   : 1c15aac53f3421fd38ae145118d3204f055ba955    
  
author   : Kevin Grittner <[email protected]>    
date     : Tue, 19 Jul 2016 16:25:53 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Tue, 19 Jul 2016 16:25:53 -0500    

Click here for diff

Omission noted by Andres Freund.  

M doc/src/sgml/config.sgml
M src/backend/commands/vacuumlazy.c

Stamp 9.6beta3.

commit   : b11e9bbc41d1906360f1fbaab133118e703de75a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Jul 2016 16:54:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Jul 2016 16:54:26 -0400    

Click here for diff

M configure
M configure.in
M doc/bug.template
M src/include/pg_config.h.win32

Doc: improve discussion of plpgsql's GET DIAGNOSTICS, other minor fixes.

commit   : ade64d05a0c9c77def776f64ea399697c3cd7f61    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Jul 2016 16:52:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Jul 2016 16:52:06 -0400    

Click here for diff

9.4 added a second description of GET DIAGNOSTICS that was totally  
independent of the existing one, resulting in each description lying to the  
extent that it claimed the set of status items it described was complete.  
Fix that, and do some minor markup improvement.  
  
Also some other small fixes per bug #14258 from Dilian Palauzov.  
  
Discussion: <[email protected]>  

M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/release-9.4.sgml

Doc: fix table of BRIN operator strategy numbers.

commit   : 82bbfc75c1bc3338b7208f1a7664878de0d3c59b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Jul 2016 13:32:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Jul 2016 13:32:45 -0400    

Click here for diff

brin-extensibility-inclusion-table was confused in places about the  
difference between strategy 4 (RTOverRight) and strategy 5 (RTRight).  
  
Alexander Law  

M doc/src/sgml/brin.sgml

Fix typos in comments and debug message

commit   : 55d57359f2ebebabd0387b437c9e3ef80312582f    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 18 Jul 2016 18:46:57 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 18 Jul 2016 18:46:57 +0200    

Click here for diff

Antonin Houska  

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

Translation updates

commit   : 7d676065690d5101d95a6b34797ee2a93514a7c3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Jul 2016 12:07:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Jul 2016 12:07:49 -0400    

Click here for diff

Source-Git-URL: git://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: 3d71988dffd3c0798a8864c55ca4b7833b48abb1  

M src/backend/po/de.po
M src/bin/initdb/po/pl.po
M src/bin/pg_basebackup/po/pl.po
M src/bin/pg_config/po/pl.po
M src/bin/pg_controldata/po/pl.po
M src/bin/pg_dump/po/pl.po
M src/bin/pg_resetxlog/po/pl.po
M src/bin/pg_rewind/po/pl.po
M src/bin/psql/po/de.po
M src/bin/psql/po/es.po
M src/bin/scripts/po/pl.po
M src/interfaces/libpq/po/pl.po
M src/pl/plperl/po/pl.po
M src/pl/plpython/po/de.po

Clear all-frozen visibilitymap status when locking tuples.

commit   : eca0f1db14ac92d91d54eca8eeff2d15ccd797fa    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2016 02:01:13 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2016 02:01:13 -0700    

Click here for diff

Since a892234 & fd31cd265 the visibilitymap's freeze bit is used to  
avoid vacuuming the whole relation in anti-wraparound vacuums. Doing so  
correctly relies on not adding xids to the heap without also unsetting  
the visibilitymap flag.  Tuple locking related code has not done so.  
  
To allow selectively resetting all-frozen - to avoid pessimizing  
heap_lock_tuple - allow to selectively reset the all-frozen with  
visibilitymap_clear(). To avoid having to use  
visibilitymap_get_status (e.g. via VM_ALL_FROZEN) inside a critical  
section, have visibilitymap_clear() return whether any bits have been  
reset.  
  
There's a remaining issue (denoted by XXX): After the PageIsAllVisible()  
check in heap_lock_tuple() and heap_lock_updated_tuple_rec() the page  
status could theoretically change. Practically that currently seems  
impossible, because updaters will hold a page level pin already.  Due to  
the next beta coming up, it seems better to get the required WAL magic  
bump done before resolving this issue.  
  
The added flags field fields to xl_heap_lock and xl_heap_lock_updated  
require bumping the WAL magic. Since there's already been a catversion  
bump since the last beta, that's not an issue.  
  
Reviewed-By: Robert Haas, Amit Kapila and Andres Freund  
Author: Masahiko Sawada, heavily revised by Andres Freund  
Discussion: CAEep[email protected]  
Backpatch: -  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/commands/vacuumlazy.c
M src/include/access/heapam_xlog.h
M src/include/access/visibilitymap.h
M src/include/access/xlog_internal.h

Remove obsolete comment.

commit   : 65632082b7eb3c7d56f1b42e1df452d0f66bc189    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Jul 2016 19:18:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Jul 2016 19:18:19 -0400    

Click here for diff

Peter Geoghegan  

M src/backend/utils/fmgr/fmgr.c

Establish conventions about global object names used in regression tests.

commit   : 18555b1323bd225c7882e80723c52f25ce60afed    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Jul 2016 18:42:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Jul 2016 18:42:31 -0400    

Click here for diff

To ensure that "make installcheck" can be used safely against an existing  
installation, we need to be careful about what global object names  
(database, role, and tablespace names) we use; otherwise we might  
accidentally clobber important objects.  There's been a weak consensus that  
test databases should have names including "regression", and that test role  
names should start with "regress_", but we didn't have any particular rule  
about tablespace names; and neither of the other rules was followed with  
any consistency either.  
  
This commit moves us a long way towards having a hard-and-fast rule that  
regression test databases must have names including "regression", and that  
test role and tablespace names must start with "regress_".  It's not  
completely there because I did not touch some test cases in rolenames.sql  
that test creation of special role names like "session_user".  That will  
require some rethinking of exactly what we want to test, whereas the intent  
of this patch is just to hit all the cases in which the needed renamings  
are cosmetic.  
  
There is no enforcement mechanism in this patch either, but if we don't  
add one we can expect that the tests will soon be violating the convention  
again.  Again, that's not such a cosmetic change and it will require  
discussion.  (But I did use a quick-hack enforcement patch to find these  
cases.)  
  
Discussion: <[email protected]>  

M contrib/dblink/expected/dblink.out
M contrib/dblink/sql/dblink.sql
M contrib/file_fdw/input/file_fdw.source
M contrib/file_fdw/output/file_fdw.source
M contrib/sepgsql/expected/alter.out
M contrib/sepgsql/expected/ddl.out
M contrib/sepgsql/sql/alter.sql
M contrib/sepgsql/sql/ddl.sql
M contrib/test_decoding/expected/permissions.out
M contrib/test_decoding/sql/permissions.sql
M doc/src/sgml/dblink.sgml
M doc/src/sgml/regress.sgml
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/070_dropuser.pl
M src/interfaces/ecpg/test/Makefile
M src/interfaces/ecpg/test/compat_informix/test_informix2.pgc
M src/interfaces/ecpg/test/connect/test1.pgc
M src/interfaces/ecpg/test/connect/test2.pgc
M src/interfaces/ecpg/test/connect/test3.pgc
M src/interfaces/ecpg/test/connect/test5.pgc
M src/interfaces/ecpg/test/expected/compat_informix-describe.c
M src/interfaces/ecpg/test/expected/compat_informix-describe.stderr
M src/interfaces/ecpg/test/expected/compat_informix-rnull.c
M src/interfaces/ecpg/test/expected/compat_informix-rnull.stderr
M src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
M src/interfaces/ecpg/test/expected/compat_informix-sqlda.stderr
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/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-test2.c
M src/interfaces/ecpg/test/expected/connect-test2.stderr
M src/interfaces/ecpg/test/expected/connect-test3.c
M src/interfaces/ecpg/test/expected/connect-test3.stderr
M src/interfaces/ecpg/test/expected/connect-test4.c
M src/interfaces/ecpg/test/expected/connect-test4.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/pgtypeslib-dt_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.stderr
M src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.stderr
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stderr
M src/interfaces/ecpg/test/expected/preproc-array_of_struct.c
M src/interfaces/ecpg/test/expected/preproc-array_of_struct.stderr
M src/interfaces/ecpg/test/expected/preproc-autoprep.c
M src/interfaces/ecpg/test/expected/preproc-autoprep.stderr
M src/interfaces/ecpg/test/expected/preproc-comment.c
M src/interfaces/ecpg/test/expected/preproc-comment.stderr
M src/interfaces/ecpg/test/expected/preproc-cursor.c
M src/interfaces/ecpg/test/expected/preproc-cursor.stderr
M src/interfaces/ecpg/test/expected/preproc-define.c
M src/interfaces/ecpg/test/expected/preproc-define.stderr
M src/interfaces/ecpg/test/expected/preproc-describe.c
M src/interfaces/ecpg/test/expected/preproc-describe.stderr
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-pointer_to_struct.c
M src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.stderr
M src/interfaces/ecpg/test/expected/preproc-strings.c
M src/interfaces/ecpg/test/expected/preproc-strings.stderr
M src/interfaces/ecpg/test/expected/preproc-type.c
M src/interfaces/ecpg/test/expected/preproc-type.stderr
M src/interfaces/ecpg/test/expected/preproc-variable.c
M src/interfaces/ecpg/test/expected/preproc-variable.stderr
M src/interfaces/ecpg/test/expected/preproc-whenever.c
M src/interfaces/ecpg/test/expected/preproc-whenever.stderr
M src/interfaces/ecpg/test/expected/sql-array.c
M src/interfaces/ecpg/test/expected/sql-array.stderr
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-code100.c
M src/interfaces/ecpg/test/expected/sql-code100.stderr
M src/interfaces/ecpg/test/expected/sql-copystdout.c
M src/interfaces/ecpg/test/expected/sql-copystdout.stderr
M src/interfaces/ecpg/test/expected/sql-define.c
M src/interfaces/ecpg/test/expected/sql-define.stderr
M src/interfaces/ecpg/test/expected/sql-desc.c
M src/interfaces/ecpg/test/expected/sql-desc.stderr
M src/interfaces/ecpg/test/expected/sql-describe.c
M src/interfaces/ecpg/test/expected/sql-describe.stderr
M src/interfaces/ecpg/test/expected/sql-dynalloc.c
M src/interfaces/ecpg/test/expected/sql-dynalloc.stderr
M src/interfaces/ecpg/test/expected/sql-dynalloc2.c
M src/interfaces/ecpg/test/expected/sql-dynalloc2.stderr
M src/interfaces/ecpg/test/expected/sql-dyntest.c
M src/interfaces/ecpg/test/expected/sql-dyntest.stderr
M src/interfaces/ecpg/test/expected/sql-execute.c
M src/interfaces/ecpg/test/expected/sql-execute.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-func.c
M src/interfaces/ecpg/test/expected/sql-func.stderr
M src/interfaces/ecpg/test/expected/sql-indicators.c
M src/interfaces/ecpg/test/expected/sql-indicators.stderr
M src/interfaces/ecpg/test/expected/sql-insupd.c
M src/interfaces/ecpg/test/expected/sql-insupd.stderr
M src/interfaces/ecpg/test/expected/sql-oldexec.c
M src/interfaces/ecpg/test/expected/sql-oldexec.stderr
M src/interfaces/ecpg/test/expected/sql-parser.c
M src/interfaces/ecpg/test/expected/sql-parser.stderr
M src/interfaces/ecpg/test/expected/sql-quote.c
M src/interfaces/ecpg/test/expected/sql-quote.stderr
M src/interfaces/ecpg/test/expected/sql-show.c
M src/interfaces/ecpg/test/expected/sql-show.stderr
M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/expected/sql-sqlda.stderr
M src/interfaces/ecpg/test/expected/thread-alloc.c
M src/interfaces/ecpg/test/expected/thread-prep.c
M src/interfaces/ecpg/test/expected/thread-thread.c
M src/interfaces/ecpg/test/expected/thread-thread_implicit.c
M src/interfaces/ecpg/test/regression.h
M src/test/isolation/isolation_main.c
M src/test/modules/dummy_seclabel/expected/dummy_seclabel.out
M src/test/modules/dummy_seclabel/sql/dummy_seclabel.sql
M src/test/modules/test_ddl_deparse/expected/alter_function.out
M src/test/modules/test_ddl_deparse/sql/alter_function.sql
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/modules/test_pg_dump/test_pg_dump–1.0.sql
M src/test/modules/test_rls_hooks/expected/test_rls_hooks.out
M src/test/modules/test_rls_hooks/sql/test_rls_hooks.sql
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/alter_operator.out
M src/test/regress/expected/cluster.out
M src/test/regress/expected/conversion.out
M src/test/regress/expected/create_function_3.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/dependency.out
M src/test/regress/expected/drop_if_exists.out
M src/test/regress/expected/event_trigger.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/guc.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/regproc.out
M src/test/regress/expected/roleattributes.out
M src/test/regress/expected/rolenames.out
M src/test/regress/expected/security_label.out
M src/test/regress/expected/select_into.out
M src/test/regress/expected/sequence.out
M src/test/regress/expected/sequence_1.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/input/largeobject.source
M src/test/regress/input/tablespace.source
M src/test/regress/output/largeobject.source
M src/test/regress/output/largeobject_1.source
M src/test/regress/output/tablespace.source
M src/test/regress/sql/alter_generic.sql
M src/test/regress/sql/alter_operator.sql
M src/test/regress/sql/cluster.sql
M src/test/regress/sql/conversion.sql
M src/test/regress/sql/create_function_3.sql
M src/test/regress/sql/create_index.sql
M src/test/regress/sql/dependency.sql
M src/test/regress/sql/drop_if_exists.sql
M src/test/regress/sql/event_trigger.sql
M src/test/regress/sql/foreign_data.sql
M src/test/regress/sql/guc.sql
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/regproc.sql
M src/test/regress/sql/roleattributes.sql
M src/test/regress/sql/rolenames.sql
M src/test/regress/sql/security_label.sql
M src/test/regress/sql/select_into.sql
M src/test/regress/sql/sequence.sql
M src/test/regress/sql/updatable_views.sql
M src/tools/msvc/vcregress.pl

doc: Supply XSLT template for superscript element in man pages

commit   : 7482fc4600ee97f8b2570e87b8c216a83b918065    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 17 Jul 2016 17:01:07 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 17 Jul 2016 17:01:07 -0400    

Click here for diff

The default is no decoration, which looks confusing, for example on the  
CREATE SEQUENCE man page.  

M doc/src/sgml/stylesheet-man.xsl

Use correct symbol for minimum int64 value

commit   : f36ca9af05dd0468cdee28fbdbded690a10ff08b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 17 Jul 2016 09:15:37 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 17 Jul 2016 09:15:37 -0400    

Click here for diff

The old code used SEQ_MINVALUE to get the smallest int64 value.  This  
was done as a convenience to avoid having to deal with INT64_IS_BUSTED,  
but that is obsolete now.  Also, it is incorrect because the smallest  
int64 value is actually SEQ_MINVALUE-1.  Fix by using PG_INT64_MIN.  

M contrib/btree_gin/btree_gin.c

Correctly dump database and tablespace ACLs

commit   : 47f5bb9f539a7fff089724b1cbacc31613031895    
  
author   : Stephen Frost <[email protected]>    
date     : Sun, 17 Jul 2016 09:04:46 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sun, 17 Jul 2016 09:04:46 -0400    

Click here for diff

Dump out the appropriate GRANT/REVOKE commands for databases and  
tablespaces from pg_dumpall to replicate what the current state is.  
  
This was broken during the changes to buildACLCommands for 9.6+  
servers for pg_init_privs.  

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

Update 9.6 release notes through today.

commit   : fe03f2896292e6b21828490c76bda64cf75e7867    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2016 18:39:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2016 18:39:47 -0400    

Click here for diff

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

Improve test case exercising the sorting path for hash index build.

commit   : 606ccc5e7e97914073f991b077712645e125d531    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2016 16:25:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2016 16:25:43 -0400    

Click here for diff

On second thought, we should probably do at least a minimal check that  
the constructed index is valid, since the big problem with the most  
recent breakage was not whether the sorting was correct but that the  
index had incorrect hash codes placed in it.  

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

Add regression test case exercising the sorting path for hash index build.

commit   : 9563d5b5e4c75e676d73a45546bd47b77c2bd739    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2016 15:30:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2016 15:30:15 -0400    

Click here for diff

We've broken this code path at least twice in the past, so it's prudent  
to have a test case that covers it.  To allow exercising the code path  
without creating a very large (and slow to run) test case, redefine the  
sort threshold to be bounded by maintenance_work_mem as well as the number  
of available buffers.  While at it, fix an ancient oversight that when  
building a temp index, the number of available buffers is not NBuffers but  
NLocBuffer.  Also, if assertions are enabled, apply a direct test that the  
sort actually does return the tuples in the expected order.  
  
Peter Geoghegan  
  
Patch: <CAM3SWZT[email protected]>  

M src/backend/access/hash/hash.c
M src/backend/access/hash/hashsort.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Fix crash in close_ps() for NaN input coordinates.

commit   : 278148907a971ec7fa4ffb24248103d8012155d2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2016 14:42:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2016 14:42:37 -0400    

Click here for diff

The Assert() here seems unreasonably optimistic.  Andreas Seltenreich  
found that it could fail with NaNs in the input geometries, and it  
seems likely to me that it might fail in corner cases due to roundoff  
error, even for ordinary input values.  As a band-aid, make the function  
return SQL NULL instead of crashing.  
  
Report: <[email protected]>  

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

Clarify usage of clientcert authentication option.

commit   : 745513c70282180afd83c666e43bdb0b6fb8c688    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2016 14:12:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2016 14:12:44 -0400    

Click here for diff

For some reason this option wasn't discussed at all in client-auth.sgml.  
Document it there, and be more explicit about its relationship to the  
"cert" authentication method.  Per gripe from Srikanth Venkatesh.  
  
I failed to resist the temptation to do some minor wordsmithing in the  
same area, too.  
  
Discussion: <[email protected]>  

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

Advance PG_CONTROL_VERSION.

commit   : 99dd8b05aa5647a59f30ca67e67e2e3377f50094    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2016 12:49:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2016 12:49:14 -0400    

Click here for diff

This should have been done in commit 73c986adde5d73a5 which added several  
new fields to pg_control, and again in commit 5028f22f6eb05798 which  
changed the CRC algorithm, but it wasn't.  It's far too late to fix it in  
the 9.5 branch, but let's do so in 9.6, so that if a 9.6 postmaster is  
started against a 9.4-era pg_control it will complain about a versioning  
problem rather than a CRC failure.  We already forced initdb/pg_upgrade  
for beta3, so there's no downside to doing this now.  
  
Discussion: <[email protected]>  

M src/include/catalog/pg_control.h

Fix torn-page, unlogged xid and further risks from heap_update().

commit   : bfa2ab56bb8c512dc8613ee3ff0936568a1c8418    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 15 Jul 2016 17:49:48 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 15 Jul 2016 17:49:48 -0700    

Click here for diff

When heap_update needs to look for a page for the new tuple version,  
because the current one doesn't have sufficient free space, or when  
columns have to be processed by the tuple toaster, it has to release the  
lock on the old page during that. Otherwise there'd be lock ordering and  
lock nesting issues.  
  
To avoid concurrent sessions from trying to update / delete / lock the  
tuple while the page's content lock is released, the tuple's xmax is set  
to the current session's xid.  
  
That unfortunately was done without any WAL logging, thereby violating  
the rule that no XIDs may appear on disk, without an according WAL  
record.  If the database were to crash / fail over when the page level  
lock is released, and some activity lead to the page being written out  
to disk, the xid could end up being reused; potentially leading to the  
row becoming invisible.  
  
There might be additional risks by not having t_ctid point at the tuple  
itself, without having set the appropriate lock infomask fields.  
  
To fix, compute the appropriate xmax/infomask combination for locking  
the tuple, and perform WAL logging using the existing XLOG_HEAP_LOCK  
record. That allows the fix to be backpatched.  
  
This issue has existed for a long time. There appears to have been  
partial attempts at preventing dangers, but these never have fully been  
implemented, and were removed a long time ago, in  
11919160 (cf. HEAP_XMAX_UNLOGGED).  
  
In master / 9.6, there's an additional issue, namely that the  
visibilitymap's freeze bit isn't reset at that point yet. Since that's a  
new issue, introduced only in a892234f830, that'll be fixed in a  
separate commit.  
  
Author: Masahiko Sawada and Andres Freund  
Reported-By: Different aspects by Thomas Munro, Noah Misch, and others  
Discussion: CAEep[email protected]  
Backpatch: 9.1/all supported versions  

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

Make HEAP_LOCK/HEAP2_LOCK_UPDATED replay reset HEAP_XMAX_INVALID.

commit   : a4d357bfbd56bd876817fb74f46525dbb3184bc2    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 15 Jul 2016 14:37:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 15 Jul 2016 14:37:06 -0700    

Click here for diff

0ac5ad5 started to compress infomask bits in WAL records. Unfortunately  
the replay routines for XLOG_HEAP_LOCK/XLOG_HEAP2_LOCK_UPDATED forgot to  
reset the HEAP_XMAX_INVALID (and some other) hint bits.  
  
Luckily that's not problematic in the majority of cases, because after a  
crash/on a standby row locks aren't meaningful. Unfortunately that does  
not hold true in the presence of prepared transactions. This means that  
after a crash, or after promotion, row level locks held by a prepared,  
but not yet committed, prepared transaction might not be enforced.  
  
Discussion: [email protected]  
Backpatch: 9.3, the oldest branch on which 0ac5ad5 is present.  

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

Avoid invalidating all foreign-join cached plans when user mappings change.

commit   : 45639a0525a58a2700cf46d4c934d6de78349dac    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Jul 2016 17:22:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Jul 2016 17:22:56 -0400    

Click here for diff

We must not push down a foreign join when the foreign tables involved  
should be accessed under different user mappings.  Previously we tried  
to enforce that rule literally during planning, but that meant that the  
resulting plans were dependent on the current contents of the  
pg_user_mapping catalog, and we had to blow away all cached plans  
containing any remote join when anything at all changed in pg_user_mapping.  
This could have been improved somewhat, but the fact that a syscache inval  
callback has very limited info about what changed made it hard to do better  
within that design.  Instead, let's change the planner to not consider user  
mappings per se, but to allow a foreign join if both RTEs have the same  
checkAsUser value.  If they do, then they necessarily will use the same  
user mapping at runtime, and we don't need to know specifically which one  
that is.  Post-plan-time changes in pg_user_mapping no longer require any  
plan invalidation.  
  
This rule does give up some optimization ability, to wit where two foreign  
table references come from views with different owners or one's from a view  
and one's directly in the query, but nonetheless the same user mapping  
would have applied.  We'll sacrifice the first case, but to not regress  
more than we have to in the second case, allow a foreign join involving  
both zero and nonzero checkAsUser values if the nonzero one is the same as  
the prevailing effective userID.  In that case, mark the plan as only  
runnable by that userID.  
  
The plancache code already had a notion of plans being userID-specific,  
in order to support RLS.  It was a little confused though, in particular  
lacking clarity of thought as to whether it was the rewritten query or just  
the finished plan that's dependent on the userID.  Rearrange that code so  
that it's clearer what depends on which, and so that the same logic applies  
to both RLS-injected role dependency and foreign-join-injected role  
dependency.  
  
Note that this patch doesn't remove the other issue mentioned in the  
original complaint, which is that while we'll reliably stop using a foreign  
join if it's disallowed in a new context, we might fail to start using a  
foreign join if it's now allowed, but we previously created a generic  
cached plan that didn't use one.  It was agreed that the chance of winning  
that way was not high enough to justify the much larger number of plan  
invalidations that would have to occur if we tried to cause it to happen.  
  
In passing, clean up randomly-varying spelling of EXPLAIN commands in  
postgres_fdw.sql, and fix a COSTS ON example that had been allowed to  
leak into the committed tests.  
  
This reverts most of commits fbe5a3fb7 and 5d4171d1c, which were the  
previous attempt at ensuring we wouldn't push down foreign joins that  
span permissions contexts.  
  
Etsuro Fujita and Tom Lane  
  
Discussion: <[email protected]>  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/executor/execParallel.c
M src/backend/foreign/foreign.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/joinpath.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/relnode.c
M src/backend/utils/cache/plancache.c
M src/include/foreign/foreign.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/utils/plancache.h

Avoid serializability errors when locking a tuple with a committed update

commit   : 533e9c6b0628f6557ddcaf3e5177081878ea7cb6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 15 Jul 2016 14:17:20 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 15 Jul 2016 14:17:20 -0400    

Click here for diff

When key-share locking a tuple that has been not-key-updated, and the  
update is a committed transaction, in some cases we raised  
serializability errors:  
    ERROR:  could not serialize access due to concurrent update  
  
Because the key-share doesn't conflict with the update, the error is  
unnecessary and inconsistent with the case that the update hasn't  
committed yet.  This causes problems for some usage patterns, even if it  
can be claimed that it's sufficient to retry the aborted transaction:  
given a steady stream of updating transactions and a long locking  
transaction, the long transaction can be starved indefinitely despite  
multiple retries.  
  
To fix, we recognize that HeapTupleSatisfiesUpdate can return  
HeapTupleUpdated when an updating transaction has committed, and that we  
need to deal with that case exactly as if it were a non-committed  
update: verify whether the two operations conflict, and if not, carry on  
normally.  If they do conflict, however, there is a difference: in the  
HeapTupleBeingUpdated case we can just sleep until the concurrent  
transaction is gone, while in the HeapTupleUpdated case this is not  
possible and we must raise an error instead.  
  
Per trouble report from Olivier Dony.  
  
In addition to a couple of test cases that verify the changed behavior,  
I added a test case to verify the behavior that remains unchanged,  
namely that errors are raised when a update that modifies the key is  
used.  That must still generate serializability errors.  One  
pre-existing test case changes behavior; per discussion, the new  
behavior is actually the desired one.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  
  https://www.postgresql.org/message-id/[email protected]  
  
Backpatch to 9.3, where the problem appeared.  

M src/backend/access/heap/heapam.c
A src/test/isolation/expected/lock-committed-keyupdate.out
A src/test/isolation/expected/lock-committed-update.out
M src/test/isolation/expected/lock-update-delete.out
A src/test/isolation/expected/update-locked-tuple.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/lock-committed-keyupdate.spec
A src/test/isolation/specs/lock-committed-update.spec
A src/test/isolation/specs/update-locked-tuple.spec

Fix parsing NOT sequence in tsquery

commit   : 00f304ce2dd86f4b76606225b41e0854a3362628    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 15 Jul 2016 20:01:41 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 15 Jul 2016 20:01:41 +0300    

Click here for diff

Digging around bug #14245 I found that commit  
6734a1cacd44f5b731933cbc93182b135b167d0c missed that NOT operation is  
right associative in opposite to all other. This miss is resposible for  
tsquery parser fail on sequence of NOT operations  

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

Fix nested NOT operation cleanup in tsquery.

commit   : 19d290155d084754eeb5ebb2569654da06073ee8    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 15 Jul 2016 19:22:18 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 15 Jul 2016 19:22:18 +0300    

Click here for diff

During normalization of tsquery tree it tries to simplify nested NOT  
operations but there it's obvioulsy missed that subsequent node could be  
a leaf node (value node)  
  
Bug #14245: Segfault on weird to_tsquery  
Reported by David Kellum.  

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

Improve documentation about search_path for SECURITY DEFINER functions.

commit   : ce150e7e0fc1a127fee7933d71f4204a79ecce04    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Jul 2016 10:58:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Jul 2016 10:58:39 -0400    

Click here for diff

Clarify that the reason for recommending that pg_temp be put last is to  
prevent temporary tables from capturing unqualified table names.  Per  
discussion with Albe Laurenz.  
  
Discussion: <A737B7A3727[email protected]>  

M doc/src/sgml/ref/create_function.sgml

Adjust spellings of forms of "cancel"

commit   : 63cfdb8dde7f25a095af03aa204580fea55c6c07    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Jul 2016 22:48:26 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Jul 2016 22:48:26 -0400    

Click here for diff

M src/backend/optimizer/util/orclauses.c
M src/backend/storage/ipc/standby.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/time/tqual.c

doc: Fix typos

commit   : 3aed52a622b1c83abc45c6a7c0ef6dbb9adaa7e1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Jul 2016 22:28:58 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Jul 2016 22:28:58 -0400    

Click here for diff

From: Alexander Law <[email protected]>  

M doc/src/sgml/btree-gist.sgml
M doc/src/sgml/ref/pg_xlogdump.sgml
M doc/src/sgml/sepgsql.sgml

Fix GiST index build for NaN values in geometric types.

commit   : 1acf7572554515b99ef6e783750aaea8777524ec    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Jul 2016 18:45:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Jul 2016 18:45:59 -0400    

Click here for diff

GiST index build could go into an infinite loop when presented with boxes  
(or points, circles or polygons) containing NaN component values.  This  
happened essentially because the code assumed that x == x is true for any  
"double" value x; but it's not true for NaNs.  The looping behavior was not  
the only problem though: we also attempted to sort the items using simple  
double comparisons.  Since NaNs violate the trichotomy law, qsort could  
(in principle at least) get arbitrarily confused and mess up the sorting of  
ordinary values as well as NaNs.  And we based splitting choices on box size  
calculations that could produce NaNs, again resulting in undesirable  
behavior.  
  
To fix, replace all comparisons of doubles in this logic with  
float8_cmp_internal, which is NaN-aware and is careful to sort NaNs  
consistently, higher than any non-NaN.  Also rearrange the box size  
calculation to not produce NaNs; instead it should produce an infinity  
for a box with NaN on one side and not-NaN on the other.  
  
I don't by any means claim that this solves all problems with NaNs in  
geometric values, but it should at least make GiST index insertion work  
reliably with such data.  It's likely that the index search side of things  
still needs some work, and probably regular geometric operations too.  
But with this patch we're laying down a convention for how such cases  
ought to behave.  
  
Per bug #14238 from Guang-Dih Lei.  Back-patch to 9.2; the code used before  
commit 7f3bd86843e5aad8 is quite different and doesn't lock up on my simple  
test case, nor on the submitter's dataset.  
  
Report: <[email protected]>  
Discussion: <[email protected]>  

M src/backend/access/gist/gistproc.c
M src/backend/utils/adt/float.c
M src/include/utils/builtins.h

Remove reference to range mode in pg_xlogdump error

commit   : 00e0b67a584b51aac12e4279a31fa5a1130fe05f    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 14 Jul 2016 15:39:01 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 14 Jul 2016 15:39:01 +0200    

Click here for diff

pg_xlogdump doesn't have any other mode, so it's just confusing to  
include this in the error message as it indicates there might be another  
mode.  

M src/bin/pg_xlogdump/pg_xlogdump.c

Minor test adjustment.

commit   : 56a997413391337f7fb9926144d6b6fa831b9d22    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2016 15:36:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2016 15:36:25 -0400    

Click here for diff

Dept of second thoughts: given the RESET SESSION AUTHORIZATION that  
was just added by commit cec550139, we don't need the reconnection  
that used to be here.  Might as well buy back a few microseconds.  

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

Add a regression test case to improve code coverage for tuplesort.

commit   : cec55013943d160538334ee19ef5db429a085969    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2016 15:23:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2016 15:23:56 -0400    

Click here for diff

Test the external-sort code path in CLUSTER for two different scenarios:  
multiple-pass external sorting, and the best case for replacement  
selection, where only one run is produced, so that no merge is required.  
This test would have caught the bug fixed in commit 1b0fc8507, at  
least when run with valgrind enabled.  
  
In passing, add a short-circuit test in plan_cluster_use_sort() to make  
dead certain that it selects sorting when enable_indexscan is off.  As  
things stand, that would happen anyway, but it seems like good future  
proofing for this test.  
  
Peter Geoghegan  
  
Discussion: <CAM3SWZS[email protected]>  

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

Fix obsolete header-file reference in pg_buffercache docs.

commit   : 91c0eb5040cde36a62a34e9b3a80d82db64eb98f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2016 11:17:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2016 11:17:15 -0400    

Click here for diff

Commit 2d0019049 moved enum ForkNumber from relfilenode.h into relpath.h,  
but missed updating this documentation reference.  
  
Alexander Law  

M doc/src/sgml/pgbuffercache.sgml

Add missing hyphen

commit   : 42ec6c2da699e8e0b1774988fa97297a2cdf716c    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 13 Jul 2016 09:17:35 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 13 Jul 2016 09:17:35 -0400    

Click here for diff

Pointed out by Alexander Law  

M doc/src/sgml/runtime.sgml

Add serial comma and quoting to message

commit   : 5d4050064bf3f2be056a4a887ec11aa14d0d2562    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Jul 2016 18:37:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Jul 2016 18:37:34 -0400    

Click here for diff

M src/backend/tsearch/spell.c

Put some things in a better order in psql help

commit   : b9fc9f7c3c4096aca69261af305c679ffe74c32b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Jul 2016 18:10:16 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Jul 2016 18:10:16 -0400    

Click here for diff

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/help.c

Allow IMPORT FOREIGN SCHEMA within pl/pgsql.

commit   : baebab3ace480477f210dadc4633d8d119dfa978    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2016 18:06:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2016 18:06:50 -0400    

Click here for diff

Since IMPORT FOREIGN SCHEMA has an INTO clause, pl/pgsql needs to be  
aware of that and avoid capturing the INTO as an INTO-variables clause.  
This isn't hard, though it's annoying to have to make IMPORT a plpgsql  
keyword just for this.  (Fortunately, we have the infrastructure now  
to make it an unreserved keyword, so at least this shouldn't break any  
existing pl/pgsql code.)  
  
Per report from Merlin Moncure.  Back-patch to 9.5 where IMPORT FOREIGN  
SCHEMA was introduced.  
  
Report: <CAHyXU0w[email protected]>  

M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_scanner.c

doc: Fix typo

commit   : d3fbd5929ce5cb7468635aac30c2abf02b7d474a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Jul 2016 13:30:48 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Jul 2016 13:30:48 -0400    

Click here for diff

From: Alexander Law <[email protected]>  

M doc/src/sgml/fdwhandler.sgml

Print a given subplan only once in EXPLAIN.

commit   : 4d042999f94a4bc41b86baca5920cd4829e16895    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Jul 2016 18:14:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Jul 2016 18:14:29 -0400    

Click here for diff

We have, for a very long time, allowed the same subplan (same member of the  
PlannedStmt.subplans list) to be referenced by more than one SubPlan node;  
this avoids problems for cases such as subplans within an IndexScan's  
indxqual and indxqualorig fields.  However, EXPLAIN had not gotten the memo  
and would print each reference as though it were an independent identical  
subplan.  To fix, track plan_ids of subplans we've printed and don't print  
the same plan_id twice.  Per report from Pavel Stehule.  
  
BTW: the particular case of IndexScan didn't cause visible duplication  
in a plain EXPLAIN, only EXPLAIN ANALYZE, because in the former case we  
short-circuit executor startup before the indxqual field is processed by  
ExecInitExpr.  That seems like it could easily lead to other EXPLAIN  
problems in future, but it's not clear how to avoid it without breaking  
the "EXPLAIN a plan using hypothetical indexes" use-case.  For now I've  
left that issue alone.  
  
Although this is a longstanding bug, it's purely cosmetic (no great harm  
is done by the repeat printout) and we haven't had field complaints before.  
So I'm hesitant to back-patch it, especially since there is some small risk  
of ABI problems due to the need to add a new field to ExplainState.  
  
In passing, rearrange order of fields in ExplainState to be less random,  
and update some obsolete comments about when/where to initialize them.  
  
Report: <CAFj8pRA[email protected]>  

M src/backend/commands/explain.c
M src/include/commands/explain.h

Improve output of psql's \df+ command.

commit   : a670c24c382693c4f75e99c9292b2ed0f0d40a72    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Jul 2016 12:35:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Jul 2016 12:35:03 -0400    

Click here for diff

Add display of proparallel (parallel-safety) when the server is >= 9.6,  
and display of proacl (access privileges) for all server versions.  
Minor tweak of column ordering to keep related columns together.  
  
Michael Paquier  
  
Discussion: <CAB7nPqT[email protected]>  

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

doc: Update URL for PL/PHP

commit   : 740bf396a1d5cc41a8398076a9de1485c497c49c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Jul 2016 12:10:10 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Jul 2016 12:10:10 -0400    

Click here for diff

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

Add missing newline in error message

commit   : ae7d78c3e24d7991a8f76f4676c015df3d143d63    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 11 Jul 2016 13:53:17 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 11 Jul 2016 13:53:17 +0200    

Click here for diff

M src/bin/pg_xlogdump/pg_xlogdump.c

Fix start WAL filename for concurrent backups from standby

commit   : 87d84d67bb15752c79a1c07e603126830642ac84    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 11 Jul 2016 12:02:31 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 11 Jul 2016 12:02:31 +0200    

Click here for diff

On a standby, ThisTimelineID is always 0, so we would generate a  
filename in timeline 0 even for other timelines. Instead, use starttli  
which we have retreived from the controlfile.  
  
Report by: Francesco Canovai in bug #14230  
Author: Marco Nenciarini  
Reviewed by: Michael Paquier and Amit Kapila  

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

Revert "Add some temporary code to record stack usage at server process exit."

commit   : 96112ee7c60557bb192a9aa07b514db2400fd45e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Jul 2016 12:44:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Jul 2016 12:44:20 -0400    

Click here for diff

This reverts commit 88cf37d2a86d5b66380003d7c3384530e3f91e40 as well  
as follow-on commits ea9c4a16d5ad88a1d28d43ef458e3209b53eb106 and  
c57562725d219c4249b82f4a4fb5aaeee3ae0d53.  We've learned about as much  
as we can from the buildfarm.  

M src/backend/storage/ipc/ipc.c
M src/backend/tcop/postgres.c

Fix TAP tests and MSVC scripts for pathnames with spaces.

commit   : 30b2731bd21741a6370afba330cea31c75da3bdb    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Jul 2016 16:47:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Jul 2016 16:47:38 -0400    

Click here for diff

Change assorted places in our Perl code that did things like  
	system("prog $path/file");  
to do it more like  
	system('prog', "$path/file");  
which is safe against spaces and other special characters in the path  
variable.  The latter was already the prevailing style, but a few bits  
of code hadn't gotten this memo.  Back-patch to 9.4 as relevant.  
  
Michael Paquier, Kyotaro Horiguchi  
  
Discussion: <[email protected]>  

M src/test/perl/PostgresNode.pm
M src/tools/msvc/Install.pm
M src/tools/msvc/vcregress.pl

Improve recording of IA64 stack data.

commit   : c57562725d219c4249b82f4a4fb5aaeee3ae0d53    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Jul 2016 15:00:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Jul 2016 15:00:22 -0400    

Click here for diff

Examination of the results from anole and gharial suggests that we're  
only managing to track the size of one of the two stacks of IA64 machines.  
Some googling gave the answer: on HPUX11, the register stack is reported  
as a page type I don't see in pstat.h on my HPUX10 box.  Let's try  
testing for that.  

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

Add more temporary code to record stack usage at server process exit.

commit   : ea9c4a16d5ad88a1d28d43ef458e3209b53eb106    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Jul 2016 16:38:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Jul 2016 16:38:22 -0400    

Click here for diff

After a look at preliminary results from commit 88cf37d2a86d5b66,  
I realized it'd be a good idea to spew out the maximum depth measurement  
seen by check_stack_depth.  So add some quick-n-dirty code to do that.  
Like the previous commit, this will be reverted once we've gathered  
a set of buildfarm runs with it.  

M src/backend/storage/ipc/ipc.c
M src/backend/tcop/postgres.c

Docs: minor improvements for documentation about plpgsql triggers.

commit   : 769159fd393f006f29879a71a5f2b3049251b4d9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Jul 2016 13:23:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Jul 2016 13:23:09 -0400    

Click here for diff

Fabien Coelho, some further wordsmithing by me  

M doc/src/sgml/plpgsql.sgml

Docs: improve examples about not repeating table name in UPDATE ... SET.

commit   : 8ba4ccda457530c65f5f08cb4665c23ce355381d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Jul 2016 12:46:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Jul 2016 12:46:04 -0400    

Click here for diff

Alexander Law  

M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/update.sgml

Docs: typo fix.

commit   : 262c1b2e1663c3e71e061b40a3e807740866532d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Jul 2016 12:40:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Jul 2016 12:40:51 -0400    

Click here for diff

Etsuro Fujita  

M doc/src/sgml/fdwhandler.sgml

Add some temporary code to record stack usage at server process exit.

commit   : 88cf37d2a86d5b66380003d7c3384530e3f91e40    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Jul 2016 12:01:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Jul 2016 12:01:08 -0400    

Click here for diff

This patch is meant to gather information from the buildfarm members, and  
will be reverted in a day or so.  The idea is to try to find out the  
high-water stack consumption while running the regression tests,  
particularly on IA64 which is suspected to use much more stack than other  
architectures.  On machines with pmap, we can use that; but the IA64 farm  
members are running HPUX, so also include some bespoke code for HPUX.  
(I've tested the latter on HPUX 10/HPPA; not entirely sure it will work  
on HPUX 11/IA64, but we'll soon find out.)  
  
Discussion: <CAM-w4HM[email protected]>  

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

Typo fix, buils -> builds

commit   : e8bde9e2538a25b4a5deea569c4c48244c1a7e40    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 8 Jul 2016 09:26:53 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 8 Jul 2016 09:26:53 -0400    

Click here for diff

Pointed out by Alexander Law.  

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

Fix missing parenthesis in docs

commit   : 51dc30856efdbf8a8e56428f9c2bef21c694fb1c    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 8 Jul 2016 10:06:45 +0300    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 8 Jul 2016 10:06:45 +0300    

Click here for diff

Author: Alexander Law  

M doc/src/sgml/backup.sgml

Fix typo in comment.

commit   : 3edcdbcc4d012093147b50220a7dab57c380d549    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 7 Jul 2016 16:13:37 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 7 Jul 2016 16:13:37 -0400    

Click here for diff

Amit Langote  

M src/backend/nodes/readfuncs.c

Properly adjust pointers when tuples are moved during CLUSTER.

commit   : 1b0fc85077aadb3f4a965aff35c136398d859624    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 7 Jul 2016 13:47:16 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 7 Jul 2016 13:47:16 -0400    

Click here for diff

Otherwise, when we abandon incremental memory accounting and use  
batch allocation for the final merge pass, we might crash.  This  
has been broken since 0011c0091e886b874e485a46ff2c94222ffbf550.  
  
Peter Geoghegan, tested by Noah Misch  

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

Fix a prototype which is inconsistent with the function definition.

commit   : b22934dc032d7b2a297c2d35dc10fd403c8de631    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 7 Jul 2016 13:46:51 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 7 Jul 2016 13:46:51 -0400    

Click here for diff

Peter Geoghegan  

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

Clarify resource utilization of parallel query.

commit   : d1f822e58597cac5000bf69b893cc236c5ef5fcb    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 7 Jul 2016 11:18:51 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 7 Jul 2016 11:18:51 -0400    

Click here for diff

temp_file_limit is a per-process limit, not a per-session limit across  
all cooperating parallel processes; change wording accordingly, per a  
suggestion from Tom Lane.  
  
Also, document under max_parallel_workers_per_gather the fact that each  
process involved in a parallel query may use as many resources as a  
separate session.  Caveat emptor.  
  
Per a complaint from Peter Geoghegan.  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample

Reduce stack space consumption in tzload().

commit   : 62c8421e87b33b2e94f8a7842e1dd9aa1a286ffc    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Jul 2016 11:28:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Jul 2016 11:28:17 -0400    

Click here for diff

While syncing our timezone code with IANA's updates in commit 1c1a7cbd6,  
I'd chosen not to adopt the code they conditionally compile under #ifdef  
ALL_STATE.  The main thing that that drives is that the space for gmtime  
and localtime timezone definitions isn't statically allocated, but is  
malloc'd on first use.  I reasoned we didn't need that logic: we don't have  
localtime() at all, and we always initialize TimeZone to GMT so we always  
need that one.  But there is one other thing ALL_STATE does, which is to  
make tzload() malloc its transient workspace instead of just declaring it  
as a local variable.  It turns out that that local variable occupies 78K.  
Even worse is that, at least for common US timezone settings, there's a  
recursive call to parse the "posixrules" zone name, making peak stack  
consumption to select a time zone upwards of 150K.  That's an uncomfortably  
large fraction of our STACK_DEPTH_SLOP safety margin, and could result in  
outright crashes if we try to reduce STACK_DEPTH_SLOP as has been discussed  
recently.  Furthermore, this means that the postmaster's peak stack  
consumption is several times that of a backend running typical queries  
(since, except on Windows, backends inherit the timezone GUC values and  
don't ever run this code themselves unless you do SET TIMEZONE).  That's  
completely backwards from a safety perspective.  
  
Hence, adopt the ALL_STATE rather than non-ALL_STATE variant of tzload(),  
while not changing the other code aspects that symbol controls.  The  
risk of an ENOMEM error from malloc() seems less than that of a SIGSEGV  
from stack overrun.  
  
This should probably get back-patched along with 1c1a7cbd6 and followon  
fixes, whenever we decide we have enough confidence in the updates to do  
that.  

M src/timezone/localtime.c

Rename pg_stat_wal_receiver.conn_info to conninfo.

commit   : 60d50769b70ca5030711f70c86d7a2d3bcf34963    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 7 Jul 2016 12:59:39 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 7 Jul 2016 12:59:39 +0900    

Click here for diff

Per discussion on pgsql-hackers, conninfo is better as the column name  
because it's more commonly used in PostgreSQL.  
  
Catalog version bumped due to the change of pg_proc.  
  
Author: Michael Paquier  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/rules.out

Fix typos

commit   : 397bf6eed81bfaacb84065b912a8968a179b4166    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Jul 2016 21:18:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Jul 2016 21:18:03 -0400    

Click here for diff

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

doc: Fix option order in man pages and fix typos

commit   : 9b7bb106e023ced822d5ed4846d445737e54e118    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Jul 2016 21:09:26 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Jul 2016 21:09:26 -0400    

Click here for diff

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

Fix typo in comment.

commit   : 1109164913caf7fa64e75e0b9fa64f7ba5fe5753    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 6 Jul 2016 18:59:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 6 Jul 2016 18:59:17 +0900    

Click here for diff

Author: Masahiko Sawada  

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

Fix failure to handle conflicts in non-arbiter exclusion constraints.

commit   : 9c810a2edccaffe0ff48b50d31c47a155e4f9815    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Jul 2016 16:09:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Jul 2016 16:09:11 -0400    

Click here for diff

ExecInsertIndexTuples treated an exclusion constraint as subject to  
noDupErr processing even when it was not listed in arbiterIndexes, and  
would therefore not error out for a conflict in such a constraint, instead  
returning it as an arbiter-index failure.  That led to an infinite loop in  
ExecInsert, since ExecCheckIndexConstraints ignored the index as-intended  
and therefore didn't throw the expected error.  To fix, make the exclusion  
constraint code path use the same condition as the index_insert call does  
to decide whether no-error-for-duplicates behavior is appropriate.  While  
at it, refactor a little bit to avoid unnecessary list_member_oid calls.  
(That surely wouldn't save anything worth noticing, but I find the code  
a bit clearer this way.)  
  
Per bug report from Heikki Rauhala.  Back-patch to 9.5 where ON CONFLICT  
was introduced.  
  
Report: <[email protected]>  

M src/backend/executor/execIndexing.c
M src/test/regress/expected/insert_conflict.out
M src/test/regress/sql/insert_conflict.sql

Typo fix.

commit   : 29a2195de645759d66ee7e77c4c05b2c4aeb6729    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2016 18:43:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2016 18:43:43 -0400    

Click here for diff

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

Allow RTE_SUBQUERY rels to be considered parallel-safe.

commit   : 110a6dbdebebac9401b43a8fc223e6ec43cd4d10    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2016 18:24:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2016 18:24:49 -0400    

Click here for diff

There isn't really any reason not to; the original comments here were  
partly confused about subplans versus subquery-in-FROM, and partly  
dependent on restrictions that no longer apply now that subqueries return  
Paths not Plans.  Depending on what's inside the subquery, it might fail  
to produce any parallel_safe Paths, but that's fine.  
  
Tom Lane and Robert Haas  

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

Fix up parallel-safety marking for appendrels.

commit   : 4ea9948e58a57316330acb1701f979bc1e872f50    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2016 17:57:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2016 17:57:28 -0400    

Click here for diff

The previous coding assumed that the value derived by  
set_rel_consider_parallel() for an appendrel parent would be accurate for  
all the appendrel's children; but this is not so, for example because one  
child might scan a temp table.  Instead, apply set_rel_consider_parallel()  
to each child rel as well as the parent, and then take the AND of the  
results as controlling parallel safety for the appendrel as a whole.  
  
(We might someday be able to deal more intelligently than this with cases  
in which some of the childrels are parallel-safe and others not, but that's  
for later.)  
  
Robert Haas and Tom Lane  

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

Allow treating TABLESAMPLE scans as parallel-safe.

commit   : 2c6e6471af9f5b6e4d1b25814a86a1dbd2eb928a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2016 16:55:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2016 16:55:27 -0400    

Click here for diff

This was the intention all along, but an extraneous "return;" in  
set_rel_consider_parallel() caused sampled rels to never be marked  
consider_parallel.  
  
Since we don't have any partial tablesample path/plan type yet, there's  
no possibility of parallelizing the sample scan itself; but this fix  
allows such a scan to appear below a parallel join, for example.  

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

Set correct cost data in Gather node added by force_parallel_mode.

commit   : 0e495c5e2f97aa7e2323705a6daed73cdd6c168c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2016 15:35:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2016 15:35:29 -0400    

Click here for diff

We were just leaving the cost fields zeroes, which produces obviously bogus  
output with force_parallel_mode = on.  With force_parallel_mode = regress,  
the zeroes are hidden, but I wonder if they wouldn't still confuse add-on  
code such as auto_explain.  

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

Round rowcount estimate for a partial path to an integer.

commit   : c89d507649df9fbc21617e02ab4d5e765a28b7df    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2016 14:53:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2016 14:53:37 -0400    

Click here for diff

I'd been wondering why I was sometimes seeing fractional rowcount  
estimates in parallel-query situations, and this seems to be the  
reason.  (You won't see the fractional parts in EXPLAIN, because it  
prints rowcounts with %.0f, but they are apparent in the debugger.)  
A fractional rowcount is not any saner for a partial path than any  
other kind of path, and it's equally likely to break cost estimation  
for higher paths, so apply clamp_row_est() like we do in other places.  

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

PL/Python: Report argument parsing errors using exceptions

commit   : 3a4a33ad49e7887b104a29323e4ea625d164a139    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 2 Jul 2016 22:53:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 2 Jul 2016 22:53:14 -0400    

Click here for diff

Instead of calling PLy_elog() for reporting Python argument parsing  
errors, generate appropriate exceptions.  This matches the existing plpy  
functions and is more consistent with the behavior of the Python  
argument parsing routines.  

M src/pl/plpython/expected/plpython_ereport.out
M src/pl/plpython/plpy_plpymodule.c

Fix failure to mark all aggregates with appropriate transtype.

commit   : 420c1661630c96ad10f58ca967d5f561bb404cf9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Jul 2016 13:23:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Jul 2016 13:23:02 -0400    

Click here for diff

In commit 915b703e1 I gave get_agg_clause_costs() the responsibility of  
marking Aggref nodes with the appropriate aggtranstype.  I failed to notice  
that where it was being called from, it might see only a subset of the  
Aggref nodes that were in the original targetlist.  Specifically, if there  
are duplicate aggregate calls in the tlist, either make_sort_input_target  
or make_window_input_target might put just a single instance into the  
grouping_target, and then only that instance would get marked.  Fix by  
moving the call back into grouping_planner(), before we start building  
assorted PathTargets from the query tlist.  Per report from Stefan Huehner.  
  
Report: <[email protected]>  

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

doc: mention dependency on collation libraries

commit   : b54f7a9ac9646845138f6851fdf3097e22daa383    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 2 Jul 2016 11:22:36 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 2 Jul 2016 11:22:36 -0400    

Click here for diff

Document that index storage is dependent on the operating system's  
collation library ordering, and any change in that ordering can create  
invalid indexes.  
  
Discussion: [email protected]  
  
Backpatch-through: 9.1  

M doc/src/sgml/runtime.sgml

Fix some interrelated planner issues with initPlans and Param munging.

commit   : 7b67a0a49c19a566ee735f3b156677dab11bd902    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Jul 2016 20:05:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Jul 2016 20:05:55 -0400    

Click here for diff

In commit 68fa28f77 I tried to teach SS_finalize_plan() to cope with  
initPlans attached anywhere in the plan tree, by dint of moving its  
handling of those into the recursion in finalize_plan().  It turns out that  
that doesn't really work: if a lower-level plan node emits an initPlan  
output parameter in its targetlist, it's legitimate for upper levels to  
reference those Params --- and at the point where this code runs, those  
references look just like the Param itself, so finalize_plan() quite  
properly rejects them as being in the wrong place.  We could lobotomize  
the checks enough to allow that, probably, but then it's not clear that  
we'd have any meaningful check for misplaced Params at all.  What seems  
better, at least in the near term, is to tweak standard_planner() a bit  
so that initPlans are never placed anywhere but the topmost plan node  
for a query level, restoring the behavior that occurred pre-9.6.  Possibly  
we can do better if this code is ever merged into setrefs.c: then it would  
be possible to check a Param's placement only when we'd failed to replace  
it with a Var referencing a child plan node's targetlist.  
  
BTW, I'm now suspicious that finalize_plan is doing the wrong thing by  
returning the node's allParam rather than extParam to be incorporated  
in the parent node's set of used parameters.  However, it makes no  
difference given that initPlans only appear at top level, so I'll leave  
that alone for now.  
  
Another thing that emerged from this is that standard_planner() needs  
to check for initPlans before deciding that it's safe to stick a Gather  
node on top in force_parallel_mode mode.  We previously guarded against  
that by deciding the plan wasn't wholePlanParallelSafe if any subplans  
had been found, but after commit 5ce5e4a12 it's necessary to have this  
substitute test, because path parallel_safe markings don't account for  
initPlans.  (Normally, we'd have decided the paths weren't safe anyway  
due to appearances of SubPlan nodes, Params, or CTE scans somewhere in  
the tree --- but it's possible for those all to be optimized away while  
initPlans still remain.)  
  
Per fuzz testing by Andreas Seltenreich.  
  
Report: <[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/test/regress/expected/portals.out
M src/test/regress/sql/portals.sql

Improve WritebackContextInit() comment and prototype argument names.

commit   : 48bfeb244ff280bad9a81c67442065ae8fcda6b8    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 1 Jul 2016 14:27:53 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 1 Jul 2016 14:27:53 -0700    

Click here for diff

Author: Masahiko Sawada  
Discussion: CAD2[email protected]  

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

Provide and use a makefile target to build all generated headers.

commit   : 548af97fcec5543603c20b61fec60f8147a05b29    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Jul 2016 15:08:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Jul 2016 15:08:55 -0400    

Click here for diff

As of 9.6, pg_regress doesn't build unless storage/lwlocknames.h has been  
created; but there was nothing forcing that to happen if you just went into  
src/test/regress/ and built there.  We previously had a similar complaint  
about plpython.  
  
To fix in a way that won't break next time we invent a generated header,  
make src/backend/Makefile expose a phony target for updating all the  
include files it builds, and invoke that before building pg_regress or  
plpython.  In principle, maybe we ought to invoke that everywhere; but  
it would add a lot of usually-useless make cycles, so let's just do it  
in the places where people have complained.  
  
I made a couple of cosmetic adjustments in src/backend/Makefile as well,  
to deal with the generated headers in consistent orders.  
  
Michael Paquier and Tom Lane  
  
Report: <[email protected]>  
Report: <[email protected]>  

M src/Makefile.global.in
M src/backend/Makefile
M src/pl/plpython/Makefile
M src/test/modules/Makefile
M src/test/regress/GNUmakefile

walreceiver: tweak pg_stat_wal_receiver behavior

commit   : 1bdae16fca884a9190dc330790e7a63c04989fa3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Jul 2016 13:53:46 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Jul 2016 13:53:46 -0400    

Click here for diff

There are two problems in the original coding: one is that if one  
walreceiver process exits, the ready_to_display flag remains set in  
shared memory, exposing the conninfo of the next walreceiver before  
obfuscating.  Fix by having WalRcvDie reset the flag.  
  
Second, the sleep-and-retry behavior that waited until walreceiver had  
set ready_to_display wasn't liked; the preference is to have it return  
no data instead, so let's do that.  
  
Bugs in 9ed551e0a reported by Fujii Masao and Michël Paquier.  
  
Author: Michaël Paquier  

M src/backend/replication/walreceiver.c

Rethink the GetForeignUpperPaths API (again).

commit   : 9e703987a8a1961af8edd751169a8ae1055890eb    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Jul 2016 13:12:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Jul 2016 13:12:34 -0400    

Click here for diff

In the previous design, the GetForeignUpperPaths FDW callback hook was  
called before we got around to labeling upper relations with the proper  
consider_parallel flag; this meant that any upper paths created by an FDW  
would be marked not-parallel-safe.  While that's probably just as well  
right now, we aren't going to want it to be true forever.  Hence, abandon  
the idea that FDWs should be allowed to inject upper paths before the core  
code has gotten around to creating the relevant upper relation.  (Well,  
actually they still can, but it's on their own heads how well it works.)  
Instead, adopt the same API already designed for create_upper_paths_hook:  
we call GetForeignUpperPaths after each upperrel has been created and  
populated with the paths the core planner knows how to make.  

M doc/src/sgml/fdwhandler.sgml
M src/backend/optimizer/README
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/include/foreign/fdwapi.h

Set consider_parallel correctly for upper planner rels.

commit   : 5ce5e4a12ee7175cd3fc356d9d38307e1d715827    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 Jul 2016 11:43:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 Jul 2016 11:43:19 -0400    

Click here for diff

Commit 3fc6e2d7f5b652b417fa6937c34de2438d60fa9f introduced new "upper"  
RelOptInfo structures but didn't set consider_parallel for them  
correctly, a point I completely missed when reviewing it.  Later,  
commit e06a38965b3bcdaa881e7e06892d4d8ab6c2c980 made the situation  
worse by doing it incorrectly for the grouping relation.  Try to  
straighten all of that out.  Along the way, get rid of the annoying  
wholePlanParallelSafe flag, which was only necessarily because of  
the fact that upper planning stages didn't use paths at the time  
that code was written.  
  
The most important immediate impact of these changes is that  
force_parallel_mode will provide useful test coverage in quite a few  
more scenarios than it did previously, but it's also necessary  
preparation for fixing some problems related to subqueries.  
  
Patch by me, reviewed by Tom Lane.  

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/include/nodes/relation.h
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Be more paranoid in ruleutils.c's get_variable().

commit   : 0daeba0e927bfcb3d0ed9d510b84e555fc1e2741    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Jul 2016 11:40:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Jul 2016 11:40:22 -0400    

Click here for diff

We were merely Assert'ing that the Var matched the RTE it's supposedly  
from.  But if the user passes incorrect information to pg_get_expr(),  
the RTE might in fact not match; this led either to Assert failures  
or core dumps, as reported by Chris Hanks in bug #14220.  To fix, just  
convert the Asserts to test-and-elog.  Adjust an existing test-and-elog  
elsewhere in the same function to be consistent in wording.  
  
(If we really felt these were user-facing errors, we might promote them to  
ereport's; but I can't convince myself that they're worth translating.)  
  
Back-patch to 9.3; the problematic code doesn't exist before that, and  
a quick check says that 9.2 doesn't crash on such cases.  
  
Michael Paquier and Thomas Munro  
  
Report: <[email protected]>  

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

postgres_fdw: Fix cache lookup failure while creating error context.

commit   : 86437ddf8c8da6fff49bdf08a22af3460e078eeb    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 Jul 2016 11:29:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 Jul 2016 11:29:25 -0400    

Click here for diff

This is fallout from join pushdown; get_relid_attribute_name can't  
handle an attribute number of 0, indicating a whole-row reference,  
and shouldn't be called in that case.  
  
Etsuro Fujita, reviewed by Ashutosh Bapat  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql

postgres_fdw: Remove schema-qualification from cast to text.

commit   : 5f3499b2b5455a2966faee30fd3f6d2776219858    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 Jul 2016 10:13:06 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 Jul 2016 10:13:06 -0400    

Click here for diff

As pointed out by Ashutosh Bapat, the header comments for this file  
say that schema-qualification is needed for all and only those types  
outside pg_catalog.  pg_catalog.text is not outside pg_catalog.  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out

Fix crash bug in RestoreSnapshot.

commit   : 4f9f495889d3d410195c9891b58228727b340189    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 Jul 2016 08:51:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 Jul 2016 08:51:58 -0400    

Click here for diff

If serialized_snapshot->subxcnt > 0 and serialized_snapshot->xcnt == 0,  
the old coding would do the wrong thing and crash.  This can happen  
on standby servers.  
  
Report by Andreas Seltenreich.  Patch by Thomas Munro, reviewed by  
Amit Kapila and tested by Andreas Seltenreich.  

M src/backend/utils/time/snapmgr.c

Fix several mistakes around parallel workers and client_encoding.

commit   : 10c0558ffefcd12bf1d3dc35587eba41d1ce4571    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 30 Jun 2016 18:35:32 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 30 Jun 2016 18:35:32 -0400    

Click here for diff

Previously, workers sent data to the leader using the client encoding.  
That mostly worked, but the leader the converted the data back to the  
server encoding.  Since not all encoding conversions are reversible,  
that could provoke failures.  Fix by using the database encoding for  
all communication between worker and leader.  
  
Also, while temporary changes to GUC settings, as from the SET clause  
of a function, are in general OK for parallel query, changing  
client_encoding this way inside of a parallel worker is not OK.  
Previously, that would have confused the leader; with these changes,  
it would not confuse the leader, but it wouldn't do anything either.  
So refuse such changes in parallel workers.  
  
Also, the previous code naively assumed that when it received a  
NotifyResonse from the worker, it could pass that directly back to the  
user.  But now that worker-to-leader communication always uses the  
database encoding, that's clearly no longer correct - though,  
actually, the old way was always broken for V2 clients.  So  
disassemble and reconstitute the message instead.  
  
Issues reported by Peter Eisentraut.  Patch by me, reviewed by  
Peter Eisentraut.  

M src/backend/access/transam/parallel.c
M src/backend/commands/async.c
M src/backend/commands/variable.c
M src/backend/libpq/pqformat.c
M src/backend/libpq/pqmq.c
M src/include/commands/async.h
M src/include/libpq/pqformat.h

Fix typo in ReorderBufferIterTXNInit().

commit   : f8c58554db48fe004938a8a34a42afb78157b66c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Jun 2016 12:37:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Jun 2016 12:37:02 -0400    

Click here for diff

This looks like it would cause changes from subtransactions to be missed  
by the iterator being constructed, if those changes had been spilled to  
disk previously.  This implies that large subtransactions might be lost  
(in whole or in part) by logical replication.  Found and fixed by  
Petru-Florin Mihancea, per bug #14208.  
  
Report: <[email protected]>  

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

Dodge compiler bug in Visual Studio 2013.

commit   : 3154e16737ad17b2c63529e3df627bb5eb3bb3be    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Jun 2016 19:07:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Jun 2016 19:07:19 -0400    

Click here for diff

VS2013 apparently has a problem with taking the address of a formal  
parameter in some cases.  We do that elsewhere without trouble, but  
in this case the address is being passed to a subroutine that will  
probably get inlined, so maybe the combination of those things is  
what tickles the bug.  Anyway, introducing an extra copy of the  
parameter value is enough to work around it.  Per trouble report  
from Umair Shahid.  
  
Report: <CAM184Ac[email protected]>  

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

Fix some infelicities in EXPLAIN output for parallel query plans.

commit   : 8ebb69f85445177575684a0ba5cfedda8d840a91    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Jun 2016 18:51:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Jun 2016 18:51:20 -0400    

Click here for diff

In non-text output formats, parallelized aggregates were reporting  
"Partial" or "Finalize" as a field named "Operation", which might be all  
right in the absence of any context --- but other plan node types use that  
field to report SQL-visible semantics, such as Select/Insert/Update/Delete.  
So that naming choice didn't seem good to me.  I changed it to "Partial  
Mode".  
  
Also, the field did not appear at all for a non-parallelized Agg plan node,  
which is contrary to expectation in non-text formats.  We're notionally  
producing objects that conform to a schema, so the set of fields for a  
given node type and EXPLAIN mode should be well-defined.  I set it up to  
fill in "Simple" in such cases.  
  
Other fields that were added for parallel query, namely "Parallel Aware"  
and Gather's "Single Copy", had not gotten the word on that point either.  
Make them appear always in non-text output.  
  
Also, the latter two fields were nominally producing boolean output, but  
were getting it wrong, because bool values shouldn't be quoted in JSON or  
YAML.  Somehow we'd not needed an ExplainPropertyBool formatting subroutine  
before 9.6; but now we do, so invent it.  
  
Discussion: <[email protected]>  

M src/backend/commands/explain.c
M src/include/commands/explain.h
M src/test/regress/expected/insert_conflict.out

Update rules.out to match commit 9ed551e0a.

commit   : 0584df32f577ef05fc2a682a97d3c81387eccdb9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Jun 2016 17:13:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Jun 2016 17:13:29 -0400    

Click here for diff

Per buildfarm.  

M src/test/regress/expected/rules.out

Add conninfo to pg_stat_wal_receiver

commit   : 9ed551e0a4fdb046d8e5ea779adfd3e184d5dc0d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 29 Jun 2016 16:57:17 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 29 Jun 2016 16:57:17 -0400    

Click here for diff

Commit b1a9bad9e744 introduced a stats view to provide insight into the  
running WAL receiver, but neglected to include the connection string in  
it, as reported by Michaël Paquier.  This commit fixes that omission.  
(Any security-sensitive information is not disclosed).  
  
While at it, close the mild security hole that we were exposing the  
password in the connection string in shared memory.  This isn't  
user-accessible, but it still looks like a good idea to avoid having the  
cleartext password in memory.  
  
Author: Michaël Paquier, Álvaro Herrera  
Review by: Vik Fearing  
  
Discussion: https://www.postgresql.org/message-id/CAB7[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/walreceiver.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/replication/walreceiver.h

Fix match_foreign_keys_to_quals for FKs linking to unused rtable entries.

commit   : b32e63506cfec8c8bd3237ec5043de7414564d10    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Jun 2016 16:02:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Jun 2016 16:02:08 -0400    

Click here for diff

Since get_relation_foreign_keys doesn't try to determine whether RTEs  
are actually part of the query semantics, it might make FK info records  
linking to RTEs that won't have a RelOptInfo at all.  Cope with that.  
Per bug #14219 from Andrew Gierth.  
  
Report: <[email protected]>  

M src/backend/optimizer/plan/initsplan.c
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

Adjust text search documentation for recent commits.

commit   : 4242a715c3fca1a8fa31f810b7cffa88b4d4e439    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Jun 2016 15:00:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Jun 2016 15:00:25 -0400    

Click here for diff

Fix some now-obsolete statements that were overlooked in commits  
6734a1cac, 3dbbd0f02, 028350f61.  Document the behavior of <0>.  
Also do a little bit of rearranging and copy-editing for clarity.  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/textsearch.sgml

Fix obsolete comment.

commit   : 8dee039fa1e7b373a20985d80dbe1a5dbfd1eb2b    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Jun 2016 13:12:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Jun 2016 13:12:50 -0400    

Click here for diff

Commit 3bd261ca18c67eafe18088e58fab511e3b965418 should have updated  
this, but didn't.  
  
Extracted from a larger patch by Piotr Stefaniak.  

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

Document precedence of FTS operators in tsquery

commit   : 73e6bea603548810769fd8ac8b19342f759ef07d    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 29 Jun 2016 17:59:36 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 29 Jun 2016 17:59:36 +0300    

Click here for diff

Oleg Bartunov  

M doc/src/sgml/textsearch.sgml

commit   : 8a395e0b9a2118453df3d9c31ddb43f811315ddd    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 28 Jun 2016 16:16:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 28 Jun 2016 16:16:06 -0400    

Click here for diff

Reported-by: Manlio Perillo  
  
Bug: 14016  
  
Discussion: [email protected]  
  
Reviewed-by: David G. Johnston  

M doc/src/sgml/func.sgml
M doc/src/sgml/ref/values.sgml

doc: update effective_io_concurrency for SSDs

commit   : 46eafc8855d7c21e2c1a45faa77a3d5a2fc2c8b2    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 28 Jun 2016 16:09:04 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 28 Jun 2016 16:09:04 -0400    

Click here for diff

SSDs are no longer exotic, so recommend a default in the hundreds for  
them.  

M doc/src/sgml/config.sgml

Remove unused arguments in two GiST subroutines

commit   : b78364df1850a09ece442a138118f4be1a451366    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 28 Jun 2016 16:01:13 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 28 Jun 2016 16:01:13 -0400    

Click here for diff

These arguments became unused in commit 2c03216d8311.  Noticed while  
skimming code for unrelated development.  
  
This is cosmetic, so no backpatch.  

M src/backend/access/gist/gist.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistxlog.c
M src/include/access/gist_private.h

doc: remove GIN vs. GiST performance mention

commit   : 8e1ad1b37c7afdf99815f9ed1ca255264e0b3f9e    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 28 Jun 2016 16:00:40 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 28 Jun 2016 16:00:40 -0400    

Click here for diff

This is a followup to commit 6d8b2aa83af70e20323caf23961667dc4c149276.  

M doc/src/sgml/intarray.sgml
M doc/src/sgml/pgtrgm.sgml

doc: in binary mode mention, say "encoding conversion"

commit   : 69769a3a6e7c09270aba3094d3ff6df771adf977    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 28 Jun 2016 14:21:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 28 Jun 2016 14:21:43 -0400    

Click here for diff

Used to say "character set conversion"  
  
Reported-by: Tatsuo Ishii  
  
Discussion: [email protected]  

M doc/src/sgml/datatype.sgml

doc: remove mention of UT1 in representing time

commit   : 675684fc23fd4287966694b1f108846bc14b6895    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 28 Jun 2016 13:49:37 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 28 Jun 2016 13:49:37 -0400    

Click here for diff

UT1 was incorrectly specified as our time representation.  (UT1 is  
astronomical time.)  We are not actually UTC either because we ignore  
leap seconds.  
  
Reported-by: Thomas Munro  
  
Discussion: CAEe[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml

Don't apply sortgroupref labels to a tlist that might not match.

commit   : c12f02ffc94faac09eae254b3bf114c153f116f6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Jun 2016 10:43:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Jun 2016 10:43:11 -0400    

Click here for diff

If we need to use a gating Result node for pseudoconstant quals,  
create_scan_plan() intentionally suppresses use_physical_tlist's checks  
on whether there are matches for sortgroupref labels, on the grounds that  
we don't need matches because we can label the Result's projection output  
properly.  However, it then called apply_pathtarget_labeling_to_tlist  
anyway.  This oversight was harmless when written, but in commit aeb9ae645  
I made that function throw an error if there was no match.  Thus, the  
combination of a table scan, pseudoconstant quals, and a non-simple-Var  
sortgroupref column threw the dreaded "ORDER/GROUP BY expression not found  
in targetlist" error.  To fix, just skip applying the labeling in this  
case.  Per report from Rushabh Lathia.  
  
Report: <CAGPqQf2[email protected]>  

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

Fix mistakes in pg_visibility documentation.

commit   : 957616dbaef0e7f182e6260483bca79a38ae247f    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 27 Jun 2016 17:54:28 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 27 Jun 2016 17:54:28 -0400    

Click here for diff

Michael Paquier  

M doc/src/sgml/pgvisibility.sgml

Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan the query.

commit   : 874fe3aea121b4ceb186d59ba6956e2f7d5aa0bb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Jun 2016 15:57:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Jun 2016 15:57:21 -0400    

Click here for diff

Previously, these commands always planned the given query and went through  
executor startup before deciding not to actually run the query if WITH NO  
DATA is specified.  This behavior is problematic for pg_dump because it  
may cause errors to be raised that we would rather not see before a  
REFRESH MATERIALIZED VIEW command is issued.  See for example bug #13907  
from Marian Krucina.  This change is not sufficient to fix that particular  
bug, because we also need to tweak pg_dump to issue the REFRESH later,  
but it's a necessary step on the way.  
  
A user-visible side effect of doing things this way is that the returned  
command tag for WITH NO DATA cases will now be "CREATE MATERIALIZED VIEW"  
or "CREATE TABLE AS", not "SELECT 0".  We could preserve the old behavior  
but it would take more code, and arguably that was just an implementation  
artifact not intended behavior anyhow.  
  
In 9.5 and HEAD, also get rid of the static variable CreateAsReladdr, which  
was trouble waiting to happen; there is not any prohibition on nested  
CREATE commands.  
  
Back-patch to 9.3 where CREATE MATERIALIZED VIEW was introduced.  
  
Michael Paquier and Tom Lane  
  
Report: <[email protected]>  

M src/backend/commands/createas.c
M src/backend/commands/view.c
M src/backend/nodes/makefuncs.c
M src/include/nodes/makefuncs.h
M src/test/regress/expected/matview.out
M src/test/regress/expected/select_into.out
M src/test/regress/sql/matview.sql
M src/test/regress/sql/select_into.sql

Change predecence of phrase operator.

commit   : 6734a1cacd44f5b731933cbc93182b135b167d0c    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 27 Jun 2016 20:55:24 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 27 Jun 2016 20:55:24 +0300    

Click here for diff

<-> operator now have higher predecence than & (AND) operator. This change  
was motivated by unexpected difference of similar queries:  
'a & b <-> c'::tsquery and 'b <-> c & a'. Before first query means  
(a & b) <-> c and second one - '(b <-> c) & a', now phrase operator evaluates  
first.  
  
Per suggestion from Tom Lane [email protected]  

M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/include/tsearch/ts_type.h
M src/test/regress/expected/tsdicts.out
M src/test/regress/expected/tsearch.out
M src/test/regress/expected/tstypes.out

Do not fallback to AND for FTS phrase operator.

commit   : 3dbbd0f02a257d8d5c4cba14726371505f2e7266    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 27 Jun 2016 20:47:32 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 27 Jun 2016 20:47:32 +0300    

Click here for diff

If there is no positional information of lexemes then phrase operator will not  
fallback to AND operator. This change makes needing to modify TS_execute()  
interface, because somewhere (in indexes, for example) positional information  
is unaccesible and in this cases we need to force fallback to AND.  
  
Per discussion [email protected]  

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

Make exact distance match for FTS phrase operator

commit   : 028350f619f7688e0453fcd2c4b25abe9ba30fa7    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 27 Jun 2016 20:41:00 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 27 Jun 2016 20:41:00 +0300    

Click here for diff

Phrase operator now requires exact distance betweens lexems instead of  
less-or-equal.  
  
Per discussion [email protected]  

M doc/src/sgml/textsearch.sgml
M src/backend/utils/adt/tsvector_op.c
M src/test/regress/expected/tstypes.out
M src/test/regress/sql/tstypes.sql

Avoid making a separate pass over the query to check for partializability.

commit   : f1993038a4f0ce5fbeb7b562b2acd571bf6b567b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Jun 2016 15:55:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Jun 2016 15:55:01 -0400    

Click here for diff

It's rather silly to make a separate pass over the tlist + HAVING qual,  
and a separate set of visits to the syscache, when get_agg_clause_costs  
already has all the required information in hand.  This nets out as less  
code as well as fewer cycles.  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/clauses.c
M src/include/nodes/relation.h
M src/include/optimizer/clauses.h

Rethink node-level representation of partial-aggregation modes.

commit   : 19e972d5580c655423572e3c870e47b5b7c346f6    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Jun 2016 14:33:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Jun 2016 14:33:38 -0400    

Click here for diff

The original coding had three separate booleans representing partial  
aggregation behavior, which was confusing, unreadable, and error-prone,  
not least because the booleans weren't always listed in the same order.  
It was also inadequate for the allegedly-desirable future extension to  
support intermediate partial aggregation, because we'd need separate  
markers for serialization and deserialization in such a case.  
  
Merge these bools into an enum "AggSplit" to provide symbolic names for  
the supported operating modes (and document what those are).  By assigning  
the values of the enum constants carefully, we can treat AggSplit values  
as options bitmasks so that tests of what to do aren't noticeably more  
expensive than before.  
  
While at it, get rid of Aggref.aggoutputtype.  That's not needed since  
commit 59a3795c2 got rid of setrefs.c's special-purpose Aggref comparison  
code, and it likewise seemed more confusing than helpful.  
  
Assorted comment cleanup as well (there's still more that I want to do  
in that line).  
  
catversion bump for change in Aggref node contents.  Should be the last  
one for partial-aggregation changes.  
  
Discussion: <[email protected]>  

M src/backend/commands/explain.c
M src/backend/executor/execQual.c
M src/backend/executor/nodeAgg.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/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/parse_func.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/relation.h
M src/include/optimizer/clauses.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h

Simplify planner's final setup of Aggrefs for partial aggregation.

commit   : 59a3795c2589a0e6dfe4d9a886de9423b3f8b057    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Jun 2016 12:08:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Jun 2016 12:08:12 -0400    

Click here for diff

Commit e06a38965's original coding for constructing the execution-time  
expression tree for a combining aggregate was rather messy, involving  
duplicating quite a lot of code in setrefs.c so that it could inject  
a nonstandard matching rule for Aggrefs.  Get rid of that in favor of  
explicitly constructing a combining Aggref with a partial Aggref as input,  
then allowing setref's normal matching logic to match the partial Aggref  
to the output of the lower plan node and hence replace it with a Var.  
  
In passing, rename and redocument make_partialgroup_input_target to have  
some connection to what it actually does.  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/tlist.c
M src/include/optimizer/planner.h
M src/include/optimizer/tlist.h

Fix handling of multixacts predating pg_upgrade

commit   : e3ad3ffa68193dd889a9cea9d840bf4613bd680b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 24 Jun 2016 18:29:28 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 24 Jun 2016 18:29:28 -0400    

Click here for diff

After pg_upgrade, it is possible that some tuples' Xmax have multixacts  
corresponding to the old installation; such multixacts cannot have  
running members anymore.  In many code sites we already know not to read  
them and clobber them silently, but at least when VACUUM tries to freeze  
a multixact or determine whether one needs freezing, there's an attempt  
to resolve it to its member transactions by calling GetMultiXactIdMembers,  
and if the multixact value is "in the future" with regards to the  
current valid multixact range, an error like this is raised:  
    ERROR:  MultiXactId 123 has not been created yet -- apparent wraparound  
and vacuuming fails.  Per discussion with Andrew Gierth, it is completely  
bogus to try to resolve multixacts coming from before a pg_upgrade,  
regardless of where they stand with regards to the current valid  
multixact range.  
  
It's possible to get from under this problem by doing SELECT FOR UPDATE  
of the problem tuples, but if tables are large, this is slow and  
tedious, so a more thorough solution is desirable.  
  
To fix, we realize that multixacts in xmax created in 9.2 and previous  
have a specific bit pattern that is never used in 9.3 and later (we  
already knew this, per comments and infomask tests sprinkled in various  
places, but we weren't leveraging this knowledge appropriately).  
Whenever the infomask of the tuple matches that bit pattern, we just  
ignore the multixact completely as if Xmax wasn't set; or, in the case  
of tuple freezing, we act as if an unwanted value is set and clobber it  
without decoding.  This guarantees that no errors will be raised, and  
that the values will be progressively removed until all tables are  
clean.  Most callers of GetMultiXactIdMembers are patched to recognize  
directly that the value is a removable "empty" multixact and avoid  
calling GetMultiXactIdMembers altogether.  
  
To avoid changing the signature of GetMultiXactIdMembers() in back  
branches, we keep the "allow_old" boolean flag but rename it to  
"from_pgupgrade"; if the flag is true, we always return an empty set  
instead of looking up the multixact.  (I suppose we could remove the  
argument in the master branch, but I chose not to do so in this commit).  
  
This was broken all along, but the error-facing message appeared first  
because of commit 8e9a16ab8f7f and was partially fixed in a25c2b7c4db3.  
This fix, backpatched all the way back to 9.3, goes approximately in the  
same direction as a25c2b7c4db3 but should cover all cases.  
  
Bug analysis by Andrew Gierth and Álvaro Herrera.  
  
A number of public reports match this bug:  
  https://www.postgresql.org/message-id/[email protected]  
  https://www.postgresql.org/message-id/[email protected]  
  https://www.postgresql.org/message-id/[email protected]  
  https://www.postgresql.org/message-id/SG2PR06MB0760098A[email protected]  
  https://www.postgresql.org/message-id/[email protected]  

M contrib/pgrowlocks/pgrowlocks.c
M src/backend/access/heap/heapam.c
M src/backend/access/transam/multixact.c
M src/backend/utils/time/tqual.c
M src/include/access/htup_details.h

Fix building of large (bigger than shared_buffers) hash indexes.

commit   : 8cf739de850f596777be14aeb430359cf59cf47c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Jun 2016 16:57:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Jun 2016 16:57:36 -0400    

Click here for diff

When the index is predicted to need more than NBuffers buckets,  
CREATE INDEX attempts to sort the index entries by hash key before  
insertion, so as to reduce thrashing.  This code path got broken by  
commit 9f03ca915196dfc8, which overlooked that _hash_form_tuple() is not  
just an alias for index_form_tuple().  The index got built anyway, but  
with garbage data, so that searches for pre-existing tuples always  
failed.  Fix by refactoring to separate construction of the indexable  
data from calling index_form_tuple().  
  
Per bug #14210 from Daniel Newman.  Back-patch to 9.5 where the  
bug was introduced.  
  
Report: <[email protected]>  

M src/backend/access/hash/hash.c
M src/backend/access/hash/hashutil.c
M src/include/access/hash.h

postgres_fdw: Fix incorrect NULL handling in join pushdown.

commit   : 9e9c38e15947f4f3ed478f8b70e74b55e31fe950    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 24 Jun 2016 15:06:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 24 Jun 2016 15:06:19 -0400    

Click here for diff

something.* IS NOT NULL means that every attribute of the row is not  
NULL, not that the row itself is non-NULL (e.g. because it's coming  
from below an outer join.  Use (somevar.*)::pg_catalog.text IS NOT  
NULL instead.  
  
Ashutosh Bapat, per a report by Rushabh Lathia.  Reviewed by  
Amit Langote and Etsuro Fujita.  Schema-qualification added by me.  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql

postgres_fdw: Remove useless return statement.

commit   : 267569b24c1782b756cad46ffc8e9b28988e7385    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 24 Jun 2016 14:32:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 24 Jun 2016 14:32:11 -0400    

Click here for diff

Etsuro Fujita  

M contrib/postgres_fdw/deparse.c

psql: Improve \crosstabview error messages

commit   : bd406af16841384b100c783a5cb36923eec6df6d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 24 Jun 2016 01:08:08 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 24 Jun 2016 01:08:08 -0400    

Click here for diff

M src/bin/psql/crosstabview.c
M src/test/regress/expected/psql_crosstab.out

Add tab completion for pager_min_lines to psql.

commit   : 562e44972490196884452e632a0a6d0db81b2335    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 23 Jun 2016 16:10:15 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 23 Jun 2016 16:10:15 -0400    

Click here for diff

This was inadvertantly omitted from commit  
7655f4ccea570d57c4d473cd66b755c03c904942. Mea culpa.  
  
Backpatched to 9.5 where pager_min_lines was introduced.  

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

Fix small memory leak in partial-aggregate deserialization functions.

commit   : bd1693e89e7e6c458d0563f6cc67a7c99a45251a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Jun 2016 10:55:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Jun 2016 10:55:59 -0400    

Click here for diff

A deserialize function's result is short-lived data during partial  
aggregation, since we're just going to pass it to the combine function  
and then it's of no use anymore.  However, the built-in deserialize  
functions allocated their results in the aggregate state context,  
resulting in a query-lifespan memory leak.  It's probably not possible for  
this to amount to anything much at present, since the number of leaked  
results would only be the number of worker processes.  But it might become  
a problem in future.  To fix, don't use the same convenience subroutine for  
setting up results that the aggregate transition functions use.  
  
David Rowley  
  
Report: <[email protected]>  

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

Improve user-facing documentation for partial/parallel aggregation.

commit   : 2d673424faf3e33c5fcca926fbe3f21e16dd0fef    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 Jun 2016 19:14:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 Jun 2016 19:14:16 -0400    

Click here for diff

Add a section to xaggr.sgml, as we have done in the past for other  
extensions to the aggregation functionality.  Assorted wordsmithing  
and other minor improvements.  
  
David Rowley and Tom Lane  

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

Update oidjoins regression test for 9.6.

commit   : 63ae052367c350935c3cec3e3c53a1e34a317e96    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 Jun 2016 17:12:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 Jun 2016 17:12:55 -0400    

Click here for diff

Looks like we had some more catalog drift recently.  

M src/test/regress/expected/oidjoins.out
M src/test/regress/sql/oidjoins.sql
M src/tools/findoidjoins/README

Fix type-safety problem with parallel aggregate serial/deserialization.

commit   : f8ace5477ef9731ef605f58d313c4cd1548f12d2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 Jun 2016 16:52:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 Jun 2016 16:52:41 -0400    

Click here for diff

The original specification for this called for the deserialization function  
to have signature "deserialize(serialtype) returns transtype", which is a  
security violation if transtype is INTERNAL (which it always would be in  
practice) and serialtype is not (which ditto).  The patch blithely overrode  
the opr_sanity check for that, which was sloppy-enough work in itself,  
but the indisputable reason this cannot be allowed to stand is that CREATE  
FUNCTION will reject such a signature and thus it'd be impossible for  
extensions to create parallelizable aggregates.  
  
The minimum fix to make the signature type-safe is to add a second, dummy  
argument of type INTERNAL.  But to lock it down a bit more and make misuse  
of INTERNAL-accepting functions less likely, let's get rid of the ability  
to specify a "serialtype" for an aggregate and just say that the only  
useful serialtype is BYTEA --- which, in practice, is the only interesting  
value anyway, due to the usefulness of the send/recv infrastructure for  
this purpose.  That means we only have to allow "serialize(internal)  
returns bytea" and "deserialize(bytea, internal) returns internal" as  
the signatures for these support functions.  
  
In passing fix bogus signature of int4_avg_combine, which I found thanks  
to adding an opr_sanity check on combinefunc signatures.  
  
catversion bump due to removing pg_aggregate.aggserialtype and adjusting  
signatures of assorted built-in functions.  
  
David Rowley and Tom Lane  
  
Discussion: <[email protected]>  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/create_aggregate.sgml
M src/backend/catalog/pg_aggregate.c
M src/backend/commands/aggregatecmds.c
M src/backend/executor/nodeAgg.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/tlist.c
M src/backend/parser/parse_agg.c
M src/backend/utils/adt/numeric.c
M src/bin/pg_dump/pg_dump.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_proc.h
M src/include/parser/parse_agg.h
M src/test/regress/expected/create_aggregate.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/create_aggregate.sql
M src/test/regress/sql/opr_sanity.sql

Make "postgres -C guc" print "" not "(null)" for null-valued GUCs.

commit   : e45e990e4b547f05bdb46e4596d24abbaef60043    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 Jun 2016 11:55:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 Jun 2016 11:55:18 -0400    

Click here for diff

Commit 0b0baf262 et al made this case print "(null)" on the grounds that  
that's what happened on platforms that didn't crash.  But neither behavior  
was actually intentional.  What we should print is just an empty string,  
for compatibility with the behavior of SHOW and other ways of examining  
string GUCs.  Those code paths don't distinguish NULL from empty strings,  
so we should not here either.  Per gripe from Alain Radix.  
  
Like the previous patch, back-patch to 9.2 where -C option was introduced.  
  
Discussion: <CA+Ydpwx[email protected]>  

M src/backend/postmaster/postmaster.c

Improve cleanup in rolenames test

commit   : 6a9c51810f1db08de4033cbecd95a83d7b364fd1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Jun 2016 21:52:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Jun 2016 21:52:35 -0400    

Click here for diff

Drop test_schema at the end, because that otherwise interferes with the  
collate.linux.utf8 test.  

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

Update comment about allowing GUCs to change scanning.

commit   : 3e9df858f0de5f1a37c71f24373caf8c870f6993    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 21 Jun 2016 20:23:20 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 21 Jun 2016 20:23:20 -0400    

Click here for diff

Reported-by: David G. Johnston  
  
Discussion: CAKF[email protected]  

M src/backend/parser/scan.l

Document that dependency tracking doesn't consider function bodies.

commit   : 342921078a76a34fd2f44f121f225126778eb2cb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Jun 2016 20:07:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Jun 2016 20:07:58 -0400    

Click here for diff

If there's anyplace in our SGML docs that explains this behavior, I can't  
find it right at the moment.  Add an explanation in "Dependency Tracking"  
which seems like the authoritative place for such a discussion.  Per  
gripe from Michelle Schwan.  
  
While at it, update this section's example of a dependency-related  
error message: they last looked like that in 8.3.  And remove the  
explanation of dependency updates from pre-7.3 installations, which  
is probably no longer worth anybody's brain cells to read.  
  
The bogus error message example seems like an actual documentation bug,  
so back-patch to all supported branches.  
  
Discussion: <[email protected]>  

M doc/src/sgml/ddl.sgml

Refactor planning of projection steps that don't need a Result plan node.

commit   : 8b9d323cb9810109e3e5aab1ead427cbbb7aa77e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Jun 2016 18:38:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Jun 2016 18:38:20 -0400    

Click here for diff

The original upper-planner-pathification design (commit 3fc6e2d7f5b652b4)  
assumed that we could always determine during Path formation whether or not  
we would need a Result plan node to perform projection of a targetlist.  
That turns out not to work very well, though, because createplan.c still  
has some responsibilities for choosing the specific target list associated  
with sorting/grouping nodes (in particular it might choose to add resjunk  
columns for sorting).  We might not ever refactor that --- doing so would  
push more work into Path formation, which isn't attractive --- and we  
certainly won't do so for 9.6.  So, while create_projection_path and  
apply_projection_to_path can tell for sure what will happen if the subpath  
is projection-capable, they can't tell for sure when it isn't.  This is at  
least a latent bug in apply_projection_to_path, which might think it can  
apply a target to a non-projecting node when the node will end up computing  
something different.  
  
Also, I'd tied the creation of a ProjectionPath node to whether or not a  
Result is needed, but it turns out that we sometimes need a ProjectionPath  
node anyway to avoid modifying a possibly-shared subpath node.  Callers had  
to use create_projection_path for such cases, and we added code to them  
that knew about the potential omission of a Result node and attempted to  
adjust the cost estimates for that.  That was uncertainly correct and  
definitely ugly/unmaintainable.  
  
To fix, have create_projection_path explicitly check whether a Result  
is needed and adjust its cost estimate accordingly, though it creates  
a ProjectionPath in either case.  apply_projection_to_path is now mostly  
just an optimized version that can avoid creating an extra Path node when  
the input is known to not be shared with any other live path.  (There  
is one case that create_projection_path doesn't handle, which is pushing  
parallel-safe expressions below a Gather node.  We could make it do that  
by duplicating the GatherPath, but there seems no need as yet.)  
  
create_projection_plan still has to recheck the tlist-match condition,  
which means that if the matching situation does get changed by createplan.c  
then we'll have made a slightly incorrect cost estimate.  But there seems  
no help for that in the near term, and I doubt it occurs often enough,  
let alone would change planning decisions often enough, to be worth  
stressing about.  
  
I added a "dummypp" field to ProjectionPath to track whether  
create_projection_path thinks a Result is needed.  This is not really  
necessary as-committed because create_projection_plan doesn't look at the  
flag; but it seems like a good idea to remember what we thought when  
forming the cost estimate, if only for debugging purposes.  
  
In passing, get rid of the target_parallel parameter added to  
apply_projection_to_path by commit 54f5c5150.  I don't think that's a good  
idea because it involves callers in what should be an internal decision,  
and opens us up to missing optimization opportunities if callers think they  
don't need to provide a valid flag, as most don't.  For the moment, this  
just costs us an extra has_parallel_hazard call when planning a Gather.  
If that starts to look expensive, I think a better solution would be to  
teach PathTarget to carry/cache knowledge of parallel-safety of its  
contents.  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h

Stamp 9.6beta2.

commit   : 936b62ddf247c26e8cc4fca34bd8a4c2e65c09fd    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Jun 2016 16:23:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Jun 2016 16:23:47 -0400    

Click here for diff

M configure
M configure.in
M doc/bug.template
M src/include/pg_config.h.win32

Add missing check for malloc failure in plpgsql_extra_checks_check_hook().

commit   : 1fe1204e87c467221277d1789f1a530a27e15bd2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Jun 2016 15:36:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Jun 2016 15:36:54 -0400    

Click here for diff

Per report from Andreas Seltenreich.  Back-patch to affected versions.  
  
Report: <[email protected]>  

M src/pl/plpgsql/src/pl_handler.c

pg_trgm's set_limit() function is parallel unsafe, not parallel restricted.

commit   : e611515dd6b8edad56baa0f3ae31ff637ca54d52    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Jun 2016 11:29:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Jun 2016 11:29:47 -0400    

Click here for diff

Per buildfarm.  Fortunately, it's not quite too late to squeeze this fix  
into the pg_trgm 1.3 update.  

M contrib/pg_trgm/pg_trgm–1.2–1.3.sql
M contrib/pg_trgm/pg_trgm–1.3.sql

docs: clarify use of pg_rewind arguments

commit   : 3557b1791b715c6e44e1b7b4b342d1fae54e262e    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 20 Jun 2016 11:09:21 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 20 Jun 2016 11:09:21 -0400    

Click here for diff

Specifically, --source-pgdata and --source-server.  
  
Discussion: [email protected]  
  
Reviewed-by: Michael Paquier  

M doc/src/sgml/ref/pg_rewind.sgml

Fix comparison of similarity to threshold in GIST trigram searches.

commit   : 9c852566a3cf4ede40e22e4ca216d12cd4a27117    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Jun 2016 10:49:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Jun 2016 10:49:19 -0400    

Click here for diff

There was some very strange code here, dating to commit b525bf77, that  
purported to work around an ancient gcc bug by forcing a float4 comparison  
to be done as int instead.  Commit 5871b8848 broke that when it changed  
one side of the comparison to "double" but left the comparison code alone.  
Commit f576b17cd doubled down on the weirdness by introducing a "volatile"  
marker, which had nothing to do with the actual problem.  
  
Guess that the gcc bug, even if it's still present in the wild, was  
triggered by comparison of float4's and can be avoided if we store the  
result of cnt_sml() into a double before comparing to the double "nlimit".  
This will at least work correctly on non-broken compilers, and it's way  
more readable.  
  
Per bug #14202 from Greg Navis.  Add a regression test based on his  
example.  
  
Report: <[email protected]>  

M contrib/pg_trgm/expected/pg_trgm.out
M contrib/pg_trgm/sql/pg_trgm.sql
M contrib/pg_trgm/trgm_gist.c

Translation updates

commit   : 47981a4665dfc9c3808366dff9971daedba32e98    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 20 Jun 2016 09:48:08 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 20 Jun 2016 09:48:08 -0400    

Click here for diff

Source-Git-URL: git://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: 0c374f8d25ed31833a10d24252bc928d41438838  

M src/backend/po/de.po
M src/backend/po/fr.po
M src/backend/po/ru.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/ru.po
M src/bin/initdb/po/zh_CN.po
M src/bin/pg_basebackup/po/es.po
M src/bin/pg_basebackup/po/ru.po
M src/bin/pg_basebackup/po/zh_CN.po
M src/bin/pg_config/po/es.po
M src/bin/pg_config/po/ru.po
M src/bin/pg_controldata/po/es.po
M src/bin/pg_controldata/po/ru.po
M src/bin/pg_controldata/po/zh_CN.po
M src/bin/pg_ctl/po/es.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_dump/po/es.po
M src/bin/pg_dump/po/ru.po
M src/bin/pg_dump/po/zh_CN.po
M src/bin/pg_resetxlog/po/es.po
M src/bin/pg_resetxlog/po/ru.po
M src/bin/pg_resetxlog/po/zh_CN.po
M src/bin/pg_rewind/po/de.po
M src/bin/pg_rewind/po/es.po
M src/bin/pg_rewind/po/ru.po
M src/bin/pg_rewind/po/zh_CN.po
M src/bin/psql/po/de.po
M src/bin/psql/po/ru.po
M src/bin/psql/po/zh_CN.po
M src/bin/scripts/po/es.po
M src/bin/scripts/po/pt_BR.po
M src/bin/scripts/po/ru.po
M src/bin/scripts/po/sv.po
M src/bin/scripts/po/zh_CN.po
M src/interfaces/libpq/po/ru.po
M src/interfaces/libpq/po/zh_CN.po
M src/pl/plperl/po/es.po
M src/pl/plperl/po/ru.po
M src/pl/plperl/po/zh_CN.po
M src/pl/plpgsql/src/po/es.po
M src/pl/plpgsql/src/po/zh_CN.po
M src/pl/plpython/po/es.po
M src/pl/plpython/po/ru.po
M src/pl/plpython/po/zh_CN.po

Add missing documentation of pg_roles.rolbypassrls

commit   : 4d48adc2b8c9724973334345e2ab8f3e6737ac34    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 20 Jun 2016 10:29:20 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 20 Jun 2016 10:29:20 +0200    

Click here for diff

Noted by Lukas Fittl  

M doc/src/sgml/catalogs.sgml

Docs: improve description of psql's %R prompt escape sequence.

commit   : 705ad7f3b523acae0ddfdebd270b7048b2bb8029    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 Jun 2016 13:11:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 Jun 2016 13:11:40 -0400    

Click here for diff

Dilian Palauzov pointed out in bug #14201 that the docs failed to mention  
the possibility of %R producing '(' due to an unmatched parenthesis.  
  
He proposed just adding that in the same style as the other options were  
listed; but it seemed to me that the sentence was already nearly  
unintelligible, so I rewrote it a bit more extensively.  
  
Report: <[email protected]>  

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

Improve error message annotation for GRANT/REVOKE on untrusted PLs.

commit   : 9bc3332372f9992875d80f856fd98999e070fe35    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Jun 2016 19:38:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Jun 2016 19:38:59 -0400    

Click here for diff

The annotation for "ERROR: language "foo" is not trusted" used to say  
"HINT: Only superusers can use untrusted languages", which was fairly  
poorly thought out.  For one thing, it's not a hint about what to do,  
but a statement of fact, which makes it errdetail.  But also, this  
fails to clarify things much, because there's a missing step in the  
chain of reasoning.  I think it's more useful to say "GRANT and REVOKE  
are not allowed on untrusted languages, because only superusers can use  
untrusted languages".  
  
It's been like this for a long time, but given the lack of previous  
complaints, I don't think this is worth back-patching.  
  
Discussion: <[email protected]>  

M src/backend/catalog/aclchk.c
M src/test/regress/expected/privileges.out

Update 9.6 release notes through today.

commit   : a3f42e85464c4e6ed87a74d8903923e2bd734e0c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Jun 2016 18:05:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Jun 2016 18:05:27 -0400    

Click here for diff

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

Restore foreign-key-aware estimation of join relation sizes.

commit   : 100340e2dcd05d6505082a8fe343fb2ef2fa5b2a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Jun 2016 15:22:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Jun 2016 15:22:34 -0400    

Click here for diff

This patch provides a new implementation of the logic added by commit  
137805f89 and later removed by 77ba61080.  It differs from the original  
primarily in expending much less effort per joinrel in large queries,  
which it accomplishes by doing most of the matching work once per query not  
once per joinrel.  Hopefully, it's also less buggy and better commented.  
The never-documented enable_fkey_estimates GUC remains gone.  
  
There remains work to be done to make the selectivity estimates account  
for nulls in FK referencing columns; but that was true of the original  
patch as well.  We may be able to address this point later in beta.  
In the meantime, any error should be in the direction of overestimating  
rather than underestimating joinrel sizes, which seems like the direction  
we want to err in.  
  
Tomas Vondra and Tom Lane  
  
Discussion: <[email protected]>  

M src/backend/nodes/copyfuncs.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/plan/analyzejoins.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/backend/utils/cache/relcache.c
M src/include/nodes/nodes.h
M src/include/nodes/relation.h
M src/include/optimizer/cost.h
M src/include/optimizer/paths.h
M src/include/optimizer/planmain.h
M src/include/utils/rel.h
M src/include/utils/relcache.h

Still another try at fixing scanjoin_target insertion into parallel plans.

commit   : 598aa194af2fb7f294ae4b029494a134a44be333    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Jun 2016 00:28:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Jun 2016 00:28:51 -0400    

Click here for diff

The previous code neglected the fact that the scanjoin_target might  
carry sortgroupref labelings that we need to absorb.  Instead, do  
create_projection_path() unconditionally, and tweak the path's cost  
estimate after the fact.  (I'm now convinced that we ought to refactor  
the way we account for sometimes not needing a separate projection step,  
but right now is not the time for that sort of cleanup.)  
  
Problem identified by Amit Kapila, patch by me.  

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

Fix parallel-safety markings for contrib/dblink.

commit   : 7e81a18d49f2ffc3397bde2660b255b56d8a6d77    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Jun 2016 23:08:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Jun 2016 23:08:21 -0400    

Click here for diff

As shown by buildfarm reports, dblink_build_sql_insert and  
dblink_build_sql_update are *not* parallel safe, because they  
may attempt to access temporary tables of the local session.  
  
Although dblink_build_sql_delete doesn't actually touch the  
contents of the referenced table, it seems consistent and prudent  
to mark it PARALLEL RESTRICTED too.  

M contrib/dblink/dblink–1.1–1.2.sql
M contrib/dblink/dblink–1.2.sql

Fix handling of argument and result datatypes for partial aggregation.

commit   : 915b703e169c38573591e69ae3939a7bf25e90d2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Jun 2016 21:44:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Jun 2016 21:44:37 -0400    

Click here for diff

When doing partial aggregation, the args list of the upper (combining)  
Aggref node is replaced by a Var representing the output of the partial  
aggregation steps, which has either the aggregate's transition data type  
or a serialized representation of that.  However, nodeAgg.c blindly  
continued to use the args list as an indication of the user-level argument  
types.  This broke resolution of polymorphic transition datatypes at  
executor startup (though it accidentally failed to fail for the ANYARRAY  
case, which is likely the only one anyone had tested).  Moreover, the  
constructed FuncExpr passed to the finalfunc contained completely wrong  
information, which would have led to bogus answers or crashes for any case  
where the finalfunc examined that information (which is only likely to be  
with polymorphic aggregates using a non-polymorphic transition type).  
  
As an independent bug, apply_partialaggref_adjustment neglected to resolve  
a polymorphic transition datatype before assigning it as the output type  
of the lower-level Aggref node.  This again accidentally failed to fail  
for ANYARRAY but would be unlikely to work in other cases.  
  
To fix the first problem, record the user-level argument types in a  
separate OID-list field of Aggref, and look to that rather than the args  
list when asking what the argument types were.  (It turns out to be  
convenient to include any "direct" arguments in this list too, although  
those are not currently subject to being overwritten.)  
  
Rather than adding yet another resolve_aggregate_transtype() call to fix  
the second problem, add an aggtranstype field to Aggref, and store the  
resolved transition type OID there when the planner first computes it.  
(By doing this in the planner and not the parser, we can allow the  
aggregate's transition type to change from time to time, although no DDL  
support yet exists for that.)  This saves nothing of consequence for  
simple non-polymorphic aggregates, but for polymorphic transition types  
we save a catalog lookup during executor startup as well as several  
planner lookups that are new in 9.6 due to parallel query planning.  
  
In passing, fix an error that was introduced into count_agg_clauses_walker  
some time ago: it was applying exprTypmod() to something that wasn't an  
expression node at all, but a TargetEntry.  exprTypmod silently returned  
-1 so that there was not an obvious failure, but this broke the intended  
sensitivity of aggregate space consumption estimates to the typmod of  
varchar and similar data types.  This part needs to be back-patched.  
  
Catversion bump due to change of stored Aggref nodes.  
  
Discussion: <[email protected]>  

M src/backend/executor/nodeAgg.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/plan/setrefs.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/tlist.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_func.c
M src/include/catalog/catversion.h
M src/include/nodes/primnodes.h

Docs typo fix.

commit   : d30d1acf904b823a7cca59e5d403ae3b299773e9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Jun 2016 18:23:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Jun 2016 18:23:39 -0400    

Click here for diff

Guillaume Lelarge  

M doc/src/sgml/catalogs.sgml

Finish up XLOG_HINT renaming

commit   : 1ca4a1b5d2c633d33161792af1c70e397f879ed9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 17 Jun 2016 18:05:55 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 17 Jun 2016 18:05:55 -0400    

Click here for diff

Commit b8fd1a09f3 renamed XLOG_HINT to XLOG_FPI, but neglected two  
places.  
  
Backpatch to 9.3, like that commit.  

M src/backend/access/transam/README
M src/backend/storage/buffer/bufmgr.c

pg_visibility: Add pg_truncate_visibility_map function.

commit   : 71d05a2c7b82379bb1013a0e338906349c54ed85    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 17:37:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 17:37:30 -0400    

Click here for diff

This requires some core changes as well so that we can properly  
WAL-log the truncation.  Specifically, it changes the format of the  
XLOG_SMGR_TRUNCATE WAL record, so bump XLOG_PAGE_MAGIC.  
  
Patch by me, reviewed but not fully endorsed by Andres Freund.  

M contrib/pg_visibility/pg_visibility–1.0–1.1.sql
M contrib/pg_visibility/pg_visibility–1.1.sql
M contrib/pg_visibility/pg_visibility.c
M doc/src/sgml/pgvisibility.sgml
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/catalog/storage.c
M src/include/access/xlog_internal.h
M src/include/catalog/storage_xlog.h

Try again to fix the way the scanjoin_target is used with partial paths.

commit   : 54f5c5150fa05d7ad15f8406debd5a2b394885b5    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 16:25:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 16:25:02 -0400    

Click here for diff

Commit 04ae11f62e643e07c411c4935ea6af46cb112aa9 removed some broken  
code to apply the scan/join target to partial paths, but its theory  
that this processing step is totally unnecessary turns out to be wrong.  
Put similar code back again, but this time, check for parallel-safety  
and avoid in-place modifications to paths that may already have been  
used as part of some other path.  
  
(This is not an entirely elegant solution to this problem; it might  
be better, for example, to postpone generate_gather_paths for the  
topmost scan/join rel until after the scan/join target has been  
applied.  But this is not the time for such redesign work.)  
  
Amit Kapila and Robert Haas  

M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/include/optimizer/pathnode.h
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Add VACUUM (DISABLE_PAGE_SKIPPING) for emergencies.

commit   : ede62e56fbe809baa1a7bc3873d82f12ffe7540b    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 15:48:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 15:48:57 -0400    

Click here for diff

If you really want to vacuum every single page in the relation,  
regardless of apparent visibility status or anything else, you can use  
this option.  In previous releases, this behavior could be achieved  
using VACUUM (FREEZE), but because we can now recognize all-frozen  
pages as not needing to be frozen again, that no longer works.  There  
should be no need for routine use of this option, but maybe bugs or  
disaster recovery will necessitate its use.  
  
Patch by me, reviewed by Andres Freund.  

M doc/src/sgml/ref/vacuum.sgml
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumlazy.c
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

commit   : 20eb2731b7775f3381939d2667b6aa8ba62ab2c5    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 15:09:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 15:09:57 -0400    

Click here for diff

Almost all functions provided by this extension are PARALLEL  
RESTRICTED.  Mostly, that's because the leader's TCP connections won't  
be shared with the workers, but in some cases like dblink_get_pkey  
it's because they obtain locks which might be released early if taken  
within a parallel worker.  dblink_fdw_validator probably can't be used  
in a query anyway, but there would be no problem from the point of  
view of parallel query if it were, so it's PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/dblink/Makefile
A contrib/dblink/dblink–1.1–1.2.sql
R075 contrib/dblink/dblink–1.1.sql contrib/dblink/dblink–1.2.sql
M contrib/dblink/dblink.control

postgres_fdw: Rephrase comment.

commit   : 177c56d608d834ee1b0869e4e6a5b73de4227ea4    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 13:01:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 13:01:14 -0400    

Click here for diff

Per gripe from Thomas Munro, who only complained about a more  
localized problem, but I couldn't resist a bit more wordsmithing.  

M contrib/postgres_fdw/postgres_fdw.c

Fix typo.

commit   : 9c188a8454e514e43614e47d69f5eaea820af8c4    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 12:55:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 12:55:30 -0400    

Click here for diff

Thomas Munro  

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

Remove PID from 'parallel worker' context message.

commit   : 292794f82b4ebde33ec7f2a572ddd1dedba8ce37    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 09:24:29 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 09:24:29 -0400    

Click here for diff

Discussion: <[email protected]>  

M src/backend/access/transam/parallel.c
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Attempt to fix broken regression test.

commit   : 103512cee95b5bd0feb83c225eeff61c58874413    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 08:35:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 17 Jun 2016 08:35:47 -0400    

Click here for diff

In commit 8c1d9d56e9a00680a035b8b333a98ea16b121eb7, I attempted to  
add a regression test that would fail if the target list was pushed  
into a parallel worker, but due to brain fade on my part, it just  
randomly fails whether anything bad or not, because the error check  
inside the parallel_restricted() function tests whether there is  
*any process in the system* that is not connected to a client, not  
whether the process running the query is not connected to a client.  
  
A little experimentation has left me pessimistic about the  
prospects of doing better here in a short amount of time, so let's  
just fall back to checking that the plan is as we expect and leave  
the execution-time check for another day.  

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

Fix validation of overly-long IPv6 addresses.

commit   : 4c56f3269a84a81461cc53941e0eee02fc920ab6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Jun 2016 17:16:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Jun 2016 17:16:32 -0400    

Click here for diff

The inet/cidr types sometimes failed to reject IPv6 inputs with too many  
colon-separated fields, instead translating them to '::/0'.  This is the  
result of a thinko in the original ISC code that seems to be as yet  
unreported elsewhere.  Per bug #14198 from Stefan Kaltenbrunner.  
  
Report: <[email protected]>  

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

Fix fuzzy thinking in ReinitializeParallelDSM().

commit   : bfb937427be2cfca78e3e076c30e37cddc350f8e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Jun 2016 15:20:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Jun 2016 15:20:29 -0400    

Click here for diff

The fact that no workers were successfully launched in the previous  
iteration does not excuse us from setting up properly to try again.  
This appears to explain crashes I saw in parallel regression testing  
due to error_mqh being NULL when it shouldn't be.  
  
Minor other cosmetic fixes too.  

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

Invent min_parallel_relation_size GUC to replace a hard-wired constant.

commit   : 75be66464cb1bffa1e5757907b9a04ad5afc7859    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Jun 2016 13:47:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Jun 2016 13:47:20 -0400    

Click here for diff

The main point of doing this is to allow the cutoff to be set very small,  
even zero, to allow parallel-query behavior to be tested on relatively  
small tables such as we typically use in the regression tests.  But it  
might be of use to users too.  The number-of-workers scaling behavior in  
create_plain_partial_paths() is pretty ad-hoc and subject to change, so  
we won't expose anything about that, but the notion of not considering  
parallel query at all for tables below size X seems reasonably stable.  
  
Amit Kapila, per a suggestion from me  
  
Discussion: <[email protected]>  

M doc/src/sgml/config.sgml
M src/backend/optimizer/path/allpaths.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/optimizer/paths.h

Reword bogus comment

commit   : 3b5a2a8856b810ed354fb6dbb7df8d7325ece82f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 16 Jun 2016 12:43:35 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 16 Jun 2016 12:43:35 -0400    

Click here for diff

M src/bin/pg_upgrade/file.c

Avoid crash in "postgres -C guc" for a GUC with a null string value.

commit   : 0b0baf26211a98a8593279fa24635bc4dd9ac99d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Jun 2016 12:17:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Jun 2016 12:17:03 -0400    

Click here for diff

Emit "(null)" instead, which was the behavior all along on platforms  
that don't crash, eg OS X.  Per report from Jehan-Guillaume de Rorthais.  
Back-patch to 9.2 where -C option was introduced.  
  
Michael Paquier  
  
Report: <20160615204036.2d35d86a@firost>  

M src/backend/postmaster/postmaster.c

Remove unused prototype

commit   : b000afea6596c4dab2f0595ded751659a158b754    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 16 Jun 2016 12:06:51 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 16 Jun 2016 12:06:51 -0400    

Click here for diff

Commit 6f56b41ac0cd7 removed function get_pg_database_relfilenode but left  
its prototype in place.  Remove it.  

M src/bin/pg_upgrade/pg_upgrade.h

Add regression test for 04ae11f62e643e07c411c4935ea6af46cb112aa9.

commit   : 8c1d9d56e9a00680a035b8b333a98ea16b121eb7    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 16 Jun 2016 12:00:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 16 Jun 2016 12:00:55 -0400    

Click here for diff

The code in this area needs further revision, and it would be best  
not to re-break the things we've already fixed.  
  
Per a gripe from Tom Lane.  

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

Use strftime("%c") to format timestamps in psql's \watch command.

commit   : 9901d8ac2e7326f5a705341d304e7c7f0f95a1e5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Jun 2016 19:31:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Jun 2016 19:31:08 -0400    

Click here for diff

This allows the timestamps to follow local conventions (in particular,  
they respond to the LC_TIME environment setting).  In C locale you get  
the same results as before.  It seems like a good idea to do this now not  
later because we already changed the format of \watch headers for 9.6.  
  
Also, increase the buffer sizes a tad to ensure there's enough space for  
translated strings.  
  
Discussion: <[email protected]>  

M src/bin/psql/command.c

Fix regression test for force_parallel_mode=on.

commit   : 12f862099d25fc70b412d56f50dcabebff8db44a    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Jun 2016 14:59:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Jun 2016 14:59:07 -0400    

Click here for diff

Commit 14a254fb52423c57059851abafbd1247261f7f03 managed not to  
exercise the code it was intended to test, and the comment explaining  
why no "parallel worker" line showed up in the context wasn't right.  
  
Amit Kapila, tweaked by me per Amit's analysis.  

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

Add integrity-checking functions to pg_visibility.

commit   : e472ce9624e0f2083c8fd25ea1acb081be908f8f    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Jun 2016 14:33:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Jun 2016 14:33:58 -0400    

Click here for diff

The new pg_check_visible() and pg_check_frozen() functions can be used to  
verify that the visibility map bits for a relation's data pages match the  
actual state of the tuples on those pages.  
  
Amit Kapila and Robert Haas, reviewed (in earlier versions) by Andres  
Freund.  Additional testing help by Thomas Munro.  

M contrib/pg_visibility/Makefile
A contrib/pg_visibility/pg_visibility–1.0–1.1.sql
R075 contrib/pg_visibility/pg_visibility–1.0.sql contrib/pg_visibility/pg_visibility–1.1.sql
M contrib/pg_visibility/pg_visibility.c
M contrib/pg_visibility/pg_visibility.control
M doc/src/sgml/pgvisibility.sgml
M src/tools/pgindent/typedefs.list

Fix lazy_scan_heap so that it won't mark pages all-frozen too soon.

commit   : 38e9f90a227d1e60e7b4691d1a71fefaba6059e5    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Jun 2016 14:23:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Jun 2016 14:23:39 -0400    

Click here for diff

Commit a892234f830e832110f63fc0a2afce2fb21d1584 added a new bit per  
page to the visibility map fork indicating whether the page is  
all-frozen, but incorrectly assumed that if lazy_scan_heap chose to  
freeze a tuple then that tuple would not need to later be frozen  
again. This turns out to be false, because xmin and xmax (and  
conceivably xvac, if dealing with tuples from very old releases) could  
be frozen at separate times.  
  
Thanks to Andres Freund for help in uncovering and tracking down this  
issue.  

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

Mark some functions parallel-unsafe.

commit   : c7a25c242ffa29810adc2b5320ec7542fe2928bd    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Jun 2016 11:40:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Jun 2016 11:40:07 -0400    

Click here for diff

currtid() and currtid2() call GetLatestSnapshot(), which fails in  
parallel mode.  pg_export_snapshot() calls ExportSnapshot() which  
attempts to assign an XID for the current transaction if it does not  
already have one; that, too, will fail in parallel mode.  
  
Andreas Seltenreich  

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

Force idle_in_transaction_session_timeout off in pg_dump and autovacuum.

commit   : 8383486f108c650b187358bfe811060627c751c9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Jun 2016 10:52:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Jun 2016 10:52:53 -0400    

Click here for diff

We disable statement_timeout and lock_timeout during dump and restore, to  
prevent any global settings that might exist from breaking routine backups.  
Commit c6dda1f48 should have added idle_in_transaction_session_timeout to  
that list, but failed to.  
  
Another place where these timeouts get turned off is autovacuum.  While  
I doubt an idle timeout could fire there, it seems better to be safe than  
sorry.  
  
pg_dump issue noted by Bernd Helmle, the other one found by grepping.  
  
Report: <[email protected]>  

M src/backend/postmaster/autovacuum.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c

PL/Python: Clean up extended error reporting docs and tests

commit   : f0688d6e6c595cdceef3ad218b86f064f4909b4c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Jun 2016 10:34:11 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Jun 2016 10:34:11 -0400    

Click here for diff

Format the example and test code more to Python style standards.  
Improve whitespace.  Improve documentation formatting.  

M doc/src/sgml/plpython.sgml
M src/pl/plpython/expected/plpython_ereport.out
M src/pl/plpython/sql/plpython_ereport.sql

document when PREPARE uses generic plans

commit   : fab9d1da4a213fab08fe2d263eedf2408bc4a27a    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 14 Jun 2016 16:11:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 14 Jun 2016 16:11:46 -0400    

Click here for diff

Also explain how generic plans are created.  
Link to PREPARE docs from wire-protocol prepare docs.  
  
Reported-by: Jonathan Rogers  
  
Discussion: https://www.postgresql.org/message-id/flat/561E749D.4090301%40socialserve.com  

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

Update xml2 extension for parallel query.

commit   : 13e7453135189a32f9f12c4bebd0cd97a0a5d908    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Jun 2016 15:49:32 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Jun 2016 15:49:32 -0400    

Click here for diff

All functions provided by this extension are PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/xml2/Makefile
A contrib/xml2/xml2–1.0–1.1.sql
R070 contrib/xml2/xml2–1.0.sql contrib/xml2/xml2–1.1.sql
M contrib/xml2/xml2.control

Update uuid-ossp extension for parallel query.

commit   : 20f6c3a2a1eeadbf81c4c6cea35e831dc08ae06b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Jun 2016 14:56:21 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Jun 2016 14:56:21 -0400    

Click here for diff

All functions provided by this extension are PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/uuid-ossp/Makefile
A contrib/uuid-ossp/uuid-ossp–1.0–1.1.sql
R068 contrib/uuid-ossp/uuid-ossp–1.0.sql contrib/uuid-ossp/uuid-ossp–1.1.sql
M contrib/uuid-ossp/uuid-ossp.control

Update unaccent extension for parallel query.

commit   : 202ac08c081245a680b371d3e7702a60fad9185c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Jun 2016 14:55:49 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Jun 2016 14:55:49 -0400    

Click here for diff

All functions provided by this extension are PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/unaccent/Makefile
A contrib/unaccent/unaccent–1.0–1.1.sql
R080 contrib/unaccent/unaccent–1.0.sql contrib/unaccent/unaccent–1.1.sql
M contrib/unaccent/unaccent.control

Update sslinfo extension for parallel query.

commit   : 6b7d11ffda0b51b70978edcb1659cc62aa477f01    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Jun 2016 14:52:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Jun 2016 14:52:55 -0400    

Click here for diff

All functions provided by this extension are PARALLEL RESTRICTED,  
because they provide information about the connection state.  Parallel  
workers don't have this information and therefore these functions  
can't be executed in a worker (but they can be present in a query some  
other part of which uses parallelism).  
  
Andreas Karlsson  

M contrib/sslinfo/Makefile
A contrib/sslinfo/sslinfo–1.1–1.2.sql
R072 contrib/sslinfo/sslinfo–1.1.sql contrib/sslinfo/sslinfo–1.2.sql
M contrib/sslinfo/sslinfo.control

Update extensions with GIN/GIST support for parallel query.

commit   : 2910fc8239fa501b662c5459d7ba16a4bc35e7e8    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Jun 2016 13:34:37 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Jun 2016 13:34:37 -0400    

Click here for diff

Commit 749a787c5b25ae33b3d4da0ef12aa05214aa73c7 bumped the extension  
version on all of these extensions already, and we haven't had a  
release since then, so we can make further changes without bumping the  
extension version again.  Take this opportunity to mark all of the  
functions exported by these modules PARALLEL SAFE -- except for  
pg_trgm's set_limit().  Mark that one PARALLEL RESTRICTED, because it  
makes a persistent change to a GUC value.  
  
Note that some of the markings added by this commit don't have any  
effect; for example, gseg_picksplit() isn't likely to be mentioned  
explicitly in a query and therefore it's parallel-safety marking will  
never be consulted.  But this commit just marks everything for  
consistency: if it were somehow used in a query, that would be fine as  
far as parallel query is concerned, since it does not consult any  
backend-private state, attempt to write data, etc.  
  
Andreas Karlsson, with a few revisions by me.  

M contrib/cube/cube–1.1–1.2.sql
M contrib/cube/cube–1.2.sql
M contrib/hstore/hstore–1.3–1.4.sql
M contrib/hstore/hstore–1.4.sql
M contrib/intarray/intarray–1.1–1.2.sql
M contrib/intarray/intarray–1.2.sql
M contrib/ltree/ltree–1.0–1.1.sql
M contrib/ltree/ltree–1.1.sql
M contrib/pg_trgm/pg_trgm–1.2–1.3.sql
M contrib/pg_trgm/pg_trgm–1.3.sql
M contrib/seg/seg–1.0–1.1.sql
M contrib/seg/seg–1.1.sql

postgres_fdw: Check PlaceHolderVars before pushing down a join.

commit   : 131c7e70b4596027992a2f72bfd3765f0fff1b7c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Jun 2016 11:48:27 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Jun 2016 11:48:27 -0400    

Click here for diff

As discovered by Andreas Seltenreich via sqlsmith, it's possible for a  
remote join to need to generate a target list which contains a  
PlaceHolderVar which would need to be evaluated on the remote server.  
This happens when we try to push down a join tree which contains outer  
joins and the nullable side of the join contains a subquery which  
evauates some expression which can go to NULL above the level of the  
join.  Since the deparsing logic can't build a remote query that  
involves subqueries, it fails while trying to produce an SQL query  
that can be sent to the remote side.  Detect such cases and don't try  
to push down the join at all.  
  
It's actually fine to push down the join if the PlaceHolderVar needs  
to be evaluated at the current join level.  This patch makes a small  
change to build_tlist_to_deparse so that this case will work.  
  
Amit Langote, Ashutosh Bapat, and me.  

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

Minor fixes in contrib installation scripts.

commit   : 5484c0a9806b3e90b483128bc386054fc432cb65    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Jun 2016 10:47:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Jun 2016 10:47:06 -0400    

Click here for diff

Extension scripts should never use CREATE OR REPLACE for initial object  
creation.  If there is a collision with a pre-existing (probably  
user-created) object, we want extension installation to fail, not silently  
overwrite the user's object.  Bloom and sslinfo both violated this precept.  
  
Also fix a number of scripts that had no standard header (the file name  
comment and the \echo...\quit guard).  Probably the \echo...\quit hack  
is less important now than it was in 9.1 days, but that doesn't mean  
that individual extensions get to choose whether to use it or not.  
  
And fix a couple of evident copy-and-pasteos in file name comments.  
  
No need for back-patch: the REPLACE bugs are both new in 9.6, and the  
rest of this is pretty much cosmetic.  
  
Andreas Karlsson and Tom Lane  

M contrib/bloom/bloom–1.0.sql
M contrib/hstore_plperl/hstore_plperl–1.0.sql
M contrib/hstore_plperl/hstore_plperlu–1.0.sql
M contrib/hstore_plpython/hstore_plpython2u–1.0.sql
M contrib/hstore_plpython/hstore_plpython3u–1.0.sql
M contrib/hstore_plpython/hstore_plpythonu–1.0.sql
M contrib/ltree_plpython/ltree_plpython2u–1.0.sql
M contrib/ltree_plpython/ltree_plpython3u–1.0.sql
M contrib/ltree_plpython/ltree_plpythonu–1.0.sql
M contrib/pgcrypto/pgcrypto–1.3.sql
M contrib/pgrowlocks/pgrowlocks–1.2.sql
M contrib/pgstattuple/pgstattuple–1.4.sql
M contrib/sslinfo/sslinfo–1.0–1.1.sql

postgres_fdw: Promote an Assert() to elog().

commit   : 332fdbef20b5b5f2588447793dbcc3bb9b88eb51    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Jun 2016 08:55:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Jun 2016 08:55:50 -0400    

Click here for diff

Andreas Seltenreich reports that it is possible for a PlaceHolderVar  
to creep into this tlist, and I fear that even after that's fixed we  
might have other, similar bugs in this area either now or in the  
future.  There's a lot of action-at-a-distance here, because the  
validity of this assertion depends on core planner behavior; so, let's  
use elog() to make sure we catch this even in non-assert builds,  
rather than just crashing.  

M contrib/postgres_fdw/deparse.c

Fix multiple minor infelicities in aclchk.c error reports.

commit   : 783cb6e48b29a34b2cefc401a72d4cc86fa6b2a6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Jun 2016 13:53:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Jun 2016 13:53:10 -0400    

Click here for diff

pg_type_aclmask reported the wrong type's OID when complaining that  
it could not find a type's typelem.  It also failed to provide a  
suitable errcode when the initially given OID doesn't exist (which  
is a user-facing error, since that OID can be user-specified).  
pg_foreign_data_wrapper_aclmask and pg_foreign_server_aclmask likewise  
lacked errcode specifications.  Trivial cosmetic adjustments too.  
  
The wrong-type-OID problem was reported by Petru-Florin Mihancea in  
bug #14186; the other issues noted by me while reading the code.  
These errors all seem to be aboriginal in the respective routines, so  
back-patch as necessary.  
  
Report: <[email protected]>  

M src/backend/catalog/aclchk.c

In planner.c, avoid assuming that all PathTargets have sortgrouprefs.

commit   : 89d53515e53ea080029894939118365b647489b3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Jun 2016 12:59:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Jun 2016 12:59:25 -0400    

Click here for diff

The struct definition for PathTarget specifies that a NULL sortgrouprefs  
pointer means no sortgroupref labels.  While it's likely that there  
should always be at least one labeled column in the places that were  
unconditionally fetching through the pointer, it seems wiser to adhere to  
the data structure specification and test first.  Add a macro to make this  
convenient.  Per experimentation with running the regression tests with a  
very small parallelization threshold --- the crash I observed may well  
represent a bug elsewhere, but still this coding was not very robust.  
  
Report: <[email protected]>  

M src/backend/optimizer/plan/planner.c
M src/include/nodes/relation.h

Remove extraneous leading whitespace in Windows build script.

commit   : cd9b4f24ce5f24de5112392d5a9db3a8d4208115    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Jun 2016 11:50:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Jun 2016 11:50:27 -0400    

Click here for diff

Apparently, at least some versions of Microsoft's shell fail on variable  
assignments that have leading whitespace.  This instance, introduced in  
commit 680513ab7, managed to escape notice for awhile because it's only  
invoked if building with OpenSSL.  Per bug #14185 from Torben Dannhauer.  
  
Report: <[email protected]>  

M src/interfaces/libpq/win32.mak

Finish pgindent run for 9.6: Perl files.

commit   : 3be0a62ffe58f0753d190cbe22acbeb8b4926b85    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 12 Jun 2016 04:19:56 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 12 Jun 2016 04:19:56 -0400    

Click here for diff

M contrib/bloom/t/001_wal.pl
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.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/RewindTest.pm
M src/interfaces/ecpg/preproc/parse.pl
M src/test/modules/commit_ts/t/001_base.pl
M src/test/modules/commit_ts/t/002_standby.pl
M src/test/modules/commit_ts/t/003_standby_2.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/PostgresNode.pm
M src/test/perl/RecursiveCopy.pm
M src/test/perl/TestLib.pm
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/002_archiving.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/007_sync_rep.pl
M src/tools/copyright.pl
M src/tools/git_changelog
M src/tools/msvc/Install.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/build.pl
M src/tools/msvc/config_default.pl
M src/tools/msvc/pgflex.pl
M src/tools/msvc/vcregress.pl

Document the authoritative version of perltidy.

commit   : b098abf90537edf0ce9c70e8eb55320baf6e445d    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 12 Jun 2016 04:19:44 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 12 Jun 2016 04:19:44 -0400    

Click here for diff

Every whole-tree perltidy run has used this version, firmly establishing  
it as the de facto standard.  

M src/tools/pgindent/README

PL/Python: Rename new keyword arguments of plpy.error() etc.

commit   : 020140d84d09e0375824074cead642e3b9435180    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 11 Jun 2016 19:27:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 11 Jun 2016 19:27:49 -0400    

Click here for diff

Rename schema -> schema_name etc. to remain consistent with C API and  
PL/pgSQL.  

M doc/src/sgml/plpython.sgml
M src/pl/plpython/expected/plpython_ereport.out
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/sql/plpython_ereport.sql

Change default of backend_flush_after GUC to 0 (disabled).

commit   : 4bc0f165cb4fbd660648c0153485b3d6f55d80ea    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 10 Jun 2016 15:31:11 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 10 Jun 2016 15:31:11 -0700    

Click here for diff

While beneficial, both for throughput and average/worst case latency, in  
a significant number of workloads, there are other workloads in which  
backend_flush_after can cause significant performance regressions in  
comparison to < 9.6 releases. The regression is most likely when the hot  
data set is bigger than shared buffers, but significantly smaller than  
the operating system's page cache.  
  
I personally think that the benefit of enabling backend flush control is  
considerably bigger than the potential downsides, but a fair argument  
can be made that not regressing is more important than improving  
performance/latency. As the latter is the consensus, change the default  
to 0.  
  
The other settings introduced in 428b1d6b2 do not have the same  
potential for regressions, so leave them enabled.  
  
Benchmarks leading up to changing the default have been performed by  
Mithun Cy, Ashutosh Sharma and Robert Haas.  
  
Discussion: CAD_[email protected]  

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

Remove reltarget_has_non_vars flag.

commit   : 3303ea1a327b41d3b406d7be7a5ce2901e561066    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Jun 2016 16:20:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Jun 2016 16:20:03 -0400    

Click here for diff

Commit b12fd41c6 added a "reltarget_has_non_vars" field to RelOptInfo,  
but failed to maintain it accurately.  Since its only purpose was to skip  
calls to has_parallel_hazard() in the simple case where a rel's targetlist  
is all Vars, and that call is really pretty cheap in that case anyway, it  
seems like this is just a case of premature optimization.  Let's drop the  
flag and do the calls unconditionally until it's proven that we need more  
smarts here.  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/relation.h

Refactor to reduce code duplication for function property checking.

commit   : 2f153ddfdd318b211590dd5585f65f357d85c2de    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Jun 2016 16:03:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Jun 2016 16:03:37 -0400    

Click here for diff

As noted by Andres Freund, we'd accumulated quite a few similar functions  
in clauses.c that examine all functions in an expression tree to see if  
they satisfy some boolean test.  Reduce the duplication by inventing a  
function check_functions_in_node() that applies a simple callback function  
to each SQL function OID appearing in a given expression node.  This also  
fixes some arguable oversights; for example, contain_mutable_functions()  
did not check aggregate or window functions for mutability.  I doubt that  
that represents a live bug at the moment, because we don't really consider  
mutability for aggregates; but it might someday be one.  
  
I chose to put check_functions_in_node() in nodeFuncs.c because it seemed  
like other modules might wish to use it in future.  That in turn forced  
moving set_opfuncid() et al into nodeFuncs.c, as the alternative was for  
nodeFuncs.c to depend on optimizer/setrefs.c which didn't seem very clean.  
  
In passing, teach contain_leaked_vars_walker() about a few more expression  
node types it can safely look through, and improve the rather messy and  
undercommented code in has_parallel_hazard_walker().  
  
Discussion: <[email protected]>  

M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/predtest.c
M src/backend/utils/cache/relcache.c
M src/include/nodes/nodeFuncs.h
M src/include/optimizer/planmain.h

Rename local variable for consistency.

commit   : 13761bccb177022c8c0dabc08f3e9acb491b1c96    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 10 Jun 2016 11:24:01 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 10 Jun 2016 11:24:01 -0500    

Click here for diff

Pointed out by Robert Haas.  

M src/backend/catalog/index.c

Update pgstattuple extension for parallel query.

commit   : a8501ba11931f84c07e014070902d8198fa7dfd9    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 10 Jun 2016 10:42:03 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 10 Jun 2016 10:42:03 -0400    

Click here for diff

All functions provided by this extension are PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/pgstattuple/Makefile
A contrib/pgstattuple/pgstattuple–1.3–1.4.sql
R092 contrib/pgstattuple/pgstattuple–1.3.sql contrib/pgstattuple/pgstattuple–1.4.sql
M contrib/pgstattuple/pgstattuple.control

Update pg_stat_statements extension for parallel query.

commit   : 496899ccc2fd1b84bd1a8c8b3a7f0c667e5329f0    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 10 Jun 2016 10:42:01 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 10 Jun 2016 10:42:01 -0400    

Click here for diff

All functions provided by this extension are PARALLEL SAFE.  Given the  
general prohibition against write operations in parallel queries, it is  
perhaps a bit surprising that pg_stat_statements_reset() is parallel safe.  
But since it only modifies shared memory, not the database, it's OK.  
  
Andreas Karlsson  

M contrib/pg_stat_statements/Makefile
A contrib/pg_stat_statements/pg_stat_statements–1.3–1.4.sql
R090 contrib/pg_stat_statements/pg_stat_statements–1.3.sql contrib/pg_stat_statements/pg_stat_statements–1.4.sql
M contrib/pg_stat_statements/pg_stat_statements.control

Schema-qualify some references to regprocedure.

commit   : 3d8fc8c68c063d52ca678e569f0ecd9385f846e6    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 10 Jun 2016 10:41:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 10 Jun 2016 10:41:58 -0400    

Click here for diff

Andreas Karlsson, per a gripe from Tom Lane.  

M contrib/citext/citext–1.1–1.2.sql
M contrib/intagg/intagg–1.0–1.1.sql

Fix interaction between CREATE INDEX and "snapshot too old".

commit   : bf9a60ee3349a2f2dc5fe6d571a8d39cfc634371    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 10 Jun 2016 09:25:31 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 10 Jun 2016 09:25:31 -0500    

Click here for diff

Since indexes are created without valid LSNs, an index created  
while a snapshot older than old_snapshot_threshold existed could  
cause queries to return incorrect results when those old snapshots  
were used, if any relevant rows had been subject to early pruning  
before the index was built.  Prevent usage of a newly created index  
until all such snapshots are released, for relations where this can  
happen.  
  
Questions about the interaction of "snapshot too old" with index  
creation were initially raised by Andres Freund.  
  
Reviewed by Robert Haas.  

M src/backend/catalog/index.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/time/snapmgr.c
M src/include/utils/snapmgr.h

Improve the situation for parallel query versus temp relations.

commit   : cae1c788b9b43887e4a4fa51a11c3a8ffa334939    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Jun 2016 20:16:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Jun 2016 20:16:11 -0400    

Click here for diff

Transmit the leader's temp-namespace state to workers.  This is important  
because without it, the workers do not really have the same search path  
as the leader.  For example, there is no good reason (and no extant code  
either) to prevent a worker from executing a temp function that the  
leader created previously; but as things stood it would fail to find the  
temp function, and then either fail or execute the wrong function entirely.  
  
We still prohibit a worker from creating a temp namespace on its own.  
In effect, a worker can only see the session's temp namespace if the leader  
had created it before starting the worker, which seems like the right  
semantics.  
  
Also, transmit the leader's BackendId to workers, and arrange for workers  
to use that when determining the physical file path of a temp relation  
belonging to their session.  While the original intent was to prevent such  
accesses entirely, there were a number of holes in that, notably in places  
like dbsize.c which assume they can safely access temp rels of other  
sessions anyway.  We might as well get this right, as a small down payment  
on someday allowing workers to access the leader's temp tables.  (With  
this change, directly using "MyBackendId" as a relation or buffer backend  
ID is deprecated; you should use BackendIdForTempRelations() instead.  
I left a couple of such uses alone though, as they're not going to be  
reachable in parallel workers until we do something about localbuf.c.)  
  
Move the thou-shalt-not-access-thy-leader's-temp-tables prohibition down  
into localbuf.c, which is where it actually matters, instead of having it  
in relation_open().  This amounts to recognizing that access to temp  
tables' catalog entries is perfectly safe in a worker, it's only the data  
in local buffers that is problematic.  
  
Having done all that, we can get rid of the test in has_parallel_hazard()  
that says that use of a temp table's rowtype is unsafe in parallel workers.  
That test was unduly expensive, and if we really did need such a  
prohibition, that was not even close to being a bulletproof guard for it.  
(For example, any user-defined function executed in a parallel worker  
might have attempted such access.)  

M src/backend/access/heap/heapam.c
M src/backend/access/transam/parallel.c
M src/backend/catalog/catalog.c
M src/backend/catalog/namespace.c
M src/backend/catalog/storage.c
M src/backend/optimizer/util/clauses.c
M src/backend/storage/buffer/localbuf.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/init/globals.c
M src/include/catalog/namespace.h
M src/include/storage/backendid.h

Repair a bit of pgindent damage.

commit   : 2410a2543e77983dab1f63f48b2adcd23dba994e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 18:09:17 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 18:09:17 -0400    

Click here for diff

Inserting line-breaks into the middle of a URL is, to put it