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+YFXv+2qne6xJW7z_25mYBtktRX5rpkrgrb+DRgQ_FxgHQ@mail.gmail.com>  

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: <CAA4eK1JyNdMeF-dgrpHozDecpDfsRZUtpCi+1AbtuEkfG3YooQ@mail.gmail.com>  

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: <CAJrrPGfnRXvmCzxq6Dy=stAWebfNHxiL+Y_z7uqksZUCkW_waQ@mail.gmail.com>  

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/CABRT9RC81YUf1=jsmWopcKJEro=VoeG2ou6sPwyOUTx_qteRsg@mail.gmail.com  
	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: <CAM3SWZRVkuUB68DbAkgw=532gW0f+fofKueAMsY7hVYi68MuYQ@mail.gmail.com>  

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: CABOikdPsPByMiG6J01DKq6om2+BNkxHTPkOyqHM2a4oYwGKsqQ@mail.gmail.com  

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=VY8ykfLT5Q8vb9B6EbeBk-NGuLbT6seaQ+Fq4zXvrDcA@mail.gmail.com>  

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=1xEUuBphDwDmB1WjN4+td4kpnEniFaTBxnk1xzHCw8_OQ@mail.gmail.com>  

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: CAEepm=3fWAbWryVW9swHyLTY4sXVf0xbLvXqOwUoDiNCx9mBjQ@mail.gmail.com  
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=1VOnbVx4wsgQFvj94hu9jVt2nVabCr7QiooUSvPJXkgQ@mail.gmail.com>  

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: CAMkU=1x+GwjSayc57v6w87ij6iRGFWt=hVfM0B64b1_bPVKRqg@mail.gmail.com  

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: <CAM3SWZRVANbj9GA9j40fAwheQCZQtSwqTN1GBTVwRrRbmSf7cg@mail.gmail.com>  

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=1xfuPf2edAe4ZGXTmJpU7jxuKukKyvNtEXwu35B7dvejg@mail.gmail.com>  

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=1zx-pqcfSApL2pYDQurPOCfcYU0wJorsmY1OrYPiXRbLw@mail.gmail.com>  

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-cEDbA+XHdNb=YS_4wvZbs66Ni9KeSJKAJGNJyOsgQw@mail.gmail.com>  

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: CAEepm=3fWAbWryVW9swHyLTY4sXVf0xbLvXqOwUoDiNCx9mBjQ@mail.gmail.com  
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: <CAM3SWZTBAo4hjbBd780+MrOKiKp_TMo1N3A0Rw9_im8gbD7fQA@mail.gmail.com>  

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: CAEepm=3fWAbWryVW9swHyLTY4sXVf0xbLvXqOwUoDiNCx9mBjQ@mail.gmail.com  
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: <A737B7A37273E048B164557ADEF4A58B5386C6E1@ntex2010i.host.magwien.gv.at>  

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: <CAM3SWZSgxehDkDMq1FdiW2A0Dxc79wH0hz1x-TnGy=1BXEL+nw@mail.gmail.com>  

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: <CAHyXU0wpHf2bbtKGL1gtUEFATCY86r=VKxfcACVcTMQ70mCyig@mail.gmail.com>  

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: <CAFj8pRAimq+NK-menjt+3J4-LFoodDD8Or6=Lc_stcFD+eD4DA@mail.gmail.com>  

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: <CAB7nPqTR3Vu3xKOZOYqSm-+bSZV0kqgeGAXD6w5GLbkbfd5Q6w@mail.gmail.com>  

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-w4HMwwcwaVvYcAH0_FGtG5GeXdYVRfvG81pXnSJWHnCfosQ@mail.gmail.com>  

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: CAD21AoBD=Of1OzL90Xx4Q-3j=-2q7=S87cs75HfutE=eCday2w@mail.gmail.com  

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: <CAM184AcjqKYZSdQqBHDrnENXHhW=mXbUC46QYPJ=nAh0gUHCGA@mail.gmail.com>  

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/CAB7nPqStg4M561obo7ryZ5G+fUydG4v1Ajs1xZT1ujtu+woRag@mail.gmail.com  

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: CAEepm=3-TW9PLwGZhqjSSiEQ9UzJEKE-HELQDzRE0QUSCp8dgw@mail.gmail.com  

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: <CAGPqQf2iLB8t6t-XrL-zR233DFTXxEsfVZ4WSqaYfLupEoDxXA@mail.gmail.com>  

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/SG2PR06MB0760098A111C88E31BD4D96FB3540@SG2PR06MB0760.apcprd06.prod.outlook.com  
  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+YdpwxPUADrmxSD7+Td=uOshMB1KkDN7G7cf+FGmNjjxMhjbw@mail.gmail.com>  

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: CAKFQuwZZvnxwSq9tNtvL+uyuDKGgV91zR_agtPxQHRWMWQRP8g@mail.gmail.com  

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__OuhPmc6XH=wYRm_+Q657yQE88DakN4=Ybh2oveFasHkoeA@mail.gmail.com  

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 mildly, not  
very helpful, so persuade pgindent to leave it alone.  

M src/backend/main/main.c

pgindent run for 9.6

commit   : 4bc424b968058c7f0aa685821d7039e86faac99c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 18:02:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 18:02:36 -0400    

Click here for diff

M contrib/auto_explain/auto_explain.c
M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/file_fdw/file_fdw.c
M contrib/isn/isn.c
M contrib/pageinspect/heapfuncs.c
M contrib/pg_trgm/trgm_gin.c
M contrib/pg_trgm/trgm_gist.c
M contrib/pg_trgm/trgm_op.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pgcrypto/pgp.h
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/sslinfo/sslinfo.c
M contrib/test_decoding/test_decoding.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/common/reloptions.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistscan.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/rmgrdesc/logicalmsgdesc.c
M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xlogreader.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_aggregate.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/amcmds.c
M src/backend/commands/analyze.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/copy.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/matview.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/proclang.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuumlazy.c
M src/backend/commands/variable.c
M src/backend/executor/execAmi.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/tqueue.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqmq.c
M src/backend/main/main.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/tlist.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_utilcmd.c
M src/backend/port/atomics.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rowsecurity.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/proc.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/error/elog.c
M src/backend/utils/hash/dynahash.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/time/snapmgr.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/psql/crosstabview.c
M src/bin/psql/help.c
M src/bin/psql/prompt.c
M src/bin/psql/tab-complete.c
M src/common/config_info.c
M src/common/controldata_utils.c
M src/include/access/nbtree.h
M src/include/access/timeline.h
M src/include/access/visibilitymap.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/catalog/objectaddress.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_type.h
M src/include/common/config_info.h
M src/include/executor/execParallel.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/foreign/fdwapi.h
M src/include/foreign/foreign.h
M src/include/nodes/execnodes.h
M src/include/nodes/extensible.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/clauses.h
M src/include/parser/parse_agg.h
M src/include/parser/scansup.h
M src/include/pgstat.h
M src/include/replication/message.h
M src/include/replication/output_plugin.h
M src/include/replication/reorderbuffer.h
M src/include/replication/snapbuild.h
M src/include/storage/fd.h
M src/include/storage/freespace.h
M src/include/storage/lockdefs.h
M src/include/storage/proc.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/include/tsearch/dicts/spell.h
M src/include/tsearch/ts_public.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/elog.h
M src/include/utils/geo_decls.h
M src/include/utils/jsonapi.h
M src/include/utils/jsonb.h
M src/include/utils/plancache.h
M src/include/utils/rel.h
M src/include/utils/snapmgr.h
M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/ecpglib/extern.h
M src/interfaces/ecpg/preproc/descriptor.c
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_spi.c
M src/port/chklocale.c
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c

Update pgrowlocks extension for parallel query.

commit   : 9164deea2f4ac90ee5e008ff41fc5ad4423887b2    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 17:18:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 17:18:20 -0400    

Click here for diff

The pgrowlocks function provided by this extension is PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/pgrowlocks/Makefile
A contrib/pgrowlocks/pgrowlocks–1.1–1.2.sql
R094 contrib/pgrowlocks/pgrowlocks–1.1.sql contrib/pgrowlocks/pgrowlocks–1.2.sql
M contrib/pgrowlocks/pgrowlocks.control

Update pg_prewarm extension for parallel query.

commit   : 6b3586caa810529635a8f77789d88e957b389469    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 17:18:18 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 17:18:18 -0400    

Click here for diff

The pg_prewarm function provided by this extension is PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/pg_prewarm/Makefile
A contrib/pg_prewarm/pg_prewarm–1.0–1.1.sql
R085 contrib/pg_prewarm/pg_prewarm–1.0.sql contrib/pg_prewarm/pg_prewarm–1.1.sql
M contrib/pg_prewarm/pg_prewarm.control

Update pg_freespacemap extension for parallel query.

commit   : 42d4257a069584e205cafcc175f9f6f8d673237c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 17:18:16 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 17:18:16 -0400    

Click here for diff

All functions provided by this extension are PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/pg_freespacemap/Makefile
A contrib/pg_freespacemap/pg_freespacemap–1.0–1.1.sql
R087 contrib/pg_freespacemap/pg_freespacemap–1.0.sql contrib/pg_freespacemap/pg_freespacemap–1.1.sql
M contrib/pg_freespacemap/pg_freespacemap.control

Update pgcrypto extension for parallel query.

commit   : 0dbf3ce0e0c0bac2eb84eec70bcd3d728abd5a8c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 17:18:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 17:18:14 -0400    

Click here for diff

All functions provided by this extension are PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/pgcrypto/Makefile
A contrib/pgcrypto/pgcrypto–1.2–1.3.sql
R074 contrib/pgcrypto/pgcrypto–1.2.sql contrib/pgcrypto/pgcrypto–1.3.sql
M contrib/pgcrypto/pgcrypto.control

Update pg_buffercache extension for parallel query.

commit   : 06d7fd6e2975db3273b14116a471f71fef9e0102    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 17:18:12 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 17:18:12 -0400    

Click here for diff

The pg_buffercache_pages function provided by this extension is  
PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/pg_buffercache/Makefile
A contrib/pg_buffercache/pg_buffercache–1.1–1.2.sql
R090 contrib/pg_buffercache/pg_buffercache–1.1.sql contrib/pg_buffercache/pg_buffercache–1.2.sql
M contrib/pg_buffercache/pg_buffercache.control

Update pageinspect extension for parallel query.

commit   : e3b607cd7a949958bdccb056b5c3cb2389f588ad    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 17:18:09 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 17:18:09 -0400    

Click here for diff

All functions provided by this extension are PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/pageinspect/Makefile
A contrib/pageinspect/pageinspect–1.4–1.5.sql
R089 contrib/pageinspect/pageinspect–1.4.sql contrib/pageinspect/pageinspect–1.5.sql
M contrib/pageinspect/pageinspect.control

Handle contrib's GIN/GIST support function signature changes honestly.

commit   : 749a787c5b25ae33b3d4da0ef12aa05214aa73c7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Jun 2016 16:44:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Jun 2016 16:44:25 -0400    

Click here for diff

In commits 9ff60273e35cad6e and dbe2328959e12701 I (tgl) fixed the  
signatures of a bunch of contrib's GIN and GIST support functions so that  
they would pass validation by the recently-added amvalidate functions.  
The backend does not actually consult or check those signatures otherwise,  
so I figured this was basically cosmetic and did not require an extension  
version bump.  However, Alexander Korotkov pointed out that that would  
leave us in a pretty messy situation if we ever wanted to redefine those  
functions later, because there wouldn't be a unique way to name them.  
Since we're going to be bumping these extensions' versions anyway for  
parallel-query cleanups, let's take care of this now.  
  
Andreas Karlsson, adjusted for more search-path-safety by me  

M contrib/btree_gist/Makefile
A contrib/btree_gist/btree_gist–1.1–1.2.sql
R099 contrib/btree_gist/btree_gist–1.1.sql contrib/btree_gist/btree_gist–1.2.sql
M contrib/btree_gist/btree_gist.control
M contrib/cube/Makefile
A contrib/cube/cube–1.1–1.2.sql
R099 contrib/cube/cube–1.1.sql contrib/cube/cube–1.2.sql
M contrib/cube/cube.control
M contrib/hstore/Makefile
A contrib/hstore/hstore–1.3–1.4.sql
R099 contrib/hstore/hstore–1.3.sql contrib/hstore/hstore–1.4.sql
M contrib/hstore/hstore.control
M contrib/intarray/Makefile
A contrib/intarray/intarray–1.1–1.2.sql
R099 contrib/intarray/intarray–1.1.sql contrib/intarray/intarray–1.2.sql
M contrib/intarray/intarray.control
M contrib/ltree/Makefile
A contrib/ltree/ltree–1.0–1.1.sql
R099 contrib/ltree/ltree–1.0.sql contrib/ltree/ltree–1.1.sql
M contrib/ltree/ltree.control
M contrib/pg_trgm/Makefile
A contrib/pg_trgm/pg_trgm–1.2–1.3.sql
R099 contrib/pg_trgm/pg_trgm–1.2.sql contrib/pg_trgm/pg_trgm–1.3.sql
M contrib/pg_trgm/pg_trgm.control
M contrib/seg/Makefile
A contrib/seg/seg–1.0–1.1.sql
R099 contrib/seg/seg–1.0.sql contrib/seg/seg–1.1.sql
M contrib/seg/seg.control

Don't generate parallel paths for rels with parallel-restricted outputs.

commit   : b12fd41c695b43c76b0a9a4d19ba43b05536440c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 12:40:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 12:40:23 -0400    

Click here for diff

Such paths are unsafe.  To make it cheaper to detect when this case  
applies, track whether a relation's default PathTarget contains any  
non-Vars.  In most cases, the answer will be no, which enables us to  
determine cheaply that the target list for a proposed path is  
parallel-safe.  However, subquery pull-up can create cases that  
require us to inspect the target list more carefully.  
  
Amit Kapila, reviewed by me.  

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

Yet again update typedefs.list file in preparation for pgindent run

commit   : e7bcd983f56136a9580076b60d5c19eb2fd83301    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 12:15:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 12:15:33 -0400    

Click here for diff

Because the run was delayed, the file had a chance to get out of date.  

M src/tools/pgindent/typedefs.list

Clarify documentation of ceil/ceiling/floor functions.

commit   : 7feb60c1bb0b1e9c97561171e9194d56694620ad    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Jun 2016 11:58:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Jun 2016 11:58:00 -0400    

Click here for diff

Document these as "nearest integer >= argument" and "nearest integer <=  
argument", which will hopefully be less confusing than the old formulation.  
New wording is from Matlab via Dean Rasheed.  
  
I changed the pg_description entries as well as the SGML docs.  In the  
back branches, this will only affect installations initdb'd in the future,  
but it should be harmless otherwise.  
  
Discussion: <CAEZATCW3yzJo-NMSiQs5jXNFbTsCEftZS-Og8=FvFdiU+kYuSA@mail.gmail.com>  

M doc/src/sgml/func.sgml
M src/include/catalog/pg_proc.h

Mop-up for parallel degree-ectomy.

commit   : e4158319f34ceb2c760761dc93d262513235c344    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Jun 2016 11:16:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Jun 2016 11:16:26 -0400    

Click here for diff

Fix a couple of overlooked uses of "degree" terminology.  Make the parallel  
worker count selection logic in create_plain_partial_paths more robust (in  
particular, it failed with max_parallel_workers_per_gather set to zero).  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/util/plancat.c
M src/include/utils/rel.h

Eliminate "parallel degree" terminology.

commit   : c9ce4a1c61ebf39c03885cc19fe7c32edc04a300    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 09:08:27 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Jun 2016 09:08:27 -0400    

Click here for diff

This terminology provoked widespread complaints.  So, instead, rename  
the GUC max_parallel_degree to max_parallel_workers_per_gather  
(leaving room for a possible future GUC max_parallel_workers that acts  
as a system-wide limit), and rename the parallel_degree reloption to  
parallel_workers.  Rename structure members to match.  
  
These changes create a dump/restore hazard for users of PostgreSQL  
9.6beta1 who have set the reloption (or applied the GUC using ALTER  
USER or ALTER DATABASE).  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/release-9.6.sgml
M src/backend/access/common/reloptions.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/psql/tab-complete.c
M src/include/nodes/relation.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/include/utils/rel.h

Polish the documentation concerning phrase text search.

commit   : 6581e930a8546a764e948ad429fc2e179fc38d09    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Jun 2016 00:30:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Jun 2016 00:30:59 -0400    

Click here for diff

Fix grammar, improve examples, etc.  
  
I did not attempt to document the current behavior concerning distance-zero  
matches, because I think that's broken and needs to change, so I'm not  
going to use up brain cells figuring out how to explain how it works now.  
One way or the other, there's still more to write here.  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/textsearch.sgml

Fix typo.

commit   : f721e94b5f360391fc3ffe183bf697a0441e9184    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 8 Jun 2016 08:37:06 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 8 Jun 2016 08:37:06 -0400    

Click here for diff

Amit Langote  

M doc/src/sgml/pgvisibility.sgml

Test parallel query essentials in "make check".

commit   : 14a254fb52423c57059851abafbd1247261f7f03    
  
author   : Noah Misch <[email protected]>    
date     : Tue, 7 Jun 2016 23:36:22 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Tue, 7 Jun 2016 23:36:22 -0400    

Click here for diff

Clément Prévost and Peter Eisentraut  

A src/test/regress/expected/select_parallel.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/select_parallel.sql

Make psql_crosstab plans more stable

commit   : c588df9971f41210d2fad8bf0112a78458de96cb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 7 Jun 2016 19:18:31 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 7 Jun 2016 19:18:31 -0400    

Click here for diff

To achieve this, ANALYZE the data table before querying it, as suggested  
by Tom Lane.  On my system, this enables the test to pass with 128 kB of  
work_mem (a value with which other tests fail -- so it seems good  
enough).  
  
Reported by Michaël Paquier.  

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

nls-global.mk: search build dir for source files, too

commit   : 736c95ca1647ae088c4c996218e8ef20a56b1795    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 7 Jun 2016 18:55:18 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 7 Jun 2016 18:55:18 -0400    

Click here for diff

In VPATH builds, the build directory was not being searched for files in  
GETTEXT_FILES, leading to failure to construct the .pot files.  This has  
bit me all along, but never hard enough to get it fixed; I suppose not a  
lot of people uses VPATH and NLS-enabled builds, and those that do,  
don't do "make update-po" often.  
  
This is a longstanding problem, so backpatch all the way back.  

M src/nls-global.mk

Fix thinko in description of table_name parameter

commit   : a6dacf6bbb45bbb73a0729022daa47197312c321    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 7 Jun 2016 18:18:26 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 7 Jun 2016 18:18:26 -0400    

Click here for diff

Commit 6820094d1 mixed up types of parent object (table) with type of  
sub-object being commented on.  Noticed while fixing docs for  
COMMENT ON ACCESS METHOD.  
  
Backpatch to 9.5, like that commit.  

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

Add missing translate_columns array entry

commit   : 8b3746208ce2a2a2bb057dec09cf09a0c783d91b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 7 Jun 2016 18:03:31 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 7 Jun 2016 18:03:31 -0400    

Click here for diff

This omission caused an assertion error in \dA+.  

M src/bin/psql/describe.c

Fix loose ends for SQL ACCESS METHOD objects

commit   : 4f04b66f97f0e0265489f0fe0373ea44c9ad11bf    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 7 Jun 2016 17:59:34 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 7 Jun 2016 17:59:34 -0400    

Click here for diff

COMMENT ON ACCESS METHOD was missing; add it, along psql tab-completion  
support for it.  
  
psql was also missing a way to list existing access methods; the new \dA  
command does that.  
  
Also add tab-completion support for DROP ACCESS METHOD.  
  
Author: Michael Paquier  
Discussion: https://www.postgresql.org/message-id/CAB7nPqTzdZdu8J7EF8SXr_R2U5bSUUYNOT3oAWBZdEoggnwhGA@mail.gmail.com  

M contrib/bloom/bloom–1.0.sql
M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/backend/parser/gram.y
M src/bin/psql/command.c
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/tab-complete.c

Revert "Use Foreign Key relationships to infer multi-column join selectivity".

commit   : 77ba610805e7ef9ba9c9a593ea8b1ca8f98f8bcb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Jun 2016 17:21:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Jun 2016 17:21:17 -0400    

Click here for diff

This commit reverts 137805f89 as well as the associated commits 015e88942,  
5306df283, and 68d704edb.  We found multiple bugs in this feature, and  
there was concern about possible planner slowdown (though to be fair,  
exhibiting a very large slowdown proved difficult).  The way forward  
requires a considerable rewrite, which may or may not be possible to  
accomplish in time for beta2.  In my judgment reviewing the rewrite will  
be easier to accomplish starting from a clean slate, so let's temporarily  
revert what's there now.  This also leaves us in a safe state if it turns  
out to be necessary to postpone the rewrite to the next development cycle.  
  
Discussion: <[email protected]>  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/misc/guc.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/utils/rel.h
M src/include/utils/relcache.h
M src/test/regress/expected/rangefuncs.out

Message style and wording fixes

commit   : 5c6d2a5e7c83bf6e157fe4ca0ab9b123012289e9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Jun 2016 14:18:08 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Jun 2016 14:18:08 -0400    

Click here for diff

M src/backend/access/gin/ginbulk.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/operatorcmds.c
M src/backend/utils/adt/misc.c
M src/bin/pg_rewind/pg_rewind.c
M src/test/regress/expected/alter_operator.out
M src/test/regress/expected/create_aggregate.out
M src/test/regress/expected/name.out

doc: Update wording about direct system catalog manipulation

commit   : df7cc3976db6980d115d1dc6556f021d9783d579    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Jun 2016 14:15:42 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Jun 2016 14:15:42 -0400    

Click here for diff

It was previously suggested that "esoteric" operations such as creating  
a new access method would require direct manipulation of the system  
catalogs, but that example has gone away, and I can't think of a new one  
to replace it, so just put in some weasel wording.  

M doc/src/sgml/catalogs.sgml

doc: Fix typo

commit   : 79616ae73b0ba2fb650a9d8ebc5ce8a088cb3858    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Jun 2016 14:15:21 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Jun 2016 14:15:21 -0400    

Click here for diff

M doc/src/sgml/config.sgml

Correct phrasing in dsm.c comments

commit   : 1f74a9088881d5e7e3fc20508bc6fa47beeb6290    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 7 Jun 2016 17:34:33 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 7 Jun 2016 17:34:33 +0100    

Click here for diff

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

Improve documentation for contrib/bloom.

commit   : cfd4804b1ebed8108ef6caedc76fb6eb37bc9724    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Jun 2016 12:19:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Jun 2016 12:19:18 -0400    

Click here for diff

Michael Paquier, David Johnston, Tom Lane  
  
Discussion: <CAB7nPqQB8dcFmY1uodmiJOSZdhBFOx-us-uW6rfYrzhpEiBR2g@mail.gmail.com>  

M doc/src/sgml/bloom.sgml

Update lo extension for parallel query.

commit   : e7880e5d39d098d40717d23c9162b8e52294792a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Jun 2016 11:26:01 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Jun 2016 11:26:01 -0400    

Click here for diff

The lo_oid function provided by this extension is PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/lo/Makefile
A contrib/lo/lo–1.0–1.1.sql
R085 contrib/lo/lo–1.0.sql contrib/lo/lo–1.1.sql
M contrib/lo/lo.control

Update isn extension for parallel query.

commit   : b79b8d8f55522e7bc299efc4a41f02accdeaccbe    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Jun 2016 11:25:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Jun 2016 11:25:58 -0400    

Click here for diff

All functions provided by this extension are PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/isn/Makefile
A contrib/isn/isn–1.0–1.1.sql
R087 contrib/isn/isn–1.0.sql contrib/isn/isn–1.1.sql
M contrib/isn/isn.control

Update intagg extension for parallel query.

commit   : 1ab194a3a9c6a36a4259be846651eb597a98c862    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Jun 2016 11:25:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Jun 2016 11:25:55 -0400    

Click here for diff

All functions provided by this extension are PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/intagg/Makefile
A contrib/intagg/intagg–1.0–1.1.sql
R080 contrib/intagg/intagg–1.0.sql contrib/intagg/intagg–1.1.sql
M contrib/intagg/intagg.control

Update fuzzystrmatch extension for parallel query.

commit   : ffab82fbda884bc73485d877dd7d528c4cb15e82    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Jun 2016 11:25:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Jun 2016 11:25:53 -0400    

Click here for diff

All functions provided by this extension are PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/fuzzystrmatch/Makefile
A contrib/fuzzystrmatch/fuzzystrmatch–1.0–1.1.sql
R069 contrib/fuzzystrmatch/fuzzystrmatch–1.0.sql contrib/fuzzystrmatch/fuzzystrmatch–1.1.sql
M contrib/fuzzystrmatch/fuzzystrmatch.control

Update earthdistance extension for parallel query.

commit   : 50e5226bb3272daac1edb13fce9b8e92be302d64    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Jun 2016 11:25:49 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Jun 2016 11:25:49 -0400    

Click here for diff

All functions provided by this extension are PARALLEL SAFE.  
  
Andreas Karlsson  

M contrib/earthdistance/Makefile
A contrib/earthdistance/earthdistance–1.0–1.1.sql
R092 contrib/earthdistance/earthdistance–1.0.sql contrib/earthdistance/earthdistance–1.1.sql
M contrib/earthdistance/earthdistance.control

Update citext extension for parallel query.

commit   : a89b4b1be0d3550a7860250ff74dc69730555a1f    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Jun 2016 11:25:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Jun 2016 11:25:38 -0400    

Click here for diff

All citext functions are PARALLEL SAFE, and a couple of them can  
benefit from having aggregate combine functions.  
  
Andreas Karlsson  

M contrib/citext/Makefile
A contrib/citext/citext–1.1–1.2.sql
R085 contrib/citext/citext–1.1.sql contrib/citext/citext–1.2.sql
M contrib/citext/citext.control

Minor typos / copy-editing for snapmgr.c

commit   : 40fc4575205dc563b88da1db9a8a75cc4d3b848a    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 7 Jun 2016 11:14:48 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 7 Jun 2016 11:14:48 -0400    

Click here for diff

Noticed while reviewing snapshot management.  

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

psql: Add missing file to nls.mk

commit   : d8c2dccfdb947d96082fdf4b47ae17656074ad9c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Jun 2016 10:58:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Jun 2016 10:58:46 -0400    

Click here for diff

crosstabview.c was not added to nls.mk when it was added.  Also remove  
redundant gettext markers, since psql_error() is already registered as a  
gettext keyword.  

M src/bin/psql/crosstabview.c
M src/bin/psql/nls.mk

doc: Refer to table by id

commit   : 552346c5502ed93bb97e171f7206ea96f4de3a15    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Jun 2016 10:38:48 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Jun 2016 10:38:48 -0400    

Click here for diff

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

pgbench: Fix order in --help output

commit   : 298706de2692e3add3cfef2ac02e27f8f237785f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Jun 2016 10:09:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Jun 2016 10:09:24 -0400    

Click here for diff

The new option --progress-timestamp was just added at the end.  Put it  
in alphabetical order.  

M src/bin/pgbench/pgbench.c

Fix simple typo in monitoring docs

commit   : 29424a9c666b6722aac7527e388c2b01830a0990    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 7 Jun 2016 15:21:01 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 7 Jun 2016 15:21:01 +0100    

Click here for diff

M doc/src/sgml/monitoring.sgml

pg_dump only selected components of ACCESS METHODs

commit   : 562f06f3f0da92e397a2f05e1b9b5bfbde336fb2    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 7 Jun 2016 09:56:02 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 7 Jun 2016 09:56:02 -0400    

Click here for diff

dumpAccessMethod() didn't get the memo that we now have a bitfield for  
the components which should be dumped instead of a simple boolean.  
  
Correct that by checking if the relevant bit is set for each component  
being dumped out (and not dumping it out if it isn't set).  
  
This corrects an issue where CREATE ACCESS METHOD commands were being  
included in non-binary-upgrades when an extension included an access  
method (as the bloom extensions does).  
  
Also add a regression test to make sure that we only dump out the  
ACCESS METHOD commands, when they are part of an extension, when doing  
a binary upgrade.  
  
Pointed out by Thom Brown.  

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

PL/Python: Move ereport wrapper test cases to separate file

commit   : 83590771241fc89a944ba7703f506f4ca50f7e5f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Jun 2016 09:33:41 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Jun 2016 09:33:41 -0400    

Click here for diff

In commit 5c3c3cd0a3046339597a03bc708cb5530dc07059, the new tests were  
apparently just dumped into the first convenient file.  Move them to a  
separate file dedicated to testing that functionality and leave the  
plpython_test test to test basic functionality, as it did before.  

M src/pl/plpython/Makefile
A src/pl/plpython/expected/plpython_ereport.out
M src/pl/plpython/expected/plpython_test.out
A src/pl/plpython/sql/plpython_ereport.sql
M src/pl/plpython/sql/plpython_test.sql

Don't reset changes_since_analyze after a selective-columns ANALYZE.

commit   : f64340e7436d0f848a99620196cede947bd61418    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Jun 2016 17:44:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Jun 2016 17:44:17 -0400    

Click here for diff

If we ANALYZE only selected columns of a table, we should not postpone  
auto-analyze because of that; other columns may well still need stats  
updates.  As committed, the counter is left alone if a column list is  
given, whether or not it includes all analyzable columns of the table.  
Per complaint from Tomasz Ostrowski.  
  
It's been like this a long time, so back-patch to all supported branches.  
  
Report: <[email protected]>  

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

Stop the executor if no more tuples can be sent from worker to leader.

commit   : c6dbf1fe79287291bc260cbc06b0de419d2a198c    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 6 Jun 2016 14:52:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 6 Jun 2016 14:52:58 -0400    

Click here for diff

If a Gather node has read as many tuples as it needs (for example, due  
to Limit) it may detach the queue connecting it to the worker before  
reading all of the worker's tuples.  Rather than let the worker  
continue to generate and send all of the results, have it stop after  
sending the next tuple.  
  
More could be done here to stop the worker even quicker, but this is  
about as well as we can hope to do for 9.6.  
  
This is in response to a problem report from Andreas Seltenreich.  
Commit 44339b892a04e94bbb472235882dc6f7023bdc65 should be actually be  
sufficient to fix that example even without this change, but it seems  
better to do this, too, since we might otherwise waste quite a large  
amount of effort in one or more workers.  
  
Discussion: CAA4eK1KOKGqmz9bGu+Z42qhRwMbm4R5rfnqsLCNqFs9j14jzEA@mail.gmail.com  
  
Amit Kapila  

M src/backend/access/common/printtup.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/matview.c
M src/backend/executor/execMain.c
M src/backend/executor/execTuples.c
M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/executor/tstoreReceiver.c
M src/backend/tcop/dest.c
M src/backend/tcop/pquery.c
M src/include/access/printtup.h
M src/include/tcop/dest.h

shm_mq: After a send fails with SHM_MQ_DETACHED, later ones should too.

commit   : 44339b892a04e94bbb472235882dc6f7023bdc65    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 6 Jun 2016 14:35:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 6 Jun 2016 14:35:30 -0400    

Click here for diff

Prior to this patch, it was occasionally possible, after shm_mq_sendv  
had previously returned SHM_MQ_DETACHED, for a later shm_mq_sendv  
operation to fail an assertion instead of just again returning  
SHM_MQ_ATTACHED.  From the shm_mq code's point of view, it was  
expecting to be called again with the same arguments, since the  
previous operation had only partially completed.  However, a caller  
who isn't using non-blocking mode won't be prepared to repeat the call  
with the same arguments, and this code shouldn't expect that they  
will.  Repair in such a way that we'll be OK whether the next call  
uses the same arguments or not.  
  
Found by Andreas Seltenreich.  Analysis and sketch of fix by Amit  
Kapila.  Patch by me, reviewed by Amit Kapila.  

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

pg_upgrade: Don't overwrite existing files.

commit   : e191a6900520a28ece9393eec2fdd69f292f12c4    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 6 Jun 2016 09:51:56 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 6 Jun 2016 09:51:56 -0400    

Click here for diff

For historical reasons, copyFile and rewriteVisibilityMap took a force  
argument which was always passed as true, meaning that any existing  
file should be overwritten.  However, it seems much safer to instead  
fail if a file we need to write already exists.  
  
While we're at it, remove the "force" argument altogether, since it was  
never passed as anything other than true (and now we would never pass  
it as anything other than false, if we kept it).  
  
Noted by Andres Freund during post-commit review of the patch that added  
rewriteVisibilityMap, commit 7087166a88fe0c04fc6636d0d6d6bea1737fc1fb,  
but this also changes the behavior when copying files without rewriting  
them.  
  
Patch by Masahiko Sawada.  

M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c

Fix typo.

commit   : 932b97a0112aa950af51dfb26645cd67d368f1f3    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 6 Jun 2016 07:58:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 6 Jun 2016 07:58:50 -0400    

Click here for diff

Jim Nasby  

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

pg_upgrade: Improve error checking in rewriteVisibilityMap.

commit   : aba8943082f1ccbfb19f2e7ff02ba3be0fcb6c9d    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 6 Jun 2016 06:14:21 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 6 Jun 2016 06:14:21 -0400    

Click here for diff

In the old logic, if read() were to return an error, we'd silently stop  
rewriting the visibility map at that point in the file.  That's safe,  
but reporting the error is better, so do that instead.  
  
Report by Andres Freund.  Patch by Masahiko Sawada, with one correction  
by me.  

M src/bin/pg_upgrade/file.c

Fix whitespace

commit   : 6201a8ef3ab1f44853ab3e4b16afeefc969a58bf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 5 Jun 2016 17:02:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 5 Jun 2016 17:02:56 -0400    

Click here for diff

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

Properly initialize SortSupport for ORDER BY rechecks in nodeIndexscan.c.

commit   : 8a859691d548dc4733b8bb302c624fbc012db534    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Jun 2016 11:53:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Jun 2016 11:53:06 -0400    

Click here for diff

Fix still another bug in commit 35fcb1b3d: it failed to fully initialize  
the SortSupport states it introduced to allow the executor to re-check  
ORDER BY expressions containing distance operators.  That led to a null  
pointer dereference if the sortsupport code tried to use ssup_cxt.  The  
problem only manifests in narrow cases, explaining the lack of previous  
field reports.  It requires a GiST-indexable distance operator that lacks  
SortSupport and is on a pass-by-ref data type, which among core+contrib  
seems to be only btree_gist's interval opclass; and it requires the scan  
to be done as an IndexScan not an IndexOnlyScan, which explains how  
btree_gist's regression test didn't catch it.  Per bug #14134 from  
Jihyun Yu.  
  
Peter Geoghegan  
  
Report: <[email protected]>  

M contrib/btree_gist/expected/interval.out
M contrib/btree_gist/sql/interval.sql
M src/backend/executor/nodeIndexscan.c

Update contrib/tsearch2/expected/tsearch2_1.out for phrase FTS.

commit   : de33af88238696c483ce4c2bb8b395cc72ab6e3b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Jun 2016 00:49:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Jun 2016 00:49:42 -0400    

Click here for diff

Commits bb140506d and 38627f687 didn't bother with this.  
Per buildfarm member magpie.  

M contrib/tsearch2/expected/tsearch2_1.out

Fix grammar's AND/OR flattening to work with operator_precedence_warning.

commit   : 05104f693646c0a4ae446e79cb89057497da17e4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2016 19:12:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2016 19:12:29 -0400    

Click here for diff

It'd be good for "(x AND y) AND z" to produce a three-child AND node  
whether or not operator_precedence_warning is on, but that failed to  
happen when it's on because makeAndExpr() didn't look through the added  
AEXPR_PAREN node.  This has no effect on generated plans because prepqual.c  
would flatten the AND nest anyway; but it does affect the number of parens  
printed in ruleutils.c, for example.  I'd already fixed some similar  
hazards in parse_expr.c in commit abb164655, but didn't think to search  
gram.y for problems of this ilk.  Per gripe from Jean-Pierre Pelletier.  
  
Report: <[email protected]>  

M src/backend/parser/gram.y

Inline the easy cases in MakeExpandedObjectReadOnly().

commit   : d50183c5786a21910bac566d2987f955c7bc1d62    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2016 18:34:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2016 18:34:05 -0400    

Click here for diff

This attempts to buy back some of whatever performance we lost from fixing  
bug #14174 by inlining the initial checks in MakeExpandedObjectReadOnly()  
into the callers.  We can do that in a macro without creating multiple-  
evaluation hazards, so it's pretty much free notationally; and the amount  
of code added to callers should be minimal as well.  (Testing a value can't  
take many more instructions than passing it to a subroutine.)  
  
Might as well inline DatumIsReadWriteExpandedObject() while we're at it.  
  
This is an ABI break for callers, so it doesn't seem safe to put into 9.5,  
but I see no reason not to do it in HEAD.  

M src/backend/utils/adt/expandeddatum.c
M src/include/utils/expandeddatum.h

Mark read/write expanded values as read-only in ValuesNext(), too.

commit   : 9eaf5be5067571febf323337fc58bcac97b9f5d5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2016 18:07:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2016 18:07:14 -0400    

Click here for diff

Further thought about bug #14174 motivated me to try the case of a  
R/W datum being returned from a VALUES list, and sure enough it was  
broken.  Fix that.  
  
Also add a regression test case exercising the same scenario for  
FunctionScan.  That's not broken right now, because the function's  
result will get shoved into a tuplestore between generation and use;  
but it could easily become broken whenever we get around to optimizing  
FunctionScan better.  
  
There don't seem to be any other places where we put the result of  
expression evaluation into a virtual tuple slot that could then be  
the source for Vars of further expression evaluation, so I think  
this is the end of this bug.  

M src/backend/executor/nodeValuesscan.c
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Mark read/write expanded values as read-only in ExecProject().

commit   : 69f526aa4947135f2570c4ec545f6387d4b14585    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2016 15:14:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2016 15:14:35 -0400    

Click here for diff

If a plan node output expression returns an "expanded" datum, and that  
output column is referenced in more than one place in upper-level plan  
nodes, we need to ensure that what is returned is a read-only reference  
not a read/write reference.  Otherwise one of the referencing sites could  
scribble on or even delete the expanded datum before we have evaluated the  
others.  Commit 1dc5ebc9077ab742, which introduced this feature, supposed  
that it'd be sufficient to make SubqueryScan nodes force their output  
columns to read-only state.  The folly of that was revealed by bug #14174  
from Andrew Gierth, and really should have been immediately obvious  
considering that the planner will happily optimize SubqueryScan nodes  
out of the plan without any regard for this issue.  
  
The safest fix seems to be to make ExecProject() force its results into  
read-only state; that will cover every case where a plan node returns  
expression results.  Actually we can delegate this to ExecTargetList()  
since we can recursively assume that plain Vars will not reference  
read-write datums.  That should keep the extra overhead down to something  
minimal.  We no longer need ExecMakeSlotContentsReadOnly(), which was  
introduced only in support of the idea that just a few plan node types  
would need to do this.  
  
In the future it would be nice to have the planner account for this problem  
and inject force-to-read-only expression evaluation nodes into only the  
places where there's a risk of multiple evaluation.  That's not a suitable  
solution for 9.5 or even 9.6 at this point, though.  
  
Report: <[email protected]>  

M src/backend/executor/execQual.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeSubqueryscan.c
M src/include/executor/tuptable.h
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Remove bogus code to apply PathTargets to partial paths.

commit   : 04ae11f62e643e07c411c4935ea6af46cb112aa9    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Jun 2016 14:27:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Jun 2016 14:27:33 -0400    

Click here for diff

The partial paths that get modified may already have been used as  
part of a GatherPath which appears in the path list, so modifying  
them is not a good idea at this stage - especially because this  
code has no check that the PathTarget is in fact parallel-safe.  
  
When partial aggregation is being performed, this is actually  
harmless because we'll end up replacing the pathtargets here with  
the correct ones within create_grouping_paths().  But if we've got  
a query tree containing only scan/join operations then this can  
result in incorrectly pushing down parallel-restricted target  
list entries.  If those are, for example, references to subqueries,  
that can crash the server; but it's wrong in any event.  
  
Amit Kapila  

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

Mark PostmasterPid as PGDLLIMPORT.

commit   : cac8321970e9fd18730b2ca4e15f2c61dd326053    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Jun 2016 13:50:51 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Jun 2016 13:50:51 -0400    

Click here for diff

This is so that extensions can use it.  
  
Michael Paquier  

M src/include/miscadmin.h

Add new snapshot fields to serialize/deserialize functions.

commit   : 370a46fc015115bfeccde4eb208d82049f792f9f    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 3 Jun 2016 11:13:28 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 3 Jun 2016 11:13:28 -0500    

Click here for diff

The "snapshot too old" condition was not being recognized when  
using a copied snapshot, since the original timestamp and lsn were  
not being passed along.  Noticed when testing the combination of  
"snapshot too old" with parallel query execution.  

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

Fix comment to be more accurate.

commit   : 6436a853f11952495f10e62d8b52b465e119155c    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Jun 2016 11:51:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Jun 2016 11:51:50 -0400    

Click here for diff

Now that we skip vacuuming all-frozen pages, this comment needs  
updating.  
  
Masahiko Sawada  

M src/backend/commands/vacuumlazy.c

Suppress -Wunused-result warnings about write(), again.

commit   : 6c72a28e5ce36a964bbcac2fe6b0b7bcd9251667    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2016 11:29:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2016 11:29:20 -0400    

Click here for diff

Adopt the same solution as in commit aa90e148ca70a235, but this time  
let's put the ugliness inside the write_stderr() macro, instead of  
expecting each call site to deal with it.  Back-port that decision  
into psql/common.c where I got the macro from in the first place.  
  
Per gripe from Peter Eisentraut.  

M src/bin/pg_dump/parallel.c
M src/bin/psql/common.c

Fix various common mispellings.

commit   : e1623c3959aac707732d7a6ad09adfb5751763b3    
  
author   : Greg Stark <[email protected]>    
date     : Fri, 3 Jun 2016 15:13:36 +0100    
  
committer: Greg Stark <[email protected]>    
date     : Fri, 3 Jun 2016 15:13:36 +0100    

Click here for diff

Mostly these are just comments but there are a few in documentation  
and a handful in code and tests. Hopefully this doesn't cause too much  
unnecessary pain for backpatching. I relented from some of the most  
common like "thru" for that reason. The rest don't seem numerous  
enough to cause problems.  
  
Thanks to Kevin Lyda's tool https://pypi.python.org/pypi/misspellings  

M doc/src/sgml/config.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/backend/access/transam/generic_xlog.c
M src/backend/catalog/namespace.c
M src/backend/catalog/sql_features.txt
M src/backend/commands/cluster.c
M src/backend/main/main.c
M src/backend/nodes/README
M src/backend/optimizer/util/tlist.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/walsender.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/smgr/md.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/resowner/resowner.c
M src/bin/pg_dump/dumputils.c
M src/include/port/win32.h
M src/include/storage/freespace.h
M src/test/modules/test_ddl_deparse/README
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql
M src/tools/msvc/Project.pm

Measure Bloom index signature-length reloption in bits, not words.

commit   : ee4af347ba89b8492d1f86b6456865e1de1d030f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2016 10:52:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2016 10:52:36 -0400    

Click here for diff

Per discussion, this is a more understandable and future-proof way of  
exposing the setting to users.  On-disk, we can still store it in words,  
so as to not break on-disk compatibility with beta1.  
  
Along the way, clean up the code associated with Bloom reloptions.  
Provide explicit macros for default and maximum lengths rather than  
having magic numbers buried in multiple places in the code.  Drop  
the adjustBloomOptions() code altogether: it was useless in view of  
the fact that reloptions.c already performed default-substitution and  
range checking for the options.  Rename a couple of macros and types  
for more clarity.  
  
Discussion: <[email protected]>  

M contrib/bloom/bloom.h
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M doc/src/sgml/bloom.sgml

Cosmetic improvements to freeze map code.

commit   : fdfaccfa798c1c9993feae1fac6e0f79d72aa7b7    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Jun 2016 08:43:41 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Jun 2016 08:43:41 -0400    

Click here for diff

Per post-commit review comments from Andres Freund, improve variable  
names, comments, and in one place, slightly improve the code structure.  
  
Masahiko Sawada  

M src/backend/access/heap/visibilitymap.c
M src/backend/commands/vacuumlazy.c
M src/include/access/visibilitymap.h

Be conservative about alignment requirements of struct epoll_event.

commit   : a3b30763cc8686f5b4cd121ef0bf510c1533ac22    
  
author   : Greg Stark <[email protected]>    
date     : Thu, 2 Jun 2016 19:23:25 +0100    
  
committer: Greg Stark <[email protected]>    
date     : Thu, 2 Jun 2016 19:23:25 +0100    

Click here for diff

Use MAXALIGN size/alignment to guarantee that later uses of memory are  
aligned correctly. E.g. epoll_event might need 8 byte alignment on some  
platforms, but earlier allocations like WaitEventSet and WaitEvent might  
not sized to guarantee that when purely using sizeof().  
  
Found by myself while testing on an Sun Ultra 5 (Sparc IIi) with some  
editorializing by Andres Freund.  
  
In passing fix a couple typos in the area  

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

C comment improvement & typo fix.

commit   : 4edb7bd2fd6a48f6104c73551423cb208e13e529    
  
author   : Kevin Grittner <[email protected]>    
date     : Thu, 2 Jun 2016 12:52:41 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Thu, 2 Jun 2016 12:52:41 -0500    

Click here for diff

Thomas Munro  

M src/include/access/nbtree.h

Redesign handling of SIGTERM/control-C in parallel pg_dump/pg_restore.

commit   : e652273e073566b67c2fd36a5754b3fad2bc0291    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Jun 2016 13:27:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Jun 2016 13:27:53 -0400    

Click here for diff

Formerly, Unix builds of pg_dump/pg_restore would trap SIGINT and similar  
signals and set a flag that was tested in various data-transfer loops.  
This was prone to errors of omission (cf commit 3c8aa6654); and even if  
the client-side response was prompt, we did nothing that would cause  
long-running SQL commands (e.g. CREATE INDEX) to terminate early.  
Also, the master process would effectively do nothing at all upon receipt  
of SIGINT; the only reason it seemed to work was that in typical scenarios  
the signal would also be delivered to the child processes.  We should  
support termination when a signal is delivered only to the master process,  
though.  
  
Windows builds had no console interrupt handler, so they would just fall  
over immediately at control-C, again leaving long-running SQL commands to  
finish unmolested.  
  
To fix, remove the flag-checking approach altogether.  Instead, allow the  
Unix signal handler to send a cancel request directly and then exit(1).  
In the master process, also have it forward the signal to the children.  
On Windows, add a console interrupt handler that behaves approximately  
the same.  The main difference is that a single execution of the Windows  
handler can send all the cancel requests since all the info is available  
in one process, whereas on Unix each process sends a cancel only for its  
own database connection.  
  
In passing, fix an old problem that DisconnectDatabase tends to send a  
cancel request before exiting a parallel worker, even if nothing went  
wrong.  This is at least a waste of cycles, and could lead to unexpected  
log messages, or maybe even data loss if it happened in pg_restore (though  
in the current code the problem seems to affect only pg_dump).  The cause  
was that after a COPY step, pg_dump was leaving libpq in PGASYNC_BUSY  
state, causing PQtransactionStatus() to report PQTRANS_ACTIVE.  That's  
normally harmless because the next PQexec() will silently clear the  
PGASYNC_BUSY state; but in a parallel worker we might exit without any  
additional SQL commands after a COPY step.  So add an extra PQgetResult()  
call after a COPY to allow libpq to return to PGASYNC_IDLE state.  
  
This is a bug fix, IMO, so back-patch to 9.3 where parallel dump/restore  
were introduced.  
  
Thanks to Kyotaro Horiguchi for Windows testing and code suggestions.  
  
Original-Patch: <[email protected]>  
Discussion: <[email protected]>  

M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_dump.c

Fix btree mark/restore bug.

commit   : 7392eed7c2a327eb1b496f30a64be33404bcf82e    
  
author   : Kevin Grittner <[email protected]>    
date     : Thu, 2 Jun 2016 12:23:01 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Thu, 2 Jun 2016 12:23:01 -0500    

Click here for diff

Commit 2ed5b87f96d473962ec5230fd820abfeaccb2069 introduced a bug in  
mark/restore, in an attempt to optimize repeated restores to the  
same page.  This caused an assertion failure during a merge join  
which fed directly from an index scan, although the impact would  
not be limited to that case.  Revert the bad chunk of code from  
that commit.  
  
While investigating this bug it was discovered that a particular  
"paranoia" set of the mark position field would not prevent bad  
behavior; it would just make it harder to diagnose.  Change that  
into an assertion, which will draw attention to any future problem  
in that area more directly.  
  
Backpatch to 9.5, where the bug was introduced.  
  
Bug #14169 reported by Shinta Koyanagi.  
Preliminary analysis by Tom Lane identified which commit caused  
the bug.  

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

Clean up some minor inefficiencies in parallel dump/restore.

commit   : 763eec6b6d64767f5b2dd1a1fe314923bbc17968    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Jun 2016 16:14:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Jun 2016 16:14:21 -0400    

Click here for diff

Parallel dump did a totally pointless query to find out the name of each  
table to be dumped, which it already knows.  Parallel restore runs issued  
lots of redundant SET commands because _doSetFixedOutputState() was invoked  
once per TOC item rather than just once at connection start.  While the  
extra queries are insignificant if you're dumping or restoring large  
tables, it still seems worth getting rid of them.  
  
Also, give the responsibility for selecting the right client_encoding for  
a parallel dump worker to setup_connection() where it naturally belongs,  
instead of having ad-hoc code for that in CloneArchive().  And fix some  
minor bugs like use of strdup() where pg_strdup() would be safer.  
  
Back-patch to 9.3, mostly to keep the branches in sync in an area that  
we're still finding bugs in.  
  
Discussion: <[email protected]>  

M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c

doc: Update version() and current_date output in tutorial

commit   : 9ee56dfeee0389d61020db3c6a47bd2690bd040e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 31 May 2016 16:45:02 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 31 May 2016 16:45:02 -0400    

Click here for diff

While the version number is automatically updated in the example output,  
the other details looked a bit dated.  
  
suggested by [email protected]  

M doc/src/sgml/start.sgml

Avoid useless closely-spaced writes of statistics files.

commit   : 22b27b4c9eda1ef166309be1f5702277e3a805f8    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 May 2016 15:54:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 May 2016 15:54:46 -0400    

Click here for diff

The original intent in the stats collector was that we should not write out  
stats data oftener than every PGSTAT_STAT_INTERVAL msec.  Backends will not  
make requests at all if they see the existing data is newer than that, and  
the stats collector is supposed to disregard requests having a cutoff_time  
older than its most recently written data, so that close-together requests  
don't result in multiple writes.  But the latter part of that got broken  
in commit 187492b6c2e8cafc, so that if two backends concurrently decide  
the existing stats are too old, the collector would write the data twice.  
(In principle the collector's logic would still merge requests as long as  
the second one arrives before we've actually written data ... but since  
the message collection loop would write data immediately after processing  
a single inquiry message, that never happened in practice, and in any case  
the window in which it might work would be much shorter than  
PGSTAT_STAT_INTERVAL.)  
  
To fix, improve pgstat_recv_inquiry so that it checks whether the cutoff  
time is too old, and doesn't add a request to the queue if so.  This means  
that we do not need DBWriteRequest.request_time, because the decision is  
taken before making a queue entry.  And that means that we don't really  
need the DBWriteRequest data structure at all; an OID list of database  
OIDs will serve and allow removal of some rather verbose and crufty code.  
  
In passing, improve the comments in this area, which have been rather  
neglected.  Also change backend_read_statsfile so that it's not silently  
relying on MyDatabaseId to have some particular value in the autovacuum  
launcher process.  It accidentally worked as desired because MyDatabaseId  
is zero in that process; but that does not seem like a dependency we want,  
especially with no documentation about it.  
  
Although this patch is mine, it turns out I'd rediscovered a known bug,  
for which Tomas Vondra had already submitted a patch that's functionally  
equivalent to the non-cosmetic aspects of this patch.  Thanks to Tomas  
for reviewing this version.  
  
Back-patch to 9.3 where the bug was introduced.  
  
Prior-Discussion: <[email protected]>  
Patch: <[email protected]>  

M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Fix whitespace

commit   : aa14bc41d1b139fc7b8b3cdd23e422fad86a9b9b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 31 May 2016 13:56:25 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 31 May 2016 13:56:25 -0400    

Click here for diff

M doc/src/sgml/bloom.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/pgtesttiming.sgml
M doc/src/sgml/spgist.sgml

Fix typo in CREATE DATABASE syntax synopsis.

commit   : 6d69ea33180263403f0377e420e4035105ef8627    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 May 2016 12:05:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 May 2016 12:05:22 -0400    

Click here for diff

Misplaced "]", evidently a thinko in commit 213335c14.  

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

Mirror struct Aggref field order in _copyAggref().

commit   : 2195c5afaabd4d794c8bbf1bf10d8e4fe54b6145    
  
author   : Noah Misch <[email protected]>    
date     : Tue, 31 May 2016 00:01:03 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Tue, 31 May 2016 00:01:03 -0400    

Click here for diff

This is cosmetic, and no supported release has the affected fields.  

M src/backend/nodes/copyfuncs.c

Move memory barrier in UnlockBufHdr to before releasing the lock.

commit   : 87a3023c60f4bab551441492652ef19371847fd3    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 30 May 2016 15:35:53 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 30 May 2016 15:35:53 -0700    

Click here for diff

This bug appears to have been introduced late in the development of  
48354581a4 ("Allow Pin/UnpinBuffer to operate in a lockfree  
manner.").  
  
Found while debugging a bug which turned out to be independent of the  
commit mentioned above.  
  
Backpatch: -  

M src/include/storage/buf_internals.h

Fix PageAddItem BRIN bug

commit   : 975ad4e602ff5793f2e57cfc883780dd5ff645a0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 May 2016 14:47:22 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 May 2016 14:47:22 -0400    

Click here for diff

BRIN was relying on the ability to remove a tuple from an index page,  
then putting another tuple in the same line pointer.  But PageAddItem  
refuses to add a tuple beyond the first free item past the last used  
item, and in particular, it rejects an attempt to add an item to an  
empty page anywhere other than the first line pointer.  PageAddItem  
issues a WARNING and indicates to the caller that it failed, which in  
turn causes the BRIN calling code to issue a PANIC, so the whole  
sequence looks like this:  
	WARNING:  specified item offset is too large  
	PANIC:  failed to add BRIN tuple  
  
To fix, create a new function PageAddItemExtended which is like  
PageAddItem except that the two boolean arguments become a flags bitmap;  
the "overwrite" and "is_heap" boolean flags in PageAddItem become  
PAI_OVERWITE and PAI_IS_HEAP flags in the new function, and a new flag  
PAI_ALLOW_FAR_OFFSET enables the behavior required by BRIN.  
PageAddItem() retains its original signature, for compatibility with  
third-party modules (other callers in core code are not modified,  
either).  
  
Also, in the belt-and-suspenders spirit, I added a new sanity check in  
brinGetTupleForHeapBlock to raise an error if an TID found in the revmap  
is not marked as live by the page header.  This causes it to react with  
"ERROR: corrupted BRIN index" to the bug at hand, rather than a hard  
crash.  
  
Backpatch to 9.5.  
  
Bug reported by Andreas Seltenreich as detected by his handy sqlsmith  
fuzzer.  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_xlog.c
M src/backend/storage/page/bufpage.c
M src/include/storage/bufpage.h

Fix missing abort checks in pg_backup_directory.c.

commit   : 3c8aa6654a44837a2c60fc6061665df1adfd677c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 May 2016 13:18:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 May 2016 13:18:48 -0400    

Click here for diff

Parallel restore from directory format failed to respond to control-C  
in a timely manner, because there were no checkAborting() calls in the  
code path that reads data from a file and sends it to the backend.  
If any worker was in the midst of restoring data for a large table,  
you'd just have to wait.  
  
This fix doesn't do anything for the problem of aborting a long-running  
server-side command, but at least it fixes things for data transfers.  
  
Back-patch to 9.3 where parallel restore was introduced.  

M src/bin/pg_dump/pg_backup_directory.c

Remove pg_dump/parallel.c's useless "aborting" flag.

commit   : 210981a4a9fdd19cb299f248a7ecc25db9bf7d9d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 May 2016 13:00:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 May 2016 13:00:09 -0400    

Click here for diff

This was effectively dead code, since the places that tested it could not  
be reached after we entered the on-exit-cleanup routine that would set it.  
It seems to have been a leftover from a design in which error abort would  
try to send fresh commands to the workers --- a design which could never  
have worked reliably, of course.  Since the flag is not cross-platform, it  
complicates reasoning about the code's behavior, which we could do without.  
  
Although this is effectively just cosmetic, back-patch anyway, because  
there are some actual bugs in the vicinity of this behavior.  
  
Discussion: <[email protected]>  

M src/bin/pg_dump/parallel.c

Lots of comment-fixing, and minor cosmetic cleanup, in pg_dump/parallel.c.

commit   : 6b3094c26f9ec8688d802e71562e9be714cfe6ac    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 May 2016 14:02:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 May 2016 14:02:11 -0400    

Click here for diff

The commentary in this file was in extremely sad shape.  The author(s)  
had clearly never heard of the project convention that a function header  
comment should provide an API spec of some sort for that function.  Much  
of it was flat out wrong, too --- maybe it was accurate when written, but  
if so it had not been updated to track subsequent code revisions.  Rewrite  
and rearrange to try to bring it up to speed, and annotate some of the  
places where more work is needed.  (I've refrained from actually fixing  
anything of substance ... yet.)  
  
Also, rename a couple of functions for more clarity as to what they do,  
do some very minor code rearrangement, remove some pointless Asserts,  
fix an incorrect Assert in readMessageFromPipe, and add a missing socket  
close in one error exit from pgpipe().  The last would be a bug if we  
tried to continue after pgpipe() failure, but since we don't, it's just  
cosmetic at present.  
  
Although this is only cosmetic, back-patch to 9.3 where parallel.c was  
added.  It's sufficiently invasive that it'll pose a hazard for future  
back-patching if we don't.  
  
Discussion: <[email protected]>  

M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_archiver.c

Clean up thread management in parallel pg_dump for Windows.

commit   : 807b45375beae6563c3833e72d91869e9b9134e5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 May 2016 12:02:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 May 2016 12:02:09 -0400    

Click here for diff

Since we start the worker threads with _beginthreadex(), we should use  
_endthreadex() to terminate them.  We got this right in the normal-exit  
code path, but not so much during an error exit from a worker.  
In addition, be sure to apply CloseHandle to the thread handle after  
each thread exits.  
  
It's not clear that these oversights cause any user-visible problems,  
since the pg_dump run is about to terminate anyway.  Still, it's clearly  
better to follow Microsoft's API specifications than ignore them.  
  
Also a few cosmetic cleanups in WaitForTerminatingWorkers(), including  
being a bit less random about where to cast between uintptr_t and HANDLE,  
and being sure to clear the worker identity field for each dead worker  
(not that false matches should be possible later, but let's be careful).  
  
Original observation and patch by Armin Schöffmann, cosmetic improvements  
by Michael Paquier and me.  (Armin's patch also included closing sockets  
in ShutdownWorkersHard(), but that's been dealt with already in commit  
df8d2d8c4.)  Back-patch to 9.3 where parallel pg_dump was introduced.  
  
Discussion: <[email protected]>  

M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_utils.c

Fix release-note typo.

commit   : d81ecb9b204ae4aaf10b6a056447fe4ee853d195    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 May 2016 11:07:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 May 2016 11:07:23 -0400    

Click here for diff

Léonard Benedetti  

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

Fix DROP ACCESS METHOD IF EXISTS.

commit   : 83dbde94f726f2517a79b1cea59e57452c36e734    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 May 2016 11:03:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 May 2016 11:03:18 -0400    

Click here for diff

The IF EXISTS option was documented, and implemented in the grammar, but  
it didn't actually work for lack of support in does_not_exist_skipping().  
Per bug #14160.  
  
Report and patch by Kouhei Sutou  
  
Report: <[email protected]>  

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

Be more predictable about reporting "lock timeout" vs "statement timeout".

commit   : 9dd4178cec3ffd825a4bef558632b7cba3e426c5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 May 2016 10:40:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 May 2016 10:40:20 -0400    

Click here for diff

If both timeout indicators are set when we arrive at ProcessInterrupts,  
we've historically just reported "lock timeout".  However, some buildfarm  
members have been observed to fail isolationtester's timeouts test by  
reporting "lock timeout" when the statement timeout was expected to fire  
first.  The cause seems to be that the process is allowed to sleep longer  
than expected (probably due to heavy machine load) so that the lock  
timeout happens before we reach the point of reporting the error, and  
then this arbitrary tiebreak rule does the wrong thing.  We can improve  
matters by comparing the scheduled timeout times to decide which error  
to report.  
  
I had originally proposed greatly reducing the 1-second window between  
the two timeouts in the test cases.  On reflection that is a bad idea,  
at least for the case where the lock timeout is expected to fire first,  
because that would assume that it takes negligible time to get from  
statement start to the beginning of the lock wait.  Thus, this patch  
doesn't completely remove the risk of test failures on slow machines.  
Empirically, however, the case this handles is the one we are seeing  
in the buildfarm.  The explanation may be that the other case requires  
the scheduler to take the CPU away from a busy process, whereas the  
case fixed here only requires the scheduler to not give the CPU back  
right away to a process that has been woken from a multi-second sleep  
(and, perhaps, has been swapped out meanwhile).  
  
Back-patch to 9.3 where the isolationtester timeouts test was added.  
  
Discussion: <[email protected]>  

M src/backend/tcop/postgres.c
M src/backend/utils/misc/timeout.c
M src/include/utils/timeout.h

Make pg_dump error cleanly with -j against hot standby

commit   : d74048defcb1f48c5cc5a1b2a8aa0f7da8663394    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 26 May 2016 22:14:23 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 26 May 2016 22:14:23 +0200    

Click here for diff

Getting a synchronized snapshot is not supported on a hot standby node,  
and is by default taken when using -j with multiple sessions. Trying to  
do so still failed, but with a server error that would also go in the  
log. Instead, proprely detect this case and give a better error message.  

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

Disable physical tlist if any Var would need multiple sortgroupref labels.

commit   : aeb9ae6457865c8949641d71a9523374d843a418    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 May 2016 14:52:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 May 2016 14:52:24 -0400    

Click here for diff

As part of upper planner pathification (commit 3fc6e2d7f5b652b4) I redid  
createplan.c's approach to the physical-tlist optimization, in which scan  
nodes are allowed to return exactly the underlying table's columns so as  
to save doing a projection step at runtime.  The logic was intentionally  
more aggressive than before about applying the optimization, which is  
generally a good thing, but Andres Freund found a case in which it got  
too aggressive.  Namely, if any column is referenced more than once in  
the parent plan node's sorting or grouping column list, we can't optimize  
because then that column would need to have more than one ressortgroupref  
label, and we only have space for one.  
  
Add logic to detect this situation in use_physical_tlist(), and also add  
some error checking in apply_pathtarget_labeling_to_tlist(), which this  
example proves was being overly cavalier about whether what it was doing  
made any sense.  
  
The added test case exposes the problem only because we do not eliminate  
duplicate grouping keys.  That might be something to fix someday, but it  
doesn't seem like appropriate post-beta work.  
  
Report: <[email protected]>  

M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/tlist.c
M src/test/regress/expected/select_distinct.out
M src/test/regress/sql/select_distinct.sql

Fix typo in 9.5 release nodes

commit   : d7ef3572a8a17cd6c495d7593ea94a2cf2c076e3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 26 May 2016 11:58:22 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 26 May 2016 11:58:22 -0400    

Click here for diff

Noted by 星合 拓馬 (HOSHIAI Takuma)  

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

Make pg_dump behave more sanely when built without HAVE_LIBZ.

commit   : cae2bb1986bc8fd409424562638434d588d0201f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 May 2016 11:51:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 May 2016 11:51:04 -0400    

Click here for diff

For some reason the code to emit a warning and switch to uncompressed  
output was placed down in the guts of pg_backup_archiver.c.  This is  
definitely too late in the case of parallel operation (and I rather  
wonder if it wasn't too late for other purposes as well).  Put it in  
pg_dump.c's option-processing logic, which seems a much saner place.  
  
Also, the default behavior with custom or directory output format was  
to emit the warning telling you the output would be uncompressed.  This  
seems unhelpful, so silence that case.  
  
Back-patch to 9.3 where parallel dump was introduced.  
  
Kyotaro Horiguchi, adjusted a bit by me  
  
Report: <[email protected]>  

M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c

In Windows pg_dump, ensure idle workers will shut down during error exit.

commit   : df8d2d8c42c5731ad997793cb6a59b617532dffa    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 May 2016 10:50:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 May 2016 10:50:30 -0400    

Click here for diff

The Windows coding of ShutdownWorkersHard() thought that setting termEvent  
was sufficient to make workers exit after an error.  But that only helps  
if a worker is busy and passes through checkAborting().  An idle worker  
will just sit, resulting in pg_dump failing to exit until the user gives up  
and hits control-C.  We should close the write end of the command pipe  
so that idle workers will see socket EOF and exit, as the Unix coding was  
already doing.  
  
Back-patch to 9.3 where parallel pg_dump was introduced.  
  
Kyotaro Horiguchi  

M src/bin/pg_dump/parallel.c

Remove option to write USING before opclass name in CREATE INDEX.

commit   : b898eb63678d96482c1519c44f8ead073adf9bb7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 May 2016 19:11:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 May 2016 19:11:00 -0400    

Click here for diff

Dating back to commit f10b63923, our grammar has allowed "USING" to  
optionally appear before an opclass name in CREATE INDEX (and, lately,  
some related places such as ON CONFLICT specifications).  Nikolay Shaplov  
noticed that this syntax existed but wasn't documented, and proposed  
documenting it.  But what seems like a better idea is to remove the  
production, thereby making the code match the docs not vice versa.  
This isn't our usual modus operandi for such cases, but there are a  
couple of good reasons to proceed this way:  
  
* So far as I can find, this syntax has never been documented anywhere.  
It isn't relied on by any of our own code or test cases, and there seems  
little reason to suppose that it's been used in the wild either.  
  
* Documenting it would mean that there would be two separate uses of  
USING in the CREATE INDEX syntax, the other being "USING access_method".  
That can lead to nothing but confusion.  
  
So, let's just remove it.  On the off chance that somebody somewhere  
is using it, this isn't something to back-patch, but we can fix it  
in HEAD.  
  
Discussion: <1593237.l7oKHRpxSe@nataraj-amd64>  

M src/backend/parser/gram.y

Ensure that backends see up-to-date statistics for shared catalogs.

commit   : 52e8fc3e2e66446e5705904cf7d884d5d669591f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 May 2016 17:48:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 May 2016 17:48:15 -0400    

Click here for diff

Ever since we split the statistics collector's reports into per-database  
files (commit 187492b6c2e8cafc), backends have been seeing stale statistics  
for shared catalogs.  This is because the inquiry message only prompts the  
collector to write the per-database file for the requesting backend's own  
database.  Stats for shared catalogs are in a separate file for "DB 0",  
which didn't get updated.  
  
In normal operation this was partially masked by the fact that the  
autovacuum launcher would send an inquiry message at least once per  
autovacuum_naptime that asked for "DB 0"; so the shared-catalog stats would  
never be more than a minute out of date.  However the problem becomes very  
obvious with autovacuum disabled, as reported by Peter Eisentraut.  
  
To fix, redefine the semantics of inquiry messages so that both the  
specified DB and DB 0 will be dumped.  (This might seem a bit inefficient,  
but we have no good way to know whether a backend's transaction will look  
at shared-catalog stats, so we have to read both groups of stats whenever  
we request stats.  Sending two inquiry messages would definitely not be  
better.)  
  
Back-patch to 9.3 where the bug was introduced.  
  
Report: <[email protected]>  

M src/backend/postmaster/pgstat.c

Fix broken error handling in parallel pg_dump/pg_restore.

commit   : 9abd64ec997cc5f0bac485aa1585064308f73c83    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 May 2016 12:39:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 May 2016 12:39:57 -0400    

Click here for diff

In the original design for parallel dump, worker processes reported errors  
by sending them up to the master process, which would print the messages.  
This is unworkably fragile for a couple of reasons: it risks deadlock if a  
worker sends an error at an unexpected time, and if the master has already  
died for some reason, the user will never get to see the error at all.  
Revert that idea and go back to just always printing messages to stderr.  
This approach means that if all the workers fail for similar reasons (eg,  
bad password or server shutdown), the user will see N copies of that  
message, not only one as before.  While that's slightly annoying, it's  
certainly better than not seeing any message; not to mention that we  
shouldn't assume that only the first failure is interesting.  
  
An additional problem in the same area was that the master failed to  
disable SIGPIPE (at least until much too late), which meant that sending a  
command to an already-dead worker would cause the master to crash silently.  
That was bad enough in itself but was made worse by the total reliance on  
the master to print errors: even if the worker had reported an error, you  
would probably not see it, depending on timing.  Instead disable SIGPIPE  
right after we've forked the workers, before attempting to send them  
anything.  
  
Additionally, the master relies on seeing socket EOF to realize that a  
worker has exited prematurely --- but on Windows, there would be no EOF  
since the socket is attached to the process that includes both the master  
and worker threads, so it remains open.  Make archive_close_connection()  
close the worker end of the sockets so that this acts more like the Unix  
case.  It's not perfect, because if a worker thread exits without going  
through exit_nicely() the closures won't happen; but that's not really  
supposed to happen.  
  
This has been wrong all along, so back-patch to 9.3 where parallel dump  
was introduced.  
  
Report: <[email protected]>  

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

Update doc text to reflect new column in MVCC phenomena table.

commit   : 627e360358e3beb67cd2f54393835f979c5e30b7    
  
author   : Kevin Grittner <[email protected]>    
date     : Wed, 25 May 2016 11:17:08 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Wed, 25 May 2016 11:17:08 -0500    

Click here for diff

Scott Wehrenberg  

M doc/src/sgml/mvcc.sgml

Do not DROP default roles in pg_dumpall -c

commit   : 018eb027f181234be7a580e9502c40ac5ad04f77    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 24 May 2016 23:31:55 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 24 May 2016 23:31:55 -0400    

Click here for diff

When pulling the list of roles to drop, exclude roles whose names  
begin with "pg_" (as we do when we are dumping the roles out to  
recreate them).  
  
Also add regression tests to cover pg_dumpall -c and this specific  
issue.  
  
Noticed by Rushabh Lathia.  Patch by me.  

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

Mark wal_level as PGDLLIMPORT.

commit   : f5e7b2f910b7cdb51b7369c76627998432ab6821    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 May 2016 22:48:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 May 2016 22:48:47 -0400    

Click here for diff

Per buildfarm, this is needed to allow extensions to use XLogIsNeeded()  
in Windows builds.  

M src/include/access/xlog.h

Fix contrib/bloom to work for unlogged indexes.

commit   : abaffa907588283f7673fc223857e6966421b8ca    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 May 2016 21:04:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 May 2016 21:04:23 -0400    

Click here for diff

blbuildempty did not do even approximately the right thing: it tried  
to add a metapage to the relation's regular data fork, which already  
has one at that point.  It should look like the ambuildempty methods  
for all the standard index types, ie, initialize a metapage image in  
some transient storage and then write it directly to the init fork.  
To support that, refactor BloomInitMetapage into two functions.  
  
In passing, fix BloomInitMetapage so it doesn't leave the rd_options  
field of the index's relcache entry pointing at transient storage.  
I'm not sure this had any visible consequence, since nothing much  
else is likely to look at a bloom index's rd_options, but it's  
certainly poor practice.  
  
Per bug #14155 from Zhou Digoal.  
  
Report: <[email protected]>  

M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blutils.c
M contrib/bloom/expected/bloom.out
M contrib/bloom/sql/bloom.sql

Qualify table usage in dumpTable() and use regclass

commit   : 2e8b4bf80473d0e4a4254b417424e79195a9ce6a    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 24 May 2016 20:10:16 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 24 May 2016 20:10:16 -0400    

Click here for diff

All of the other tables used in the query in dumpTable(), which is  
collecting column-level ACLs, are qualified, so we should be qualifying  
the pg_init_privs, the related sub-select against pg_class and the  
other queries added by the pg_dump catalog ACLs work.  
  
Also, use ::regclass (or ::pg_catalog.regclass, where appropriate)  
instead of using a poorly constructed query to get the OID for various  
catalog tables.  
  
Issues identified by Noah and Alvaro, patch by me.  

M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_dump.c
M src/test/modules/test_pg_dump/t/001_base.pl

Fetch XIDs atomically during vac_truncate_clog().

commit   : 2d2e40e3befd8b9e0d2757554537345b15fa6ea2    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 May 2016 15:47:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 May 2016 15:47:51 -0400    

Click here for diff

Because vac_update_datfrozenxid() updates datfrozenxid and datminmxid  
in-place, it's unsafe to assume that successive reads of those values will  
give consistent results.  Fetch each one just once to ensure sane behavior  
in the minimum calculation.  Noted while reviewing Alexander Korotkov's  
patch in the same area.  
  
Discussion: <[email protected]>  

M src/backend/commands/vacuum.c

Avoid consuming an XID during vac_truncate_clog().

commit   : 996d273978c6f21b8b66f7f3bdd979cc37736c7a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 May 2016 15:20:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 May 2016 15:20:12 -0400    

Click here for diff

vac_truncate_clog() uses its own transaction ID as the comparison point in  
a sanity check that no database's datfrozenxid has already wrapped around  
"into the future".  That was probably fine when written, but in a lazy  
vacuum we won't have assigned an XID, so calling GetCurrentTransactionId()  
causes an XID to be assigned when otherwise one would not be.  Most of the  
time that's not a big problem ... but if we are hard up against the  
wraparound limit, consuming XIDs during antiwraparound vacuums is a very  
bad thing.  
  
Instead, use ReadNewTransactionId(), which not only avoids this problem  
but is in itself a better comparison point to test whether wraparound  
has already occurred.  
  
Report and patch by Alexander Korotkov.  Back-patch to all versions.  
  
Report: <CAPpHfdspOkmiQsxh-UZw2chM6dRMwXAJGEmmbmqYR=yvM7-s6A@mail.gmail.com>  

M src/backend/commands/vacuum.c

Fix range check for effective_io_concurrency

commit   : 0c7cd45b6d702253c09427929bcceb6e7fe9029a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 24 May 2016 14:55:34 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 24 May 2016 14:55:34 -0400    

Click here for diff

Commit 1aba62ec moved the range check of that option form guc.c into  
bufmgr.c, but introduced a bug by changing a >= 0.0 to > 0.0, which made  
the value 0 no longer accepted.  Put it back.  
  
Reported by Jeff Janes, diagnosed by Tom Lane  

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

Docs: mention pg_reload_conf() in ALTER SYSTEM reference page.

commit   : c45fb43c8448c5b710d4ef9774497e1789e070e5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 May 2016 14:04:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 May 2016 14:04:29 -0400    

Click here for diff

Takayuki Tsunakawa  
  
Discussion: <0A3221C70F24FB45833433255569204D1F578FC3@G01JPEXMBYT05>  

M doc/src/sgml/ref/alter_system.sgml

In examples of Oracle PL/SQL code, use varchar2 not varchar.

commit   : 23f11dc21b0135702a2852aac927bdc4f9d69cef    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 May 2016 13:30:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 May 2016 13:30:40 -0400    

Click here for diff

Oracle recommends using VARCHAR2 not VARCHAR, allegedly because they might  
someday change VARCHAR to be spec-compliant about distinguishing null from  
empty string.  (I'm not holding my breath, though.)  Our examples of PL/SQL  
code were using VARCHAR, which while not wrong is missing the pedagogical  
opportunity to talk about converting Oracle type names to Postgres.  So  
switch the examples to use VARCHAR2, and add some text about what to do  
with common Oracle type names like VARCHAR2 and NUMBER.  (There is probably  
more to be said here, but those are the ones I'm sure about offhand.)  
Per suggestion from [email protected].  
  
Discussion: <[email protected]>  

M doc/src/sgml/plpgsql.sgml

Fix typo in docs

commit   : 6ee7fb8244560b7a3f224784b8ad2351107fa55d    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 24 May 2016 15:27:48 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 24 May 2016 15:27:48 +0300    

Click here for diff

Add missing USING BLOOM in example of contrib/bloom  
  
Nikolay Shaplov  

M doc/src/sgml/bloom.sgml

Fix typo in TAP test identification string.

commit   : 1087aa2314c7755cd436e37b95b84ba2c35b987c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 May 2016 20:04:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 May 2016 20:04:27 -0400    

Click here for diff

Michael Paquier  

M src/bin/initdb/t/001_initdb.pl

Fix BTREE_BUILD_STATS build.

commit   : 1e0d6512e573a568a8ea1a0cb94ea30f800350e2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 May 2016 19:41:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 May 2016 19:41:11 -0400    

Click here for diff

Commit 65c5fcd353a859da9e61bfb2b92a99f12937de3b broke this by removing a  
header include directive that is conditionally required.  Add that back  
to nbtree.c, with annotation to keep pgrminclude from re-breaking it.  
  
Peter Geoghegan  
  
Report: <CAM3SWZTNjHFYW_UG8bu0BnogqQ2HfsTgkzXLueuUhfTcYbu5HA@mail.gmail.com>  

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

Support IndexElem in raw_expression_tree_walker().

commit   : eae1ad9b64eaa201444ff99848f674be91af0ee6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 May 2016 19:23:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 May 2016 19:23:36 -0400    

Click here for diff

Needed for cases in which INSERT ... ON CONFLICT appears inside a  
recursive CTE item.  Per bug #14153 from Thomas Alton.  
  
Patch by Peter Geoghegan, slightly adjusted by me  
  
Report: <[email protected]>  

M src/backend/nodes/nodeFuncs.c

Add support for more extensive testing of raw_expression_tree_walker().

commit   : 465e09da6310fee89946f3ca32ee8002dd4c428a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 May 2016 19:08:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 May 2016 19:08:26 -0400    

Click here for diff

If RAW_EXPRESSION_COVERAGE_TEST is defined, do a no-op tree walk over  
every basic DML statement submitted to parse analysis.  If we'd had this  
in place earlier, bug #14153 would have been caught by buildfarm testing.  
The difficulty is that raw_expression_tree_walker() is only used in  
limited cases involving CTEs (particularly recursive ones), so it's  
very easy for an oversight in it to not be noticed during testing of a  
seemingly-unrelated feature.  
  
The type of error we can expect to catch with this is complete omission  
of a node type from raw_expression_tree_walker(), and perhaps also  
recursion into a field that doesn't contain a node tree, though that  
would be an unlikely mistake.  It won't catch failure to add new fields  
that need to be recursed into, unfortunately.  
  
I'll go enable this on one or two of my own buildfarm animals once  
bug #14153 is dealt with.  
  
Discussion: <[email protected]>  

M src/backend/nodes/nodeFuncs.c
M src/backend/parser/analyze.c
M src/include/pg_config_manual.h

Fix latent crash in do_text_output_multiline().

commit   : 8a4930e3faffedf0c392de1f03508b816fa2244d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 May 2016 14:16:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 May 2016 14:16:40 -0400    

Click here for diff

do_text_output_multiline() would fail (typically with a null pointer  
dereference crash) if its input string did not end with a newline.  Such  
cases do not arise in our current sources; but it certainly could happen  
in future, or in extension code's usage of the function, so we should fix  
it.  To fix, replace "eol += len" with "eol = text + len".  
  
While at it, make two cosmetic improvements: mark the input string const,  
and rename the argument from "text" to "txt" to dodge pgindent strangeness  
(since "text" is a typedef name).  
  
Even though this problem is only latent at present, it seems like a good  
idea to back-patch the fix, since it's a very simple/safe patch and it's  
not out of the realm of possibility that we might in future back-patch  
something that expects sane behavior from do_text_output_multiline().  
  
Per report from Hao Lee.  
  
Report: <CAGoxFiFPAGyPAJLcFxTB5cGhTW2yOVBDYeqDugYwV4dEd1L_Ag@mail.gmail.com>  

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

psql: Message style improvements

commit   : a50b605aa4487cbf677625a7a1bb5f2b05058d91    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 21 May 2016 22:17:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 21 May 2016 22:17:00 -0400    

Click here for diff

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

Improve docs about contrib/intarray's benchmark suite.

commit   : 768d6f90f9e44af96c22135a8eb1e83ed73c422b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 May 2016 15:43:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 May 2016 15:43:57 -0400    

Click here for diff

Correct obsolete install instructions, as noted by Daniel Gustafsson.  
Clarify the test code's prerequisites.  
  
Discussion: <[email protected]>  

M doc/src/sgml/intarray.sgml

Improve docs about using ORDER BY to control aggregate input order.

commit   : 82eafabeaaf12231a85ed67bbf4eae698aacb1c9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 May 2016 12:55:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 May 2016 12:55:31 -0400    

Click here for diff

David Johnston pointed out that the original text here had been obsoleted  
by SQL:2008, which allowed ORDER BY in subqueries.  We could weaken the  
text to describe ORDER-BY-in-subqueries as an optional SQL feature that's  
possibly unportable; but then the exact same statements would apply to  
the alternative it's being compared to (ORDER-BY-in-aggregate-calls).  
So really that would be pretty useless; let's just take out the sentence  
entirely.  Instead, point out the hazard that any extra processing in the  
upper query might cause the subquery output order to be destroyed.  
  
Discussion: <CAKFQuwbAX=iO9QbpN7_jr+BnUWm9FYX8WbEPUvG0p+nZhp6TZg@mail.gmail.com>  

M doc/src/sgml/func.sgml

Further improve documentation about --quote-all-identifiers switch.

commit   : 50e5315a58554735096f7530cb766fae2dd3b0c7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 May 2016 15:51:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 May 2016 15:51:57 -0400    

Click here for diff

Mention it in the Notes section too, per suggestion from David Johnston.  
  
Discussion: <[email protected]>  

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

Improve documentation about pg_dump's --quote-all-identifiers switch.

commit   : 960be4a9986d5c4fde585c531e726c85e2aa787a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 May 2016 14:59:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 May 2016 14:59:47 -0400    

Click here for diff

Per bug #14152 from Alejandro Martínez.  Back-patch to all supported  
branches.  
  
Discussion: <[email protected]>  

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

Pin the built-in index access methods.

commit   : 16ea51a263bfbb009ba73f36494f49246933e93c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 May 2016 14:40:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 May 2016 14:40:02 -0400    

Click here for diff

This was overlooked in commit 473b93287, which introduced DROP ACCESS  
METHOD.  Although that command is restricted to superusers, we don't want  
even superusers dropping the built-in methods; "DROP ACCESS METHOD btree"  
in particular is unrecoverable from.  Pin these objects in the same way  
that other initdb-created objects are pinned.  
  
I chose to bump catversion for this fix.  That's not absolutely necessary  
perhaps, but it will ensure that no 9.6 production systems are missing  
the pin entries.  

M src/bin/initdb/initdb.c
M src/include/catalog/catversion.h

Avoid possible crash in contrib/bloom's blendscan().

commit   : e13ac5586c49c77f301329b79bd7e8f489d0e66f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 May 2016 17:01:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 May 2016 17:01:18 -0400    

Click here for diff

It's possible to begin and end an indexscan without ever calling  
amrescan.  contrib/bloom, unlike every other index AM, allocated  
its "scan->opaque" storage at amrescan time, and thus would crash  
in amendscan if amrescan hadn't been called.  We could fix this  
by putting in a null-pointer check in blendscan, but I see no very  
good reason why contrib/bloom should march to its own drummer in  
this respect.  Let's move that initialization to blbeginscan  
instead.  Per report from Jeff Janes.  

M contrib/bloom/blscan.c

Allocate all page images at once in generic wal interface

commit   : 7c979c95a3700d0bd34c2831f49a9260d505b0f9    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 17 May 2016 22:09:22 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 17 May 2016 22:09:22 +0300    

Click here for diff

That reduces number of allocation.  
  
Per gripe from Michael Paquier and Tom Lane suggestion.  

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

Fix typo

commit   : b09cd2e50a69182ef38ad67ac77d06a87236c5b0    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 17 May 2016 11:28:18 -0400    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 17 May 2016 11:28:18 -0400    

Click here for diff

Amit Langote  

M doc/src/sgml/backup.sgml

Correctly align page's images in generic wal API

commit   : 7c8345f67f3008a394adccae262f2a2162b6f5c7    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 17 May 2016 00:01:35 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 17 May 2016 00:01:35 +0300    

Click here for diff

Page image should be MAXALIGN'ed because existing code could directly align  
pointers in page instead of align offset from beginning of page.  
  
Found during play with indexes as extenstion, Alexander Korotkov and me  

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

postgres_fdw: Fix the fix for crash when pushing down multiple joins.

commit   : 02a568a02769ca626591039f460109369bf05dc2    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 16 May 2016 11:28:28 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 16 May 2016 11:28:28 -0400    

Click here for diff

Commit 3151f16e1874db82ed85a005dac15368903ca9fb was intended to be  
a commit of a patch from Ashutosh Bapat, but instead I mistakenly  
committed an earlier version from Michael Paquier (because both  
patches were submitted with the same filename, and I confused them).  
Michael's patch fixes the crash but doesn't actually implement the  
correct test.  
  
Repair the incorrect logic, and also expand the comments considerably  
so that this is all more clear.  
  
Ashutosh Bapat and Robert Haas  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql

Fix multiple problems in postgres_fdw query cancellation logic.

commit   : 1b812afb0eafe125b820cc3b95e7ca03821aa675    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 16 May 2016 11:19:10 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 16 May 2016 11:19:10 -0400    

Click here for diff

First, even if we cancel a query, we still have to roll back the  
containing transaction; otherwise, the session will be left in a  
failed transaction state.  
  
Second, we need to support canceling queries whe aborting a  
subtransaction as well as when aborting a toplevel transaction.  
  
Etsuro Fujita, reviewed by Michael Paquier  

M contrib/postgres_fdw/connection.c

Fix comment.

commit   : b7a9347c11e19918a34b127a096061bfb002fcb5    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 May 2016 17:04:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 May 2016 17:04:01 -0400    

Click here for diff

Reference to getThreadLocalPQExpBuffer here seems inappropriate, since  
we aren't necessarily using that instantiation of getLocalPQExpBuffer.  

M src/fe_utils/string_utils.c

sql_features: Fix typos

commit   : 9b7bfc3a88ef7b374444205c14db76dae6b35b56    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 May 2016 21:24:54 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 May 2016 21:24:54 -0400    

Click here for diff

This makes the feature names match the SQL standard.  
  
From: Alexander Law <[email protected]>  

M src/backend/catalog/sql_features.txt

doc: Fix typo

commit   : 8eec44be6b4e7f73b89e06b50a6773f4d8d0e53e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 May 2016 21:24:13 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 May 2016 21:24:13 -0400    

Click here for diff

From: Alexander Law <[email protected]>  

M doc/src/sgml/gin.sgml

Update release instructions for translation updates

commit   : 5251f2fc4d5b9d4c064678bf09d4627e67e40561    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 May 2016 21:21:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 May 2016 21:21:47 -0400    

Click here for diff

We don't tag the translations repository any more, because the commits  
into postgresql contain the git hashes, and that's authoritative.  

M src/tools/RELEASE_CHANGES

commit   : 6d52e8b64612fc339d33acee9e91f04c3cc5b182    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 May 2016 10:38:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 May 2016 10:38:35 -0400    

Click here for diff

M doc/src/sgml/pgcrypto.sgml

Ensure plan stability in contrib/btree_gist regression test.

commit   : d94977ef1cef8810a6a7692a1debd56b7811b2aa    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 May 2016 20:04:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 May 2016 20:04:12 -0400    

Click here for diff

Buildfarm member skink failed with symptoms suggesting that an  
auto-analyze had happened and changed the plan displayed for a  
test query.  Although this is evidently of low probability,  
regression tests that sometimes fail are no fun, so add commands  
to force a bitmap scan to be chosen.  

M contrib/btree_gist/expected/not_equal.out
M contrib/btree_gist/sql/not_equal.sql

Fix bogus comments

commit   : cca2a278609e9ed9bedc4796ae1427fbfb88a2fc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 12 May 2016 16:02:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 12 May 2016 16:02:49 -0300    

Click here for diff

Some comments mentioned XLogReplayBuffer, but there's no such function:  
that was an interim name for a function that got renamed to  
XLogReadBufferForRedo, before commit 2c03216d831160 was pushed.  

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

Fix obsolete comment

commit   : bdb9e3dc1da95bdfc28deb43914ff5f082bd9043    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 12 May 2016 15:36:51 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 12 May 2016 15:36:51 -0300    

Click here for diff

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

doc: Document default of max_worker_processes

commit   : 83b8ee87541c82505a85476024c1a4d50452a697    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 12 May 2016 09:15:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 12 May 2016 09:15:49 -0400    

Click here for diff

found by David G. Johnston <[email protected]>  

M doc/src/sgml/config.sgml

doc: Small wording change for clarity

commit   : 122b99478a7baa3a8deb03938ea5ae15a1ad7584    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 12 May 2016 08:32:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 12 May 2016 08:32:12 -0400    

Click here for diff

From: Martín Marqués <[email protected]>  

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

Fix infer_arbiter_indexes() to not barf on system columns.

commit   : 8a13d5e6d1bb9ff9460c72992657077e57e30c32    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 May 2016 17:06:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 May 2016 17:06:53 -0400    

Click here for diff

While it could be argued that rejecting system column mentions in the  
ON CONFLICT list is an unsupported feature, falling over altogether  
just because the table has a unique index on OID is indubitably a bug.  
  
As far as I can tell, fixing infer_arbiter_indexes() is sufficient to  
make ON CONFLICT (oid) actually work, though making a regression test  
for that case is problematic because of the impossibility of setting  
the OID counter to a known value.  
  
Minor cosmetic cleanups along with the bug fix.  

M src/backend/optimizer/util/plancat.c

Fix assorted missing infrastructure for ON CONFLICT.

commit   : 26e66184d6136643d16f6fb167db517fb18b8f89    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 May 2016 16:20:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 May 2016 16:20:03 -0400    

Click here for diff

subquery_planner() failed to apply expression preprocessing to the  
arbiterElems and arbiterWhere fields of an OnConflictExpr.  No doubt the  
theory was that this wasn't necessary because we don't actually try to  
execute those expressions; but that's wrong, because it results in failure  
to match to index expressions or index predicates that are changed at all  
by preprocessing.  Per bug #14132 from Reynold Smith.  
  
Also add pullup_replace_vars processing for onConflictWhere.  Perhaps  
it's impossible to have a subquery reference there, but I'm not exactly  
convinced; and even if true today it's a failure waiting to happen.  
  
Also add some comments to other places where one or another field of  
OnConflictExpr is intentionally ignored, with explanation as to why it's  
okay to do so.  
  
Also, catalog/dependency.c failed to record any dependency on the named  
constraint in ON CONFLICT ON CONSTRAINT, allowing such a constraint to  
be dropped while rules exist that depend on it, and allowing pg_dump to  
dump such a rule before the constraint it refers to.  The normal execution  
path managed to error out reasonably for a dangling constraint reference,  
but ruleutils.c dumped core; so in addition to fixing the omission, add  
a protective check in ruleutils.c, since we can't retroactively add a  
dependency in existing databases.  
  
Back-patch to 9.5 where this code was introduced.  
  
Report: <[email protected]>  

M src/backend/catalog/dependency.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/insert_conflict.out
M src/test/regress/sql/insert_conflict.sql

Update key words table for 9.6

commit   : 9be58a2b8ef222c1de80ccbb55b19ab0cff33237    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 May 2016 15:01:44 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 May 2016 15:01:44 -0400    

Click here for diff

M doc/src/sgml/keywords.sgml

Fix autovacuum for shared relations

commit   : 15739393e4c3b64b9038d75784e848a415827517    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 10 May 2016 16:23:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 10 May 2016 16:23:54 -0300    

Click here for diff

The table-skipping logic in autovacuum would fail to consider that  
multiple workers could be processing the same shared catalog in  
different databases.  This normally wouldn't be a problem: firstly  
because autovacuum workers not for wraparound would simply ignore tables  
in which they cannot acquire lock, and secondly because most of the time  
these tables are small enough that even if multiple for-wraparound  
workers are stuck in the same catalog, they would be over pretty  
quickly.  But in cases where the catalogs are severely bloated it could  
become a problem.  
  
Backpatch all the way back, because the problem has been there since the  
beginning.  
  
Reported by Ondřej Světlík  
  
Discussion: https://www.postgresql.org/message-id/572B63B1.3030603%40flexibee.eu  
	https://www.postgresql.org/message-id/572A1072.5080308%40flexibee.eu  

M src/backend/postmaster/autovacuum.c

Stamp 9.6beta1.

commit   : 8ee29a19d69ab6c19ec0f7565541b9f96e898200    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 May 2016 16:47:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 May 2016 16:47:49 -0400    

Click here for diff

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

Translation updates

commit   : 48aaba4acf4db787a1f1dff01b910e7557f1c657    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 9 May 2016 10:04:41 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 9 May 2016 10:04:41 -0400    

Click here for diff

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

M src/backend/po/de.po
M src/backend/po/es.po
M src/backend/po/fr.po
M src/backend/po/id.po
M src/backend/po/it.po
M src/backend/po/pl.po
M src/backend/po/ru.po
M src/backend/po/zh_CN.po
M src/bin/initdb/nls.mk
M src/bin/initdb/po/de.po
M src/bin/initdb/po/es.po
M src/bin/initdb/po/fr.po
M src/bin/initdb/po/it.po
A src/bin/initdb/po/ko.po
M src/bin/initdb/po/pl.po
M src/bin/initdb/po/pt_BR.po
M src/bin/initdb/po/ru.po
M src/bin/initdb/po/zh_CN.po
M src/bin/pg_basebackup/nls.mk
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/es.po
M src/bin/pg_basebackup/po/fr.po
M src/bin/pg_basebackup/po/it.po
A src/bin/pg_basebackup/po/ko.po
M src/bin/pg_basebackup/po/pl.po
M src/bin/pg_basebackup/po/pt_BR.po
M src/bin/pg_basebackup/po/ru.po
M src/bin/pg_basebackup/po/zh_CN.po
M src/bin/pg_config/po/de.po
M src/bin/pg_config/po/es.po
M src/bin/pg_config/po/fr.po
M src/bin/pg_config/po/it.po
M src/bin/pg_config/po/pt_BR.po
M src/bin/pg_controldata/nls.mk
M src/bin/pg_controldata/po/de.po
M src/bin/pg_controldata/po/es.po
M src/bin/pg_controldata/po/fr.po
M src/bin/pg_controldata/po/it.po
A src/bin/pg_controldata/po/ko.po
M src/bin/pg_controldata/po/pl.po
M src/bin/pg_controldata/po/pt_BR.po
M src/bin/pg_controldata/po/ru.po
M src/bin/pg_controldata/po/zh_CN.po
M src/bin/pg_ctl/nls.mk
M src/bin/pg_ctl/po/de.po
M src/bin/pg_ctl/po/es.po
M src/bin/pg_ctl/po/fr.po
M src/bin/pg_ctl/po/it.po
A src/bin/pg_ctl/po/ko.po
M src/bin/pg_ctl/po/pl.po
M src/bin/pg_ctl/po/pt_BR.po
M src/bin/pg_ctl/po/ru.po
M src/bin/pg_ctl/po/zh_CN.po
M src/bin/pg_dump/nls.mk
M src/bin/pg_dump/po/de.po
M src/bin/pg_dump/po/es.po
M src/bin/pg_dump/po/fr.po
M src/bin/pg_dump/po/it.po
A src/bin/pg_dump/po/ko.po
M src/bin/pg_dump/po/pl.po
M src/bin/pg_dump/po/pt_BR.po
M src/bin/pg_dump/po/ru.po
M src/bin/pg_dump/po/zh_CN.po
M src/bin/pg_resetxlog/nls.mk
M src/bin/pg_resetxlog/po/de.po
M src/bin/pg_resetxlog/po/es.po
M src/bin/pg_resetxlog/po/fr.po
M src/bin/pg_resetxlog/po/it.po
A src/bin/pg_resetxlog/po/ko.po
M src/bin/pg_resetxlog/po/pl.po
M src/bin/pg_resetxlog/po/pt_BR.po
M src/bin/pg_resetxlog/po/ru.po
M src/bin/pg_resetxlog/po/zh_CN.po
M src/bin/pg_rewind/nls.mk
M src/bin/pg_rewind/po/de.po
A src/bin/pg_rewind/po/es.po
A src/bin/pg_rewind/po/fr.po
A src/bin/pg_rewind/po/it.po
A src/bin/pg_rewind/po/ko.po
A src/bin/pg_rewind/po/pl.po
A src/bin/pg_rewind/po/ru.po
A src/bin/pg_rewind/po/zh_CN.po
M src/bin/psql/po/de.po
M src/bin/psql/po/es.po
M src/bin/psql/po/fr.po
M src/bin/psql/po/it.po
M src/bin/psql/po/ja.po
M src/bin/psql/po/pl.po
M src/bin/psql/po/pt_BR.po
M src/bin/psql/po/ru.po
M src/bin/psql/po/zh_CN.po
M src/bin/scripts/nls.mk
M src/bin/scripts/po/de.po
M src/bin/scripts/po/es.po
M src/bin/scripts/po/fr.po
M src/bin/scripts/po/it.po
A src/bin/scripts/po/ko.po
M src/bin/scripts/po/pl.po
M src/bin/scripts/po/pt_BR.po
M src/bin/scripts/po/ru.po
M src/bin/scripts/po/zh_CN.po
M src/interfaces/ecpg/ecpglib/nls.mk
M src/interfaces/ecpg/ecpglib/po/es.po
M src/interfaces/ecpg/ecpglib/po/fr.po
A src/interfaces/ecpg/ecpglib/po/ko.po
M src/interfaces/ecpg/ecpglib/po/pt_BR.po
M src/interfaces/ecpg/preproc/po/es.po
M src/interfaces/ecpg/preproc/po/fr.po
M src/interfaces/ecpg/preproc/po/pt_BR.po
M src/interfaces/libpq/nls.mk
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/es.po
M src/interfaces/libpq/po/fr.po
M src/interfaces/libpq/po/it.po
A src/interfaces/libpq/po/ko.po
M src/interfaces/libpq/po/pl.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/nls.mk
M src/pl/plperl/po/de.po
M src/pl/plperl/po/es.po
M src/pl/plperl/po/fr.po
M src/pl/plperl/po/it.po
A src/pl/plperl/po/ko.po
M src/pl/plperl/po/pl.po
M src/pl/plperl/po/pt_BR.po
M src/pl/plperl/po/ru.po
M src/pl/plperl/po/zh_CN.po
M src/pl/plpgsql/src/nls.mk
M src/pl/plpgsql/src/po/de.po
M src/pl/plpgsql/src/po/es.po
M src/pl/plpgsql/src/po/fr.po
M src/pl/plpgsql/src/po/it.po
A src/pl/plpgsql/src/po/ko.po
M src/pl/plpgsql/src/po/pl.po
M src/pl/plpgsql/src/po/pt_BR.po
M src/pl/plpgsql/src/po/ru.po
M src/pl/plpgsql/src/po/zh_CN.po
M src/pl/plpython/nls.mk
M src/pl/plpython/po/de.po
M src/pl/plpython/po/es.po
M src/pl/plpython/po/fr.po
M src/pl/plpython/po/it.po
A src/pl/plpython/po/ko.po
M src/pl/plpython/po/pl.po
M src/pl/plpython/po/pt_BR.po
M src/pl/plpython/po/ru.po
M src/pl/plpython/po/zh_CN.po
M src/pl/tcl/nls.mk
M src/pl/tcl/po/de.po
M src/pl/tcl/po/es.po
M src/pl/tcl/po/fr.po
M src/pl/tcl/po/it.po
M src/pl/tcl/po/ja.po
A src/pl/tcl/po/ko.po
M src/pl/tcl/po/pl.po
M src/pl/tcl/po/pt_BR.po
M src/pl/tcl/po/ru.po
M src/pl/tcl/po/zh_CN.po

Improve 9.6 release notes.

commit   : 91fd1df4aad2141859310564b498a3e28055ee28    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 May 2016 16:53:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 May 2016 16:53:55 -0400    

Click here for diff

Incorporate some suggestions from David Johnston, and update through today.  

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

Docs: create some user-facing documentation about index-only scans.

commit   : e6dd664d0dd362235fd0af31360ecbf29434c4c1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 May 2016 16:36:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 May 2016 16:36:19 -0400    

Click here for diff

We didn't have any real user documentation about how index-only scans  
work or how to design indexes to exploit them.  Remedy that.  
Per gripe from David Johnston.  

M doc/src/sgml/config.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/storage.sgml

Wording quibbles regarding initdb username

commit   : 6f69b96390eddf9c6129840eac511fd4159f01bb    
  
author   : Stephen Frost <[email protected]>    
date     : Sun, 8 May 2016 12:58:21 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sun, 8 May 2016 12:58:21 -0400    

Click here for diff

Use disallowed instead of reserved, cannot instead of can not, and  
double quotes instead of single quotes.  
  
Also add a test to cover the bug which started this discussion.  
  
Per discussion with Tom.  

M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl

Disallow superuser names starting with 'pg_' in initdb

commit   : 7df974ee0bfd8978830b941e7af5697fd4268656    
  
author   : Stephen Frost <[email protected]>    
date     : Sun, 8 May 2016 11:55:44 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sun, 8 May 2016 11:55:44 -0400    

Click here for diff

As with CREATE ROLE, disallow users from specifying initial  
superuser names which begin with 'pg_' in initdb.  
  
Per discussion with Tom.  

M src/bin/initdb/initdb.c

Fix poorly-worded log message.

commit   : 9eb7a0ac6b24804dcc90e42e533aa1b7b585d8e2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 May 2016 01:37:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 May 2016 01:37:07 -0400    

Click here for diff

Euler Taveira  

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

Release notes for 9.5.3, 9.4.8, 9.3.13, 9.2.17, 9.1.22.

commit   : 4768cc4565df3527293271e4ef6e90d8db4e106d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 May 2016 17:26:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 May 2016 17:26:23 -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

In new pg_dump TAP tests, remove trailing "$" from regexps using /m.

commit   : b8180884082d46346394e1c54fc454d2c16bf3ee    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 May 2016 16:36:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 May 2016 16:36:50 -0400    

Click here for diff

It emerges that some Perl versions before 5.8.9 have a bug with regexps  
that use the /m flag and contain "$".  This is the reason why jacana  
is still failing on HEAD, and I was able to duplicate the failure on  
prairiedog's host.  There's no real need for "$" in these patterns,  
since they are already matching through the statement-terminating  
semicolons (or matching an explicit \n in some cases).  So just  
remove it.  
  
Note: the reason jacana hasn't actually reported any failures in the  
last little while is that the way the pg_dump TAP tests are set up, any  
failure of this sort results in echoing the entire pg_dump dump output  
to stderr.  Since there were about a hundred such failures, that resulted  
in a 30MB log file which choked the buildfarm upload script.  There is  
room for improvement here :-(.  
  
Per off-list discussion with Andrew and Stephen.  

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

Docs: improve warnings about nextval() not producing gapless sequences.

commit   : 691d99de386aa1f5a858e04634dbaaba48488ef8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 May 2016 13:16:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 May 2016 13:16:50 -0400    

Click here for diff

In the documentation for nextval(), point out explicitly that INSERT ...  
ON CONFLICT will call nextval() if needed for the insertion case, whether  
or not it ends up following the ON CONFLICT path.  This seems to be a  
matter of some confusion, cf bug #14126, so let's be clear about it.  
  
Also mention the issue in the CREATE SEQUENCE reference page, since that  
is another place where people might expect such things to be covered.  
  
Minor wording improvements nearby, as well.  
  
Back-patch to 9.5 where ON CONFLICT was introduced.  

M doc/src/sgml/func.sgml
M doc/src/sgml/ref/create_sequence.sgml

Update back-branch release notes for the last few commits.

commit   : 7dc1d359699345a2b2af6af6d21bd6f7bd6cfb27    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 May 2016 00:51:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 May 2016 00:51:27 -0400    

Click here for diff

OpenSSL error queue fix no longer needs to be documented under 9.6.  

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

Clean up after pg_dump test runs.

commit   : 74a73b17225385e54dbf9fc2f77aaa59191ac04b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 22:28:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 22:28:01 -0400    

Click here for diff

The tmp_check directory needs to be removed by "make clean",  
and also ignored by .gitignore.  

M src/bin/pg_dump/.gitignore
M src/bin/pg_dump/Makefile

Fix pg_upgrade to not fail when new-cluster TOAST rules differ from old.

commit   : 1a2c17f8e221b0c3c63cb2b1be1f862444f62516    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 22:05:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 22:05:51 -0400    

Click here for diff

This patch essentially reverts commit 4c6780fd17aa43ed, in favor of a much  
simpler solution for the case where the new cluster would choose to create  
a TOAST table but the old cluster doesn't have one: just don't create a  
TOAST table.  
  
The existing code failed in at least two different ways if the situation  
arose: (1) ALTER TABLE RESET didn't grab an exclusive lock, so that the  
lock sanity check in create_toast_table failed; (2) pg_upgrade did not  
provide a pg_type OID for the new toast table, so that the crosscheck in  
TypeCreate failed.  While both these problems were introduced by later  
patches, they show that the hack being used to cause TOAST table creation  
is overwhelmingly fragile (and untested).  I also note that before the  
TypeCreate crosscheck was added, the code would have resulted in assigning  
an indeterminate pg_type OID to the toast table, possibly causing a later  
OID conflict in that catalog; so that it didn't really work even when  
committed.  
  
If we simply don't create a TOAST table, there will only be a problem if  
the code tries to store a tuple that's wider than a page, and field  
compression isn't sufficient to get it under a page.  Given that the TOAST  
creation threshold is intended to be about a quarter of a page, it's very  
hard to believe that cross-version differences in the do-we-need-a-toast-  
table heuristic could result in an observable problem.  So let's just  
follow the old version's conclusion about whether a TOAST table is needed.  
  
(If we ever do change needs_toast_table() so much that this conclusion  
doesn't apply, we can devise a solution at that time, and hopefully do  
it in a less klugy way than 4c6780fd17aa43ed did.)  
  
Back-patch to 9.3, like the previous patch.  
  
Discussion: <[email protected]>  

M src/backend/catalog/toasting.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/include/catalog/binary_upgrade.h

Disable BLOB test in pg_dump TAP tests

commit   : 0f97c722bb201c67312eec0a9ff3691cda37878f    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 21:24:31 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 21:24:31 -0400    

Click here for diff

Buildfarm member jacana appears to have an issue with running this  
test.  It's not entirely clear to me why, but rather than try to  
fight with it, just disable it for now.  
  
None of the other tests try to write out from psql directly as  
this test does, so it seems likely that the rest of the tests will  
be fine (as they have been on numerous other systems).  

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

Mitigate "snapshot too old" performance regression on NUMA

commit   : 7e3da1c4737fd6582e12c80983987e4d2cbc1d17    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 6 May 2016 20:05:29 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 6 May 2016 20:05:29 -0500    

Click here for diff

Limit maintenance of time to xid mapping to once per minute.  At  
least in the tested case this brings performance within 5% of when  
the feature is off, compared to several times slower without this  
patch.  
  
While there, fix comments and whitespace.  
  
Ants Aasma, with cosmetic adjustments suggested by Andres Freund  
Reviewed by Kevin Grittner and Andres Freund  

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

First-draft release notes for 9.5.3.

commit   : eb7de00ac2d282263541ece849ec71e2809e9467    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 19:43:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 19:43:51 -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

Docs: fix alphabetization of table entries.

commit   : bbbae5ead3952bee9184da4864e2f4078940cac7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 17:48:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 17:48:56 -0400    

Click here for diff

Fabien Coelho  

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

Docs: minor copy-editing for GSSAPI/SSPI authentication docs.

commit   : 36db18eaa0def33b3f7ea5e3980c43431ca9c923    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 17:42:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 17:42:44 -0400    

Click here for diff

Describe compat_realm = 0 as "disabled" not "enabled", per discussion  
with Christian Ullrich.  I failed to resist the temptation to do some  
other minor copy-editing in the same area.  

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

Add test_pg_dump to @contrib_excludes

commit   : 6e243c43c9b2d35f91a73d3982db6a0cad0eb64b    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 16:39:56 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 16:39:56 -0400    

Click here for diff

The test_pg_dump extension doesn't have a C component, so we need  
to exclude it from the MSVC build system trying to figure out how  
to build it.  
  
Also add a "MODULES" line to the Makefile, as test_extensions has.  
Might not be necessary, but seems good to keep things consistent.  
  
Lastly, remove the 'installcheck' line from test_pg_dump, as that  
was causing redefinition errors, at least on my box.  This also  
makes test_pg_dump consistent with how commit_ts is set up.  

M src/test/modules/test_pg_dump/Makefile
M src/tools/msvc/Mkvcbuild.pm

More small 9.6 release note improvements.

commit   : 76ef266a86fdc3c4bdbd12b9ea9cacd523e00779    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 16:20:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 16:20:56 -0400    

Click here for diff

Corrections per Jeff Janes, Christian Ullrich, and Daniel Vérité.  

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

Correct query in pg_dumpall:dumpRoles

commit   : c778e27e13e883fb759f6100727aba80102933bd    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 16:15:52 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 16:15:52 -0400    

Click here for diff

We need to use a new branch due to the 9.5 addition of bypassrls  
when adding in the clause to exclude pg_* roles from being dumped  
by pg_dumpall.  
  
Pointed out by Noah, patch by me.  

M src/bin/pg_dump/pg_dumpall.c

Remove MODULES_big from test_pg_dump

commit   : eccfeeb631fa44850b644661d8b2ce94d9ef4fc1    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 15:26:57 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 15:26:57 -0400    

Click here for diff

The Makefile for test_pg_dump shouldn't have a MODULES_big line  
because there's no actual compiled bit for that extension.  Hopefully  
this will fix the Windows buildfarm members which were complaining.  
  
In passing, also add the 'prove_installcheck' bit to the pg_dump and  
test_pg_dump Makefiles, to get the buildfarm members to actually run  
those tests.  

M src/bin/pg_dump/Makefile
M src/test/modules/test_pg_dump/Makefile

Minimal fix for crash bug in quals_match_foreign_key.

commit   : 68d704edbfe14fd8d21545b244c3f6824e0fbb8a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 May 2016 15:00:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 May 2016 15:00:55 -0400    

Click here for diff

Discussion is still underway as to whether to revert the entire patch  
that added this function, but that discussion may not conclude before  
beta1.  So, in the meantime, let's do at least this much.  
  
David Rowley  

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

Limit maximum parallel degree to 1024.

commit   : c7ea68ff8dfafc22c6cfefdb5929e12ec5d1e02a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 May 2016 14:43:34 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 May 2016 14:43:34 -0400    

Click here for diff

This new limit affects both the max_parallel_degree GUC and the  
parallel_degree reloption.  There may some day be a use case for using  
more than 1024 CPUs for a single query, but that's surely not the case  
right now.  Not only do not very many people have that many CPUs, but  
the code hasn't been tested at that kind of scale and is very unlikely  
to perform well, or even work at all, without a lot more work.  The  
issue addressed by commit 06bd458cb812623c3f1fdd55216c4c08b06a8447 is  
probably just one problem of many.  
  
The idea of a more reasonable limit here was suggested by Tom Lane;  
the value of 1024 was suggested by Amit Kapila.  

M src/backend/access/common/reloptions.c
M src/backend/utils/misc/guc.c

Improve pg_upgrade's report about failure to match up old and new tables.

commit   : 73b9952e8278b9c9a6f5f8e2df196fea5abb61f0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 14:23:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 14:23:45 -0400    

Click here for diff

Ordinarily, pg_upgrade shouldn't have any difficulty in matching up all  
the relations it sees in the old and new databases.  If it does, however,  
it just goes belly-up with a pretty unhelpful error message.  That seemed  
fine as long as we expected the case never to occur in the wild, but  
Alvaro reported that it had been seen in a database whose pg_largeobject  
table had somehow acquired a TOAST table.  That doesn't quite seem like  
a case that pg_upgrade actually needs to handle, but it would be good if  
the report were more diagnosable.  Hence, extend the logic to print out  
as much information as we can about the mismatch(es) before we quit.  
  
In passing, improve the readability of get_rel_infos()'s data collection  
query, which had suffered seriously from lets-not-bother-to-update-comments  
syndrome, and generally was unnecessarily disrespectful to readers.  
  
It could be argued that this is a bug fix, but given that we have so few  
reports, I don't feel a need to back-patch; at least not before this has  
baked awhile in HEAD.  

M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.h

Use mul_size when multiplying by the number of parallel workers.

commit   : 06bd458cb812623c3f1fdd55216c4c08b06a8447    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 May 2016 14:23:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 May 2016 14:23:47 -0400    

Click here for diff

That way, if the result overflows size_t, you'll get an error instead  
of undefined behavior, which seems like a plus.  This also has the  
effect of casting the number of workers from int to Size, which is  
better because it's harder to overflow int than size_t.  
  
Dilip Kumar reported this issue and provided a patch upon which this  
patch is based, but his version did use mul_size.  

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

Remove various special checks around default roles

commit   : a89505fd21da337b81172871d8f65d9a4fa22a8b    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 14:06:50 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 14:06:50 -0400    

Click here for diff

Default roles really should be like regular roles, for the most part.  
This removes a number of checks that were trying to make default roles  
extra special by not allowing them to be used as regular roles.  
  
We still prevent users from creating roles in the "pg_" namespace or  
from altering roles which exist in that namespace via ALTER ROLE, as  
we can't preserve such changes, but otherwise the roles are very much  
like regular roles.  
  
Based on discussion with Robert and Tom.  

M src/backend/catalog/aclchk.c
M src/backend/commands/alter.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/policy.c
M src/backend/commands/schemacmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/user.c
M src/backend/commands/variable.c
M src/test/regress/expected/rolenames.out
M src/test/regress/sql/rolenames.sql

Add TAP tests for pg_dump

commit   : 6bd356c33a3cf3a49313dc8638ea4bb066c4cf37    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 14:06:50 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 14:06:50 -0400    

Click here for diff

This TAP test suite will create a new cluster, populate it based on  
the 'create_sql' values in the '%tests' hash, run all of the runs  
defined in the '%pgdump_runs' hash, and then for each test in the  
'%tests' hash, compare each run's output the the regular expression  
defined for the test under the 'like' and 'unlike' functions, as  
appropriate.  
  
While this test suite covers a fair bit of ground (67% of pg_dump.c  
and quite a bit of the other files in src/bin/pg_dump), there is  
still quite a bit which remains to be added to provide better code  
coverage.  Still, this is quite a bit better than we had, and has  
found a few bugs already (note that the CREATE TRANSFORM test is  
commented out, as it is currently failing).  
  
Idea for using the TAP system from Tom, though all of the code is mine.  

M src/bin/pg_dump/Makefile
M src/bin/pg_dump/pg_dump.c
A src/bin/pg_dump/t/001_basic.pl
A src/bin/pg_dump/t/002_pg_dump.pl
M src/test/modules/Makefile
A src/test/modules/test_pg_dump/.gitignore
A src/test/modules/test_pg_dump/Makefile
A src/test/modules/test_pg_dump/README
A src/test/modules/test_pg_dump/expected/test_pg_dump.out
A src/test/modules/test_pg_dump/sql/test_pg_dump.sql
A src/test/modules/test_pg_dump/t/001_base.pl
A src/test/modules/test_pg_dump/test_pg_dump–1.0.sql
A src/test/modules/test_pg_dump/test_pg_dump.control

Only issue LOCK TABLE commands when necessary

commit   : e1b120a8cbb0f39a79926fd173f33e57202cdfa0    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 14:06:50 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 14:06:50 -0400    

Click here for diff

Reviewing the cases where we need to LOCK a given table during a dump,  
it was pointed out by Tom that we really don't need to LOCK a table if  
we are only looking to dump the ACL for it, or certain other  
components.  After reviewing the queries run for all of the component  
pieces, a list of components were determined to not require LOCK'ing  
of the table.  
  
This implements a check to avoid LOCK'ing those tables.  
  
Initial complaint from Rushabh Lathia, discussed with Robert and Tom,  
the patch is mine.  

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

pg_dump performance and other fixes

commit   : 5d589993cad212f7d556d52cc1e42fe18f65b057    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 14:06:50 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 14:06:50 -0400    

Click here for diff

Do not try to dump objects which do not have ACLs when only ACLs are  
being requested.  This results in a significant performance improvement  
as we can avoid querying for further information on these objects when  
we don't need to.  
  
When limiting the components to dump for an extension, consider what  
components have been requested.  Initially, we incorrectly hard-coded  
the components of the extension objects to dump, which would mean that  
we wouldn't dump some components even with they were asked for and in  
other cases we would dump components which weren't requested.  
  
Correct defaultACLs to use 'dump_contains' instead of 'dump'.  The  
defaultACL is considered a member of the namespace and should be  
dumped based on the same set of components that the other objects in  
the schema are, not based on what we're dumping for the namespace  
itself (which might not include ACLs, if the namespace has just the  
default or initial ACL).  
  
Use DUMP_COMPONENT_ACL for from-initdb objects, to allow users to  
change their ACLs, should they wish to.  This just extends what we  
are doing for the pg_catalog namespace to objects which are not  
members of namespaces.  
  
Due to column ACLs being treated a bit differently from other ACLs  
(they are actually reset to NULL when all privileges are revoked),  
adjust the query which gathers column-level ACLs to consider all of  
the ACL-relevant columns.  

M src/bin/pg_dump/pg_dump.c

Correct pg_dump WHERE clause for functions/aggregates

commit   : 64d60c8bf0703011d79dcb8a55dc42dcedc1e10f    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 14:06:50 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 May 2016 14:06:50 -0400    

Click here for diff

The query to grab the function/aggregate information is now joining  
to pg_init_privs, so we can simplify (and correct) the WHERE clause  
used to determine if a given function's ACL has changed from the  
initial ACL on the function.  
  
Bug found by Noah, patch by me.  

M src/bin/pg_dump/pg_dump.c

Update config.guess and config.sub

commit   : e324f8ad610bdc83a1392e54da5d9613e710b02f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 May 2016 14:00:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 May 2016 14:00:47 -0400    

Click here for diff

M config/config.guess
M config/config.sub

Fix possible read past end of string in to_timestamp().

commit   : d136d600f9756232b36681fdfada0e40e1563a47    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 12:09:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 12:09:20 -0400    

Click here for diff

to_timestamp() handles the TH/th format codes by advancing over two input  
characters, whatever those are.  It failed to notice whether there were  
two characters available to be skipped, making it possible to advance  
the pointer past the end of the input string and keep on parsing.  
A similar risk existed in the handling of "Y,YYY" format: it would advance  
over three characters after the "," whether or not three characters were  
available.  
  
In principle this might be exploitable to disclose contents of server  
memory.  But the security team concluded that it would be very hard to use  
that way, because the parsing loop would stop upon hitting any zero byte,  
and TH/th format codes can't be consecutive --- they have to follow some  
other format code, which would have to match whatever data is there.  
So it seems impractical to examine memory very much beyond the end of the  
input string via this bug; and the input string will always be in local  
memory not in disk buffers, making it unlikely that anything very  
interesting is close to it in a predictable way.  So this doesn't quite  
rise to the level of needing a CVE.  
  
Thanks to Wolf Roediger for reporting this bug.  

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

Fix pgbench's parsing of double values to notice trailing garbage.

commit   : 6b8b4e4d8320d8c9daf9410175c40a09e58c4868    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 11:08:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 11:08:48 -0400    

Click here for diff

Noted by Fabien Coelho, though this isn't exactly his proposed patch.  
(The technique used here is borrowed from the zic sources.)  

M src/bin/pgbench/pgbench.c

Improve handling of numeric-valued variables in pgbench.

commit   : 9515299485a591b3a8f03c118d11809d01663665    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 11:01:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 11:01:05 -0400    

Click here for diff

The previous coding always stored variable values as strings, doing  
conversion on-the-fly when a numeric value was needed or a number was to be  
assigned.  This was a bit inefficient and risked loss of precision for  
floating-point values.  The precision aspect had been hacked around by  
printing doubles in "%.18e" format, which is ugly and has machine-dependent  
results.  Instead, arrange to preserve an assigned numeric value in the  
original binary numeric format, converting to string only when and if  
needed.  When we do need to convert a double to string, convert in "%g"  
format with DBL_DIG precision, which is the standard way to do it and  
produces the least surprising results in most cases.  
  
The implementation supports storing both a string value and a numeric  
value for any one variable, with lazy conversion between them.  I also  
arranged for lazy re-sorting of the variable array when new variables are  
added.  That was mainly to allow a clean refactoring of putVariable()  
into two levels of subroutine, but it may allow us to save a few sorts.  
  
Discussion: <[email protected]>  

M src/bin/pgbench/pgbench.c

Docs: fix \crosstabview example.

commit   : daa9856fcea775caeb4c92580b9693858509b43b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 10:39:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 May 2016 10:39:35 -0400    

Click here for diff

This example missed being updated when we redefined \crosstabview's  
argument processing.  
  
Daniel Vérité  

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

Fix hash index vs "snapshot too old" problemms

commit   : 2cc41acd8fa3ebb8f0501c6102a253fb7053cf46    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 6 May 2016 07:47:12 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 6 May 2016 07:47:12 -0500    

Click here for diff

Hash indexes are not WAL-logged, and so do not maintain the LSN of  
index pages.  Since the "snapshot too old" feature counts on  
detecting error conditions using the LSN of a table and all indexes  
on it, this makes it impossible to safely do early vacuuming on any  
table with a hash index, so add this to the tests for whether the  
xid used to vacuum a table can be adjusted based on  
old_snapshot_threshold.  
  
While at it, add a paragraph to the docs for old_snapshot_threshold  
which specifically mentions this and other aspects of the feature  
which may otherwise surprise users.  
  
Problem reported and patch reviewed by Amit Kapila  

M doc/src/sgml/config.sgml
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashsearch.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/time/snapmgr.c
M src/include/utils/rel.h

Fix psql's \ev and \sv commands so that they handle view reloptions.

commit   : 9b66aa006f81b2705337ca223daeeabf4db6453a    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 6 May 2016 12:48:27 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 6 May 2016 12:48:27 +0100    

Click here for diff

Commit 8eb6407aaeb6cbd972839e356b436bb698f51cff added support for  
editing and showing view definitions, but neglected to account for  
view options such as security_barrier and WITH CHECK OPTION which are  
not returned by pg_get_viewdef() and so need special handling.  
  
Author: Dean Rasheed  
Reviewed-by: Peter Eisentraut  
Discussion: http://www.postgresql.org/message-id/CAEZATCWZjCgKRyM-agE0p8ax15j9uyQoF=qew7D2xB6cF76T8A@mail.gmail.com  

M src/bin/psql/command.c

Move and rename fmtReloptionsArray().

commit   : 93a8c6fd6c5eeb61c12402f616a327d998a731c4    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 6 May 2016 12:45:36 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 6 May 2016 12:45:36 +0100    

Click here for diff

Move fmtReloptionsArray() from pg_dump.c to string_utils.c so that it  
is available to other frontend code. In particular psql's \ev and \sv  
commands need it to handle view reloptions. Also rename the function  
to appendReloptionsArray(), which is a more accurate description of  
what it does.  
  
Author: Dean Rasheed  
Reviewed-by: Peter Eisentraut  
Discussion: http://www.postgresql.org/message-id/CAEZATCWZjCgKRyM-agE0p8ax15j9uyQoF=qew7D2xB6cF76T8A@mail.gmail.com  

M src/bin/pg_dump/pg_dump.c
M src/fe_utils/string_utils.c
M src/include/fe_utils/string_utils.h

Further 9.6 release note improvements.

commit   : 306ff0aaf8ef2a4c69a799faf7e6c72fea1c4709    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 May 2016 22:37:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 May 2016 22:37:30 -0400    

Click here for diff

Call out the major enhancements in this release as identified by  
pgsql-advocacy discussion, and rearrange some of the entries to  
make those items more prominent.  Other minor improvements per  
advice from Vitaly Burovoy, Masahiko Sawada, Peter Geoghegan,  
and Andres Freund.  

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

Update time zone data files to tzdata release 2016d.

commit   : 98f158e41e8eea69c796d6734a3548ee62bb98ac    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 May 2016 20:08:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 May 2016 20:08:58 -0400    

Click here for diff

DST law changes in Russia (Magadan, Tomsk regions) and Venezuela.  
Historical corrections for Russia.  There are new zone names Europe/Kirov  
and Asia/Tomsk reflecting the fact that these regions now have different  
time zone histories from adjacent regions.  

M src/timezone/data/asia
M src/timezone/data/europe
M src/timezone/data/northamerica
M src/timezone/data/southamerica
M src/timezone/data/zone.tab
M src/timezone/data/zone1970.tab
M src/timezone/known_abbrevs.txt
M src/timezone/tznames/Asia.txt
M src/timezone/tznames/Default

Rename tsvector delete() to ts_delete(), and filter() to ts_filter().

commit   : 0b9a23443283f9ffb17a39c25f74adefdb72cae1    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 May 2016 19:43:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 May 2016 19:43:32 -0400    

Click here for diff

The similarity of the original names to SQL keywords seems like a bad  
idea.  Rename them before we're stuck with 'em forever.  
  
In passing, minor code and docs cleanup.  
  
Discussion: <[email protected]>  

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

Small 9.6 release note improvements.

commit   : 2f38b986fa8ff048c7226f1ca212e12084c715cf    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 May 2016 18:52:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 May 2016 18:52:32 -0400    

Click here for diff

Sync release notes through today, and incorporate some suggestions  
from Robert Haas.  

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

Rename pgbench min/max to least/greatest, and fix handling of double args.

commit   : 7a622b2731db5d0f6db8a3d0af88177f96d1cb2e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 May 2016 14:51:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 May 2016 14:51:00 -0400    

Click here for diff

These functions behave like the backend's least/greatest functions,  
not like min/max, so the originally-chosen names invite confusion.  
Per discussion, rename to least/greatest.  
  
I also took it upon myself to make them return double if any input is  
double.  The previous behavior of silently coercing all inputs to int  
surely does not meet the principle of least astonishment.  
  
Copy-edit some of the other new functions' documentation, too.  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h

First-draft release notes for Postgres 9.6.

commit   : c311f7887376f7f3ce24c4c0dac4f9cb6ad3bee3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 May 2016 13:27:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 May 2016 13:27:59 -0400    

Click here for diff

These are just of beta quality, but we're only at beta ... the section  
about parallel query, in particular, could doubtless use more work.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/monitoring.sgml
A doc/src/sgml/release-9.6.sgml
M doc/src/sgml/release.sgml

Fix ordering/categorization of some recently-added system views.

commit   : a9ba6195f12d9b89e103c1b043cc6958e40b1ef0    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 May 2016 12:33:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 May 2016 12:33:12 -0400    

Click here for diff

Somebody added pg_replication_origin, pg_replication_origin_status and  
pg_replication_slots to catalogs.sgml without a whole lot of concern for  
either alphabetical order or the difference between a table and a view.  
Clean up the mess.  
  
Back-patch to 9.5, not so much because this is critical as because if  
I don't it will result in a cross-branch divergence in release-9.5.sgml,  
which would be a maintenance hazard.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/replication-origins.sgml

Fix corner-case loss of precision in numeric pow() calculation

commit   : 18a02ad2a506e4425c6dd2ea235039cd5659467d    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 5 May 2016 11:16:17 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 5 May 2016 11:16:17 +0100    

Click here for diff

Commit 7d9a4737c268f61fb8800957631f12d3f13be218 greatly improved the  
accuracy of the numeric transcendental functions, however it failed to  
consider the case where the result from pow() is close to the overflow  
threshold, for example 0.12 ^ -2345.6. For such inputs, where the  
result has more than 2000 digits before the decimal point, the decimal  
result weight estimate was being clamped to 2000, leading to a loss of  
precision in the final calculation.  
  
Fix this by replacing the clamping code with an overflow test that  
aborts the calculation early if the final result is sure to overflow,  
based on the overflow limit in exp_var(). This provides the same  
protection against integer overflow in the subsequent result scale  
computation as the original clamping code, but it also ensures that  
precision is never lost and saves compute cycles in cases that are  
sure to overflow.  
  
The new early overflow test works with the initial low-precision  
result (expected to be accurate to around 8 significant digits) and  
includes a small fuzz factor to ensure that it doesn't kick in for  
values that would not overflow exp_var(), so the overall overflow  
threshold of pow() is unchanged and consistent for all inputs with  
non-integer exponents.  
  
Author: Dean Rasheed  
Reviewed-by: Tom Lane  
Discussion: http://www.postgresql.org/message-id/CAEZATCUj3U-cQj0jjoia=qgs0SjE3auroxh8swvNKvZWUqegrg@mail.gmail.com  
See-also: http://www.postgresql.org/message-id/CAEZATCV7w+8iB=07dJ8Q0zihXQT1semcQuTeK+4_rogC_zq5Hw@mail.gmail.com  

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

Revert timeline following in replication slots

commit   : c1543a81a7a89207b6c45b8f3f7f07b1148fcc6e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 4 May 2016 17:32:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 4 May 2016 17:32:22 -0300    

Click here for diff

This reverts commits f07d18b6e94d, 82c83b337202, 3a3b309041b0, and  
24c5f1a103ce.  
  
This feature has shown enough immaturity that it was deemed better to  
rip it out before rushing some more fixes at the last minute.  There are  
discussions on larger changes in this area for the next release.  

M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/logical/logicalfuncs.c
M src/include/access/xlogreader.h
M src/test/modules/Makefile
D src/test/modules/test_slot_timelines/.gitignore
D src/test/modules/test_slot_timelines/Makefile
D src/test/modules/test_slot_timelines/README
D src/test/modules/test_slot_timelines/expected/load_extension.out
D src/test/modules/test_slot_timelines/expected/load_extension_1.out
D src/test/modules/test_slot_timelines/sql/load_extension.sql
D src/test/modules/test_slot_timelines/test_slot_timelines–1.0.sql
D src/test/modules/test_slot_timelines/test_slot_timelines.c
D src/test/modules/test_slot_timelines/test_slot_timelines.conf
D src/test/modules/test_slot_timelines/test_slot_timelines.control
M src/test/recovery/Makefile
D src/test/recovery/t/006_logical_decoding_timelines.pl

doc: Fix more typos

commit   : 6535bf399894db3597d257486062fe17311c642e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 May 2016 14:07:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 May 2016 14:07:00 -0400    

Click here for diff

From: Alexander Law <[email protected]>  

M doc/src/sgml/ecpg.sgml
M doc/src/sgml/ref/pg_xlogdump.sgml

Fix crash of filter(tsvector)

commit   : 4bbc1a7ea351f235eb9a4475ceb17d7e37a36473    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 4 May 2016 17:58:08 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 4 May 2016 17:58:08 +0300    

Click here for diff

Variable storing a position of lexeme, had a wrong type: char, it's  
obviously not enough to store 2^14 possible positions.  
  
Stas Kelvich  

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

Fix transient mdsync() errors of truncated relations due to 72a98a6395.

commit   : a712487087c73eee880ff1a7c50528cbab2f1b90    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 May 2016 01:54:20 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 May 2016 01:54:20 -0700    

Click here for diff

Unfortunately the segment size checks from 72a98a6395 had the negative  
side-effect of breaking a corner case in mdsync(): When processing a  
fsync request for a truncated away segment mdsync() could fail with  
"could not fsync file" (if previous segment < RELSEG_SIZE) because  
_mdfd_getseg() now wouldn't return the relevant segment anymore.  
  
The cleanest fix seems to be to allow the caller of _mdfd_getseg() to  
specify whether checks for RELSEG_SIZE are performed. To allow doing so,  
change the ExtensionBehavior enum into a bitmask. Besides allowing for  
the addition of EXTENSION_DONT_CHECK_SIZE, this makes for a nicer  
implementation of EXTENSION_REALLY_RETURN_NULL.  
  
Besides mdsync() the only callsite that should change behaviour due to  
this is mdprefetch() which now doesn't create segments anymore, even in  
recovery. Given the uses of mdprefetch() that seems better.  
  
Reported-By: Thom Brown  
Discussion: CAA-aLv72QazLvPdKZYpVn4a_Eh+i4_cxuB03k+iCuZM_xjc+6Q@mail.gmail.com  

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

doc: Fix typos

commit   : 613fb29a384c8a75146af7cfa433cfa61716f117    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 May 2016 21:06:25 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 May 2016 21:06:25 -0400    

Click here for diff

From: Alexander Law <[email protected]>  

M doc/src/sgml/ecpg.sgml
M doc/src/sgml/protocol.sgml

Fix more things to be parallel-safe.

commit   : 9888b34fdb169c1f0982ad700fc6d43e8b7aec14    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 3 May 2016 14:36:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 3 May 2016 14:36:38 -0400    

Click here for diff

Conversion functions were previously marked as parallel-unsafe, since  
that is the default, but in fact they are safe.  Parallel-safe  
functions defined in pg_proc.h and redefined in system_views.sql were  
ending up as parallel-unsafe because the redeclarations were not  
marked PARALLEL SAFE.  While editing system_views.sql, mark ts_debug()  
parallel safe also.  
  
Andreas Karlsson  

M src/backend/catalog/system_views.sql
M src/backend/utils/mb/conversion_procs/Makefile
M src/include/catalog/catversion.h

Tweak a few more things in preparation for upcoming pgindent run.

commit   : 8826d850781cb328482c8f92af2a3d93385cd63b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 3 May 2016 10:52:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 3 May 2016 10:52:25 -0400    

Click here for diff

These adjustments adjust code and comments in minor ways to prevent  
pgindent from mangling them.  Among other things, I tried to avoid  
situations where pgindent would emit "a +b" instead of "a + b", and I  
tried to avoid having it break up inline comments across multiple  
lines.  

M contrib/pageinspect/heapfuncs.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeAgg.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsvector_op.c

Note that max_worker_processes requires restart.

commit   : 1e77949e67b94af4d2a350c6dac9109419932608    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 3 May 2016 10:39:21 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 3 May 2016 10:39:21 -0400    

Click here for diff

Since this is a minor issue, no back-patch.  
  
Julien Rouhaud  

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

Fix thinko in comment

commit   : 6b6091682959adce6d66dcd6a047eb21cb120b16    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 2 May 2016 16:46:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 2 May 2016 16:46:42 -0300    

Click here for diff

Pointed out by Andres Freund  

M src/include/replication/slot.h

Fix code comments regarding logical decoding

commit   : 234a266066dc1c06a92ec85efb2f8948b7fbd320    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 2 May 2016 16:04:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 2 May 2016 16:04:29 -0300    

Click here for diff

Back in 3b02ea4f0780 I added some comments in various places to explain  
how logical decoding and other things worked.  Not all of the changes  
were welcome, because they were misleading or wrong.  This changes them  
a little bit to make them more accurate.  
  
Some other comments are also changed to be more accurate.  Also, fix a  
bunch of typos.  
  
Author: Álvaro Herrera, Craig Ringer  
  
Andres Freund reviewed some parts of this.  

M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/include/replication/slot.h

Docs: improve index entries for new tsvector functions.

commit   : 21c2b1c611d072f1a27defa89803fdd09b132605    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 May 2016 13:28:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 May 2016 13:28:52 -0400    

Click here for diff

Fix typos, reword some overly general index entries.  

M doc/src/sgml/func.sgml

Fix configure's incorrect version tests for flex and perl.

commit   : 7d7b129277eb545286aecf29ec22b5bb7fdf46bd    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 May 2016 11:18:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 May 2016 11:18:10 -0400    

Click here for diff

awk's equality-comparison operator is "==" not "=".  We got this right  
in many places, but not in configure's checks for supported version  
numbers of flex and perl.  It hadn't been noticed because unsupported  
versions are so old as to be basically extinct in the wild, and because  
the only consequence is whether or not a WARNING flies by during  
configure.  
  
Daniel Gustafsson noted the problem with respect to the test for flex,  
I found the other by reviewing other awk calls.  

M config/perl.m4
M config/programs.m4
M configure

Fix parallel safety markings for pg_start_backup.

commit   : 37d0c2cb1ab2d3da0cb9a6388450776fc31c16ee    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 2 May 2016 10:42:34 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 2 May 2016 10:42:34 -0400    

Click here for diff

Commit 7117685461af50f50c03f43e6a622284c8d54694 made pg_start_backup  
parallel-restricted rather than parallel-safe, because it now relies  
on backend-private state that won't be synchronized with the parallel  
worker.  However, it didn't update pg_proc.h.  Separately, Andreas  
Karlsson observed that system_views.sql neglected to reiterate the  
parallel-safety markings whe redefining various functions, including  
this one; so add a PARALLEL RESTRICTED declaration there to match  
the new value in pg_proc.h.  

M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h

Again update typedefs.list file in preparation for pgindent run

commit   : f2f5e7e78ed95bb28d8bde783c46562e3498ac99    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 2 May 2016 09:23:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 2 May 2016 09:23:55 -0400    

Click here for diff

This time, use the buildfarm-supplied contents for this file, instead  
of trying to update it by eyeballing the pgindent output.  
  
Per discussion with Tom and Bruce.  

M src/tools/pgindent/typedefs.list

Remove unused macros.

commit   : d22b85fbd4ca3b4c2f41d8d4372205d56b296eb3    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 2 May 2016 10:07:49 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 2 May 2016 10:07:49 +0300    

Click here for diff

CHECK_PAGE_OFFSET_RANGE() has been unused forever.  
CHECK_RELATION_BLOCK_RANGE() has been unused in pgstatindex.c ever since  
bt_page_stats() and bt_page_items() functions were moved from pgstattuple  
to pageinspect module. It still exists in pageinspect/btreefuncs.c.  
  
Daniel Gustafsson  

M contrib/pageinspect/btreefuncs.c
M contrib/pgstattuple/pgstatindex.c

doc: Fix typo

commit   : a956bf439584ac5955ccf4e9c1a9aed2e9c4c95c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 1 May 2016 21:33:31 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 1 May 2016 21:33:31 -0400    

Click here for diff

From: Guillaume Lelarge <[email protected]>  

M doc/src/sgml/xindex.sgml

Add a --non-master-only option to git_changelog.

commit   : 8473b7f95fbe8ef25dccd23ff94a4e363797bd90    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 1 May 2016 11:24:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 1 May 2016 11:24:32 -0400    

Click here for diff

This has the inverse effect of --master-only.  It's needed to help find  
cases where a commit should not be described in major release notes  
because it was back-patched into older branches, though not at the same  
time as the HEAD commit.  

M src/tools/git_changelog

Update contrib/unaccent documentation about its unaccent.rules file.

commit   : 6376a16ba24a5a097fc739b9c79ab555be4d9f1a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 30 Apr 2016 15:06:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 30 Apr 2016 15:06:26 -0400    

Click here for diff

Commit 1bbd52cb9a4aa61a didn't bother with such niceties.  

M doc/src/sgml/unaccent.sgml

Small improvements to OPTIMIZER_DEBUG code.

commit   : 2a2435e6995133c9d872ef9cb51432f0b678b978    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 30 Apr 2016 14:08:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 30 Apr 2016 14:08:00 -0400    

Click here for diff

Now that Paths have their own rows field, print that rather than  
the parent relation's rowcount.  
  
Show the relid sets associated with Paths using table names rather  
than numbers; since this code is able to print simple Var references  
using table names, it seems a bit silly that print_relids can't.  
  
Print the cheapest_parameterized_paths list for a RelOptInfo, and  
include information about a parameterized path's required_outer rels.  
  
Noted while trying to use this feature to debug Alexander Kirkouski's  
recent bug report.  

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

Fix planner crash from pfree'ing a partial path that a GatherPath uses.

commit   : c45bf5751b6338488bd79ce777210285531da373    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 30 Apr 2016 12:29:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 30 Apr 2016 12:29:21 -0400    

Click here for diff

We mustn't run generate_gather_paths() during add_paths_to_joinrel(),  
because that function can be invoked multiple times for the same target  
joinrel.  Not only is it wasteful to build GatherPaths repeatedly, but  
a later add_partial_path() could delete the partial path that a previously  
created GatherPath depends on.  Instead establish the convention that we  
do generate_gather_paths() for a rel only just before set_cheapest().  
  
The code was accidentally not broken for baserels, because as of today there  
never is more than one partial path for a baserel.  But that assumption  
obviously has a pretty short half-life, so move the generate_gather_paths()  
calls for those cases as well.  
  
Also add some generic comments explaining how and why this all works.  
  
Per fuzz testing by Andreas Seltenreich.  
  
Report: <[email protected]>  

M src/backend/optimizer/README
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/util/pathnode.c

Remove warning about num_sync being too large in synchronous_standby_names.

commit   : 17d5db352c1780f4721664f67bc3a3f3b1cf933c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 30 Apr 2016 10:54:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 30 Apr 2016 10:54:45 -0400    

Click here for diff

If we're not going to reject such setups entirely, throwing a WARNING in  
check_synchronous_standby_names() is unhelpful, because it will cause the  
warning to be logged again every time the postmaster receives SIGHUP.  
Per discussion, just remove the warning.  
  
In passing, improve the documentation for synchronous_commit, which had not  
gotten the word that now there can be more than one synchronous standby.  

M doc/src/sgml/config.sgml
M src/backend/replication/syncrep.c

Fix mishandling of equivalence-class tests in parameterized plans.

commit   : 207d5a656e2ecc98a1db5bdc22ea306f7f7c8d62    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Apr 2016 20:19:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Apr 2016 20:19:38 -0400    

Click here for diff

Given a three-or-more-way equivalence class, such as X.Y = Y.Y = Z.Z,  
it was possible for the planner to omit one of the quals needed to  
enforce that all members of the equivalence class are actually equal.  
This only happened in the case of a parameterized join node for two  
of the relations, that is a plan tree like  
  
	Nested Loop  
	  ->  Scan X  
	  ->  Nested Loop  
	    ->  Scan Y  
	    ->  Scan Z  
	          Filter: Z.Z = X.X  
  
The eclass machinery normally expects to apply X.X = Y.Y when those  
two relations are joined, but in this shape of plan tree they aren't  
joined until the top node --- and, if the lower nested loop is marked  
as parameterized by X, the top node will assume that the relevant eclass  
condition(s) got pushed down into the lower node.  On the other hand,  
the scan of Z assumes that it's only responsible for constraining Z.Z  
to match any one of the other eclass members.  So one or another of  
the required quals sometimes fell between the cracks, depending on  
whether consideration of the eclass in get_joinrel_parampathinfo()  
for the lower nested loop chanced to generate X.X = Y.Y or X.X = Z.Z  
as the appropriate constraint there.  If it generated the latter,  
it'd erroneously suppose that the Z scan would take care of matters.  
To fix, force X.X = Y.Y to be generated and applied at that join node  
when this case occurs.  
  
This is *extremely* hard to hit in practice, because various planner  
behaviors conspire to mask the problem; starting with the fact that the  
planner doesn't really like to generate a parameterized plan of the  
above shape.  (It might have been impossible to hit it before we  
tweaked things to allow this plan shape for star-schema cases.)  Many  
thanks to Alexander Kirkouski for submitting a reproducible test case.  
  
The bug can be demonstrated in all branches back to 9.2 where parameterized  
paths were introduced, so back-patch that far.  

M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/util/relnode.c
M src/include/optimizer/paths.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Add a few entries to the tail of time mapping, to see old values.

commit   : 7c3e8039f450eb99b3a73272d0a1661195747d1b    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 29 Apr 2016 16:46:08 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 29 Apr 2016 16:46:08 -0500    

Click here for diff

Without a few entries beyond old_snapshot_threshold, the lookup  
would often fail, resulting in the more aggressive pruning or  
vacuum being skipped often enough to matter.  This was very clearly  
shown by a python test script posted by Ants Aasma, and was likely  
a factor in an earlier but somewhat less clear-cut test case posted  
by Jeff Janes.  
  
This patch makes no change to the logic, per se -- it just makes  
the array of mapping entries big enough to make lookup misses based  
on timing much less likely.  An occasional miss is still possible  
if a thread stalls for more than 10 minutes, but that does not  
create any problem with correctness of behavior.  Besides, if  
things are so busy that a thread is stalling for more than 10  
minutes, it is probably OK to skip the more aggressive cleanup at  
that particular point in time.  

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

Fix comment whitespace in VS2105 patch

commit   : d34e7b2812467279b95060a4db8d9f4fc4be0e40    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 29 Apr 2016 14:18:51 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 29 Apr 2016 14:18:51 -0400    

Click here for diff

per gripe from Michael Paquier.  

M src/include/port/win32.h

doc: Minor wording changes

commit   : 82881b2b432c9433b45abc96acf49d5d690eb918    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Apr 2016 13:03:58 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Apr 2016 13:03:58 -0400    

Click here for diff

From: Dmitry Igrishin <[email protected]>  

M doc/src/sgml/trigger.sgml

Fix typo

commit   : a03bda323b0713aeaacfd0050be76df9e6b06a13    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 29 Apr 2016 16:14:20 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 29 Apr 2016 16:14:20 +0200    

Click here for diff

Author: Thomas Munro  

M src/include/storage/dsm_impl.h

Fix typo in VS2015 patch

commit   : 7dc549238eabe6a634af3e24520f2c3f5667f76f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 29 Apr 2016 09:49:31 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 29 Apr 2016 09:49:31 -0400    

Click here for diff

reported by Christian Ullrich  

M src/port/win32env.c

Support building with Visual Studio 2015

commit   : 0fb54de9aa4ffb792ea63af853146021ae501f12    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 29 Apr 2016 07:59:47 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 29 Apr 2016 07:59:47 -0400    

Click here for diff

Adjust the way we detect the locale. As a result the minumum Windows  
version supported by VS2015 and later is Windows Vista. Add some tweaks  
to remove new compiler warnings. Remove documentation references to the  
now obsolete msysGit.  
  
Michael Paquier, somewhat edited by me, reviewed by Christian Ullrich.  
  
Backpatch to 9.5  

M doc/src/sgml/install-windows.sgml
M src/backend/port/win32/crashdump.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/include/port/win32.h
M src/port/chklocale.c
M src/port/win32env.c
M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/VSObjectFactory.pm

Remember asking for feedback during walsender shutdown.

commit   : 59455018a8120bb3c02680b0f9764492c5283d99    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 28 Apr 2016 22:05:37 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 28 Apr 2016 22:05:37 -0700    

Click here for diff

Since 5a991ef8 we're explicitly asking for feedback from the receiving  
side when shutting down walsender, if there's not yet replicated  
data.  
  
Unfortunately we didn't remember (i.e. set waiting_for_ping_response to  
true) having asked for feedback, leading to scenarios in which replies  
were requested at a high frequency.  
  
I can't reproduce this problem on my laptop, I think that's because the  
problem requires a significant TCP window to manifest due to the  
!pq_is_send_pending() condition. But since this clearly is a bug, let's  
fix it.  There's quite possibly more wrong than just this though.  
  
While fiddling with WalSndDone(), I rewrote a hard to understand comment  
about looking at the flush vs. the write position.  
  
Reported-By: Nick Cleaton, Magnus Hagander  
Author: Nick Cleaton  
Discussion: CAFgz3kus=rC_avEgBV=+hRK5HYJ8vXskJRh8yEAbahJGTzF2VQ@mail.gmail.com  
    CABUevExsjROqDcD0A2rnJ6HK6FuKGyewJr3PL12pw85BHFGS2Q@mail.gmail.com  
Backpatch: 9.4, were 5a991ef8 introduced the use of feedback messages  
    during shutdown.  

M src/backend/replication/walsender.c

Adjust DatumGetBool macro, this time for sure.

commit   : 23b09e15b9f40baeff527ca4dbc40afc823dd962    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Apr 2016 11:50:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Apr 2016 11:50:58 -0400    

Click here for diff

Commit 23a41573c attempted to fix the DatumGetBool macro to ignore bits  
in a Datum that are to the left of the actual bool value.  But it did that  
by casting the Datum to bool; and on compilers that use C99 semantics for  
bool, that ends up being a whole-word test, not a 1-byte test.  This seems  
to be the true explanation for contrib/seg failing in VS2015.  To fix, use  
GET_1_BYTE() explicitly.  I think in the previous patch, I'd had some idea  
of not having to commit to bool being exactly 1 byte wide, but regardless  
of what the compiler's bool is, boolean columns and Datums are certainly  
1 byte wide.  
  
The previous fix was (eventually) back-patched into all active versions,  
so do likewise with this one.  

M src/include/postgres.h

Revert "Convert contrib/seg's bool-returning SQL functions to V1 call convention."

commit   : f050423052bc9265d4cd27555058435edd4bef87    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Apr 2016 11:46:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Apr 2016 11:46:07 -0400    

Click here for diff

This reverts commit c8e81afc60093b199a128ccdfbb692ced8e0c9cd.  
That turns out to have been based on a faulty diagnosis of why the  
VS2015 build was misbehaving.  Instead, we need to fix DatumGetBool().  

M contrib/seg/seg.c

Prevent to use magic constants

commit   : f8467f7da8685dbc47187864e5afe130d9c63fff    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 28 Apr 2016 16:39:25 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 28 Apr 2016 16:39:25 +0300    

Click here for diff

Use macroses for definition amstrategies/amsupport fields instead of  
hardcoded values.  
  
Author: Nikolay Shaplov with addition for contrib/bloom  

M contrib/bloom/blutils.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgutils.c
M src/include/access/hash.h
M src/include/access/nbtree.h

Prevent multiple cleanup process for pending list in GIN.

commit   : e2c79e14d998cd31f860854bc9210b37b457bb01    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 28 Apr 2016 16:21:42 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 28 Apr 2016 16:21:42 +0300    

Click here for diff

Previously, ginInsertCleanup could exit early if it detects that someone else  
is cleaning up the pending list, without waiting for that someone else to  
finish the job. But in this case vacuum could miss tuples to be deleted.  
  
Cleanup process now locks metapage with a help of heavyweight  
LockPage(ExclusiveLock), and it guarantees that there is no another cleanup  
process at the same time. Lock is taken differently depending on caller of  
cleanup process: any vacuums and gin_clean_pending_list() will be blocked  
until lock becomes available, ordinary insert uses conditional lock to  
prevent indefinite waiting on lock.  
  
Insert into pending list doesn't use this lock, so insertion isn't blocked.  
  
Also, patch adds stopping of cleanup process when at-start-cleanup-tail is  
reached in order to prevent infinite cleanup in case of massive insertion. But  
it will stop only for automatic maintenance tasks like autovacuum.  
  
Patch introduces choice of limit of memory to use: autovacuum_work_mem,  
maintenance_work_mem or work_mem depending on call path.  
  
Patch for previous releases should be reworked due to changes between 9.6 and  
previous ones in this area.  
  
Discover and diagnostics by Jeff Janes and Tomas Vondra  
  
Patch by me with some ideas of Jeff Janes  

M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginvacuum.c
M src/include/access/gin_private.h

Use memmove() not memcpy() to slide some pointers down.

commit   : ad520ec4acb8f0cdb143b63519be95a9549fa826    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 Apr 2016 18:19:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 Apr 2016 18:19:28 -0400    

Click here for diff

The previous coding here was formally undefined, though it seems to  
accidentally work on most platforms in the buildfarm.  Caught by some  
OpenBSD platforms in which libc contains an assertion check for  
overlapping areas passed to memcpy().  
  
Thomas Munro  

M src/test/isolation/isolationtester.c

Clean up parsing of synchronous_standby_names GUC variable.

commit   : 4c804fbdfb472cf71db33609258b8e1aaad81943    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 Apr 2016 17:55:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 Apr 2016 17:55:19 -0400    

Click here for diff

Commit 989be0810dffd08b added a flex/bison lexer/parser to interpret  
synchronous_standby_names.  It was done in a pretty crufty way, though,  
making assorted end-use sites responsible for calling the parser at the  
right times.  That was not only vulnerable to errors of omission, but made  
it possible that lexer/parser errors occur at very undesirable times,  
and created memory leakages even if there was no error.  
  
Instead, perform the parsing once during check_synchronous_standby_names  
and let guc.c manage the resulting data.  To do that, we have to flatten  
the parsed representation into a single hunk of malloc'd memory, but that  
is not very hard.  
  
While at it, work a little harder on making useful error reports for  
parsing problems; the previous code felt that "synchronous_standby_names  
parser returned 1" was an appropriate user-facing error message.  (To  
be fair, it did also log a syntax error message, but separately from the  
GUC problem report, which is at best confusing.)  It had some outright  
bugs in the face of invalid input, too.  
  
I (tgl) also concluded that we need to restrict unquoted names in  
synchronous_standby_names to be just SQL identifiers.  The previous coding  
would accept darn near anything, which (1) makes the quoting convention  
both nearly-unnecessary and formally ambiguous, (2) makes it very hard to  
understand what is a syntax error and what is a creative interpretation of  
the input as a standby name, and (3) makes it impossible to further extend  
the syntax in future without a compatibility break.  I presume that we're  
intending future extensions of the syntax, else this parsing infrastructure  
is massive overkill, so (3) is an important objection.  Since we've taken  
a compatibility hit for non-identifier names with this change anyway, we  
might as well lock things down now and insist that users use double quotes  
for standby names that aren't identifiers.  
  
Kyotaro Horiguchi and Tom Lane  

M doc/src/sgml/config.sgml
M src/backend/replication/syncrep.c
M src/backend/replication/syncrep_gram.y
M src/backend/replication/syncrep_scanner.l
M src/backend/replication/walsender.c
M src/backend/utils/misc/guc.c
M src/include/replication/syncrep.h

Fix wrong word.

commit   : 372ff7cae254ac110e2dd25f81cb000c61b60413    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 14:23:56 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 14:23:56 -0400    

Click here for diff

Commit a31212b429cd3397fb3147b1a584ae33224454a6 was a little too hasty.  
  
Per report from Tom Lane.  

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

Change postgresql.conf.sample to say that fsync=off will corrupt data.

commit   : a31212b429cd3397fb3147b1a584ae33224454a6    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 13:46:26 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 13:46:26 -0400    

Click here for diff

Discussion: [email protected]  
  
Per a suggestion from Craig Ringer.  This wording from Tom Lane,  
following discussion.  

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

Tighten up sanity checks for parallel aggregate in execQual.c.

commit   : cf402ba7340f66defe25bffa8621a54fd579196e    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 12:05:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 12:05:35 -0400    

Click here for diff

David Rowley  

M src/backend/executor/execQual.c

Remove inadvertently commited vim swapfile.

commit   : b33dc7766509be27bda62a8de7889b26dc2a366c    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 11:53:01 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 11:53:01 -0400    

Click here for diff

If you were wondering what editor I use, now you know.  

D src/backend/nodes/.nodeFuncs.c.swp

Update typedefs.list file in preparation for pgindent run

commit   : acb51bd71d16921cc18cd434d8e70ab0705d6856    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 11:47:28 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 11:47:28 -0400    

Click here for diff

In addition to adding new typedefs, I also re-sorted the file so that  
various entries add piecemeal, mostly or entirely by me, were alphabetized  
the same way as other entries in the file.  

M src/tools/pgindent/typedefs.list

commit   : 8126eaee2fed7cbc4e9fd6ba8713977ccacd77fe    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 11:29:45 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 11:29:45 -0400    

Click here for diff

In nodeFuncs.c, pgindent wants to introduce spurious indentation into  
the definitions of planstate_tree_walker and planstate_walk_subplans.  
Fix that by spreading the definition out across several lines, similar  
to what is already done for other walker functions in that file.  
  
In execParallel.c, in the definition of SharedExecutorInstrumentation,  
pgindent wants to insert more whitespace between the type name and the  
member name.  That causes it to mangle comments later on the line.  Fix  
by moving the comments out of line.  Now that we have a bit more room,  
add some more details that may be useful to the next person reading  
this code.  

M src/backend/executor/execParallel.c
A src/backend/nodes/.nodeFuncs.c.swp
M src/backend/nodes/nodeFuncs.c

Remove mergeHyperLogLog.

commit   : 360ca27a9b9793f3939c9f70de77c1272a110362    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 10:55:32 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 10:55:32 -0400    

Click here for diff

It's buggy.  If somebody needs this later, they'll need to put back  
a non-buggy vesion of it.  
  
Discussion: CAM3SWZT-i6R9JU5YXa8MJUou2_r3LfGJZpQ9tYa1BYxfkj0=cQ@mail.gmail.com  
Discussion: CAM3SWZRUOLsYoTT83QgdUy9D8ehYWm_nvbrrfcOOzikiRfFY7g@mail.gmail.com  
  
Peter Geoghegan  

M src/backend/lib/hyperloglog.c
M src/include/lib/hyperloglog.h

Fix EXPLAIN VERBOSE output for parallel aggregate.

commit   : 59eb55127906b943ff155240eebc161df8edb62f    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 07:33:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Apr 2016 07:33:33 -0400    

Click here for diff

The way that PartialAggregate and FinalizeAggregate plan nodes were  
displaying output columns before was bogus.  Now, FinalizeAggregate  
produces the same outputs as an Aggregate would have produced, while  
PartialAggregate produces each of those outputs prefixed by the word  
PARTIAL.  
  
Discussion: [email protected]  
  
Patch by me, reviewed by David Rowley.  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/tlist.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/primnodes.h

Don't open formally non-existent segments in _mdfd_getseg().

commit   : 72a98a639574d2e25ed94652848555900c81a799    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 26 Apr 2016 20:32:51 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 26 Apr 2016 20:32:51 -0700    

Click here for diff

Before this commit _mdfd_getseg(), in contrast to mdnblocks(), did not  
verify whether all segments leading up to the to-be-opened one, were  
RELSEG_SIZE sized. That is e.g. not the case after truncating a  
relation, because later segments just get truncated to zero length, not  
removed.  
  
Once a "non-existent" segment has been opened in a session, mdnblocks()  
will return wrong results, causing errors like "could not read block %u  
in file" when accessing blocks. Closing the session, or the later  
arrival of relevant invalidation messages, would "fix" the problem.  
  
That, so far, was mostly harmless, because most segment accesses are  
only done after an mdnblocks() call. But since 428b1d6b29ca we try to  
open segments that might have been deleted, to trigger kernel writeback  
from a backend's queue of recent writes.  
  
To fix check segment sizes in _mdfd_getseg() when opening previously  
unopened segments. In practice this shouldn't imply a lot of additional  
lseek() calls, because mdnblocks() will most of the time already have  
opened all relevant segments.  
  
This commit also fixes a second problem, namely that _mdfd_getseg(  
EXTENSION_RETURN_NULL) extends files during recovery, which is not  
desirable for the mdwriteback() case.  Add EXTENSION_REALLY_RETURN_NULL,  
which does not behave that way, and use it.  
  
Reported-By: Thom Brown  
Author: Andres Freund, Abhijit Menon-Sen  
Reviewd-By: Robert Haas, Fabien Coehlo  
Discussion: CAA-aLv6Dp_ZsV-44QA-2zgkqWKQq=GedBX2dRSrWpxqovXK=Pg@mail.gmail.com  
Fixes: 428b1d6b29ca599c5700d4bc4f4ce4c5880369bf  

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

Emit invalidations to standby for transactions without xid.

commit   : c6ff84b06a68b71719aa1aaa5f6704d8db1b51f8    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 23 Apr 2016 19:18:00 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 23 Apr 2016 19:18:00 -0700    

Click here for diff

So far, when a transaction with pending invalidations, but without an  
assigned xid, committed, we simply ignored those invalidation  
messages. That's problematic, because those are actually sent for a  
reason.  
  
Known symptoms of this include that existing sessions on a hot-standby  
replica sometimes fail to notice new concurrently built indexes and  
visibility map updates.  
  
The solution is to WAL log such invalidations in transactions without an  
xid. We considered to alternatively force-assign an xid, but that'd be  
problematic for vacuum, which might be run in systems with few xids.  
  
Important: This adds a new WAL record, but as the patch has to be  
back-patched, we can't bump the WAL page magic. This means that standbys  
have to be updated before primaries; otherwise  
"PANIC: standby_redo: unknown op code 32" errors can be encountered.  
  
XXX:  
  
Reported-By: Васильев Дмитрий, Masahiko Sawada  
Discussion:  
    CAB-SwXY6oH=9twBkXJtgR4UC1NqT-vpYAtxCseME62ADwyK5OA@mail.gmail.com  
    CAD21AoDpZ6Xjg=gFrGPnSn4oTRRcwK1EBrWCq9OqOHuAcMMC=w@mail.gmail.com  

M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/transam/xact.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/ipc/standby.c
M src/backend/utils/cache/inval.c
M src/include/replication/reorderbuffer.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h

Fix pg_get_functiondef to dump parallel-safety markings.

commit   : 2ac3be2e763d9b971352819f285dd51519e0aeb9    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 26 Apr 2016 22:56:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 26 Apr 2016 22:56:04 -0400    

Click here for diff

Ashutosh Sharma  

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

Impose a full barrier in generic-xlc.h atomics functions.

commit   : 213c7df0337278c71c98e90605dc83023db1a80e    
  
author   : Noah Misch <[email protected]>    
date     : Tue, 26 Apr 2016 21:53:58 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Tue, 26 Apr 2016 21:53:58 -0400    

Click here for diff

pg_atomic_compare_exchange_*_impl() were providing only the semantics of  
an acquire barrier.  Buildfarm members hornet and mandrill revealed this  
deficit beginning with commit 008608b9d51061b1f598c197477b3dc7be9c4a64.  
While we have no report of symptoms in 9.5, we can't rule out the  
possibility of certain compilers, hardware, or extension code relying on  
these functions' specified barrier semantics.  Back-patch to 9.5, where  
commit b64d92f1a5602c55ee8b27a7ac474f03b7aee340 introduced atomics.  
  
Reviewed by Andres Freund.  

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

pg_dump: Message style improvements

commit   : 3019f432d6fffe6d8e04f5ccc592eb385af96492    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Apr 2016 12:04:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Apr 2016 12:04:43 -0400    

Click here for diff

forgotten in b6dacc173b6830c515d970698cead9a85663c553  

M src/bin/pg_dump/pg_dump.c

Add a --brief option to git_changelog.

commit   : 8067c8f86b5f4516ee204a119a750329f7d126ee    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Apr 2016 18:52:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Apr 2016 18:52:17 -0400    

Click here for diff

In commit c0b050192, Andres introduced the idea of including one-line  
commit references in our major release notes.  Teach git_changelog to  
emit a (lightly adapted) version of that format, so that we don't  
have to laboriously add it to the notes after the fact.  The default  
output isn't changed, since I anticipate still using that for minor  
release notes.  

M src/tools/git_changelog

Fix tsearch docs

commit   : f1e3c76066f0066a8a9bb09b80cd97f11e4b2dc4    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 26 Apr 2016 20:26:26 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 26 Apr 2016 20:26:26 +0300    

Click here for diff

Remove mention of setweight(tsquery) which wasn't included in 9.6. Also  
replace old forgotten phrase operator to new one.  
  
Dmitry Ivanov  

M doc/src/sgml/textsearch.sgml

Fix order of shutdown cleanup operations in PostgresNode.pm.

commit   : 08af9219060a9526c69f5408b80eee0aa8f707e9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Apr 2016 12:43:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Apr 2016 12:43:03 -0400    

Click here for diff

Previously, database clusters created by a TAP test were shut down by  
DESTROY methods attached to the PostgresNode objects representing them.  
The trouble with that is that if the objects survive into the final global  
destruction phase (which they do), Perl executes the DESTROY methods in an  
unspecified order.  Thus, the order of shutdown of multiple clusters was  
indeterminate, which might lead to not-very-reproducible errors getting  
logged (eg from a slave whose master might or might not get killed first).  
Worse, the File::Temp objects representing the temporary PGDATA directories  
might get destroyed before the PostgresNode objects, resulting in attempts  
to delete PGDATA directories that still have live servers in them.  On  
Windows, this would lead to directory deletion failures; on Unix, it  
usually had no effects worse than erratic "could not open temporary  
statistics file "pg_stat/global.tmp": No such file or directory" log  
messages.  
  
While none of this would affect the reported result of the TAP test, which  
is already determined, it could be very confusing when one is trying to  
understand from the logs what went wrong with a failed test.  
  
To fix, do the postmaster shutdowns in an END block rather than at object  
destruction time.  The END block will execute at a well-defined (and  
reasonable) time during script termination, and it will stop the  
postmasters in order of PostgresNode object creation.  (Perhaps we should  
change that to be reverse order of creation, but the main point here is  
that we now have control which we did not before.)  Use "pg_ctl stop", not  
an asynchronous kill(SIGQUIT), so that we wait for the postmasters to shut  
down before proceeding with directory deletion.  
  
Deletion of temporary directories still happens in an unspecified order  
during global destruction, but I can see no reason to care about that  
once the postmasters are stopped.  

M src/test/perl/PostgresNode.pm

Yet more portability hacking for degree-based trig functions.

commit   : 82311bcdd76904b2cee7567e14e9fb0cf6c6178c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Apr 2016 11:24:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Apr 2016 11:24:15 -0400    

Click here for diff

The true explanation for Peter Eisentraut's report of inexact asind results  
seems to be that (a) he's compiling into x87 instruction set, which uses  
wider-than-double float registers, plus (b) the library function asin() on  
his platform returns a result that is wider than double and is not rounded  
to double width.  To fix, we have to force the function's result to be  
rounded comparably to what happened to the scaling constant asin_0_5.  
Experimentation suggests that storing it into a volatile local variable is  
the least ugly way of making that happen.  Although only asin() is known to  
exhibit an observable inexact result, we'd better do this in all the places  
where we're hoping to get an exact result by scaling.  

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

Enable parallel query by default.

commit   : 77cd477c4ba885cfa1ba67beaa82e06f2e182b85    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 26 Apr 2016 08:31:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 26 Apr 2016 08:31:38 -0400    

Click here for diff

Change max_parallel_degree default from 0 to 2.  It is possible that  
this is not a good idea, or that we should go with 1 worker rather  
than 2, but we won't find out without trying it.  Along the way,  
reword the documentation for max_parallel_degree a little bit to  
hopefully make it more clear.  
  
Discussion: [email protected]  

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

Fix typo in comment

commit   : b7351ced425f3937f0a61adb4ade1d4b93bf751d    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 26 Apr 2016 10:38:32 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 26 Apr 2016 10:38:32 +0200    

Click here for diff

Author: Daniel Gustafsson  

M src/backend/executor/execProcnode.c

pg_dump: Message style improvements

commit   : b6dacc173b6830c515d970698cead9a85663c553    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 25 Apr 2016 17:16:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 25 Apr 2016 17:16:59 -0400    

Click here for diff

M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c

Fix C comment typo and redundant test

commit   : e65953be4f540dce31f17db2934ee58365077272    
  
author   : Kevin Grittner <[email protected]>    
date     : Mon, 25 Apr 2016 15:42:29 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Mon, 25 Apr 2016 15:42:29 -0500    

Click here for diff

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

New method for preventing compile-time calculation of degree constants.

commit   : 6b1a213bbd6599228b2b67f7552ff7cc378797bf    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Apr 2016 15:21:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Apr 2016 15:21:04 -0400    

Click here for diff

Commit 65abaab547a5758b tried to prevent the scaling constants used in  
the degree-based trig functions from being precomputed at compile time,  
because some compilers do that with functions that don't yield results  
identical-to-the-last-bit to what you get at runtime.  A report from  
Peter Eisentraut suggests that some recent compilers are smart enough  
to see through that trick, though.  Instead, let's put the inputs to  
these calculations into non-const global variables, which should be a  
more reliable way of convincing the compiler that it can't assume that  
they are compile-time constants.  (If we really get desperate, we could  
mark these variables "volatile", but I do not believe we should have to.)  

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

Try harder to detect a port conflict in PostgresNode.pm.

commit   : 40e89e2ab89cb2801f6bc02f08dcc24d547530fc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Apr 2016 12:28:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Apr 2016 12:28:49 -0400    

Click here for diff

Commit fab84c7787f25756 tried to get away without doing an actual bind(),  
but buildfarm results show that that doesn't get the job done.  So we must  
really bind to the target port --- and at least on my Linux box, we need a  
listen() as well, or conflicts won't be detected.  We rely on SO_REUSEADDR  
to prevent problems from starting a postmaster on the socket immediately  
after we've bound to it in the test code.  (There may be platforms where  
that doesn't work too well.  But fortunately, we only really care whether  
this works on Windows, and there the default behavior should be OK.)  

M src/test/perl/PostgresNode.pm

Update GETTEXT_FILES after config and controldata refactoring

commit   : 63417b4b2e38897ea02fef416bd96113baa3ed45    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 24 Apr 2016 20:58:11 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 24 Apr 2016 20:58:11 -0400    

Click here for diff

M src/bin/pg_config/nls.mk
M src/bin/pg_controldata/nls.mk

doc: Fix typo

commit   : 96687497b640b24772da4e086c7690ee8d840f1c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 24 Apr 2016 20:44:22 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 24 Apr 2016 20:44:22 -0400    

Click here for diff

From: Andreas Seltenreich <[email protected]>  

M doc/src/sgml/logicaldecoding.sgml

Improve PostgresNode.pm's logic for detecting already-in-use ports.

commit   : fab84c7787f25756a9d7bcb8bc89145d237e8e85    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Apr 2016 15:31:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Apr 2016 15:31:36 -0400    

Click here for diff

Buildfarm members bowerbird and jacana have shown intermittent "could not  
bind IPv4 socket" failures in the BinInstallCheck stage since mid-December,  
shortly after commits 1caef31d9e550408 and 9821492ee417a591 changed the  
logic for selecting which port to use in temporary installations.  One  
plausible explanation is that we are randomly selecting ports that are  
already in use for some non-Postgres purpose.  Although the code tried  
to defend against already-in-use ports, it used pg_isready to probe  
the port which is quite unhelpful: if some non-Postgres server responds  
at the given address, pg_isready will generally say "no response",  
leading to exactly the wrong conclusion about whether the port is free.  
  
Instead, let's use a simple TCP connect() call to see if anything answers  
without making assumptions about what it is.  Note that this means there's  
no direct check for a conflicting Unix socket, but that should be okay  
because there should be no other Unix sockets in use in the temporary  
socket directory created for a test run.  
  
This is only a partial solution for the TCP case, since if the port number  
is in use for an outgoing connection rather than a listening socket, we'll  
fail to detect that.  We could try to bind() to the proposed port as a  
means of detecting that case, but that would introduce its own failure  
modes, since the system might consider the address to remain reserved for  
some period of time after we drop the bound socket.  Close study of the  
errors returned by bowerbird and jacana suggests that what we're seeing  
there may be conflicts with listening not outgoing sockets, so let's try  
this and see if it improves matters.  It's certainly better than what's  
there now, in any case.  
  
Michael Paquier, adjusted by me to work on non-Windows as well as Windows  

M src/test/perl/PostgresNode.pm

Fix documentation & config inconsistencies around 428b1d6b2.

commit   : 8f91d87d43d021db92c6edd966a4bb8c3a81ae39    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 24 Apr 2016 12:26:55 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 24 Apr 2016 12:26:55 -0700    

Click here for diff

Several issues:  
1) checkpoint_flush_after doc and code disagreed about the default  
2) new GUCs were missing from postgresql.conf.sample  
3) Outdated source-code comment about bgwriter_flush_after's default  
4) Sub-optimal categories assigned to new GUCs  
5) Docs suggested backend_flush_after is PGC_SIGHUP, but it's PGC_USERSET.  
6) Spell out int as integer in the docs, as done elsewhere  
  
Reported-By: Magnus Hagander, Fujii Masao  
Discussion: CAHGQGwETyTG5VYQQ5C_srwxWX7RXvFcD3dKROhvAWWhoSBdmZw@mail.gmail.com  

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

Rename strtoi() to strtoint().

commit   : 0ab3595e5bb53a8fc2cd231320b1af1ae3ed68e0    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Apr 2016 16:53:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Apr 2016 16:53:15 -0400    

Click here for diff

NetBSD has seen fit to invent a libc function named strtoi(), which  
conflicts with the long-established static functions of the same name in  
datetime.c and ecpg's interval.c.  While muttering darkly about intrusions  
on application namespace, we'll rename our functions to avoid the conflict.  
  
Back-patch to all supported branches, since this would affect attempts  
to build any of them on recent NetBSD.  
  
Thomas Munro  

M src/backend/utils/adt/datetime.c
M src/interfaces/ecpg/pgtypeslib/interval.c

doc: Fix typos

commit   : b87b2f4bda1a3b98f8dea867b8bc419ace7a9ea9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 23 Apr 2016 14:48:02 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 23 Apr 2016 14:48:02 -0400    

Click here for diff

From: Erik Rijkers <[email protected]>  

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

Properly mark initRectBox() as taking 'void' args

commit   : 915cee4595060fd536a7c997e37e4a535c3e0d4f    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 23 Apr 2016 10:41:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 23 Apr 2016 10:41:11 -0400    

Click here for diff

Was part of box type in SP-GiST index patch.  
  
Reported-by: Emre Hasegeli  

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

Convert contrib/seg's bool-returning SQL functions to V1 call convention.

commit   : c8e81afc60093b199a128ccdfbb692ced8e0c9cd    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Apr 2016 11:54:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Apr 2016 11:54:23 -0400    

Click here for diff

It appears that we can no longer get away with using V0 call convention  
for bool-returning functions in newer versions of MSVC.  The compiler  
seems to generate code that doesn't clear the higher-order bits of the  
result register, causing the bool result Datum to often read as "true"  
when "false" was intended.  This is not very surprising, since the  
function thinks it's returning a bool-width result but fmgr_oldstyle  
assumes that V0 functions return "char *"; what's surprising is that  
that hack worked for so long on so many platforms.  
  
The only functions of this description in core+contrib are in contrib/seg,  
which we'd intentionally left mostly in V0 style to serve as a warning  
canary if V0 call convention breaks.  We could imagine hacking things  
so that they're still V0 (we'd have to redeclare the bool-returning  
functions as returning some suitably wide integer type, like size_t,  
at the C level).  But on the whole it seems better to convert 'em to V1.  
We can still leave the pointer- and int-returning functions in V0 style,  
so that the test coverage isn't gone entirely.  
  
Back-patch to 9.5, since our intention is to support VS2015 in 9.5  
and later.  There's no SQL-level change in the functions' behavior  
so back-patching should be safe enough.  
  
Discussion: <[email protected]>  
  
Michael Paquier, adjusted some by me  

M contrib/seg/seg.c

Add putenv support for msvcrt from Visual Studio 2013

commit   : 9f633b404cb3be6139f8dfdea00538489ffef9ab    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 22 Apr 2016 05:18:59 -0400    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 22 Apr 2016 05:18:59 -0400    

Click here for diff

This was missed when VS 2013 support was added.  
  
Michael Paquier  

M src/port/win32env.c

Fix unexpected side-effects of operator_precedence_warning.

commit   : abb164655c703a5013b7fcf83f855a071895dc91    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2016 23:17:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2016 23:17:36 -0400    

Click here for diff

The implementation of that feature involves injecting nodes into the  
raw parsetree where explicit parentheses appear.  Various places in  
parse_expr.c that test to see "is this child node of type Foo" need to  
look through such nodes, else we'll get different behavior when  
operator_precedence_warning is on than when it is off.  Note that we only  
need to handle this when testing untransformed child nodes, since the  
AEXPR_PAREN nodes will be gone anyway after transformExprRecurse.  
  
Per report from Scott Ribe and additional code-reading.  Back-patch  
to 9.5 where this feature was added.  
  
Report: <[email protected]>  

M src/backend/parser/parse_expr.c

Fix planner failure with full join in RHS of left join.

commit   : 80f66a9ad06eafa91ffc5ff19c725c7f393c242e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2016 20:05:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2016 20:05:58 -0400    

Click here for diff

Given a left join containing a full join in its righthand side, with  
the left join's joinclause referencing only one side of the full join  
(in a non-strict fashion, so that the full join doesn't get simplified),  
the planner could fail with "failed to build any N-way joins" or related  
errors.  This happened because the full join was seen as overlapping the  
left join's RHS, and then recent changes within join_is_legal() caused  
that function to conclude that the full join couldn't validly be formed.  
Rather than try to rejigger join_is_legal() yet more to allow this,  
I think it's better to fix initsplan.c so that the required join order  
is explicit in the SpecialJoinInfo data structure.  The previous coding  
there essentially ignored full joins, relying on the fact that we don't  
flatten them in the joinlist data structure to preserve their ordering.  
That's sufficient to prevent a wrong plan from being formed, but as this  
example shows, it's not sufficient to ensure that the right plan will  
be formed.  We need to work a bit harder to ensure that the right plan  
looks sane according to the SpecialJoinInfos.  
  
Per bug #14105 from Vojtech Rylko.  This was apparently induced by  
commit 8703059c6 (though now that I've seen it, I wonder whether there  
are related cases that could have failed before that); so back-patch  
to all active branches.  Unfortunately, that patch also went into 9.0,  
so this bug is a regression that won't be fixed in that branch.  

M src/backend/optimizer/plan/initsplan.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Improve TranslateSocketError() to handle more Windows error codes.

commit   : 125ad539a275db5ab8f4647828b80a16d02eabd2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2016 16:58:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2016 16:58:47 -0400    

Click here for diff

The coverage was rather lean for cases that bind() or listen() might  
return.  Add entries for everything that there's a direct equivalent  
for in the set of Unix errnos that elog.c has heard of.  

M src/backend/port/win32/socket.c
M src/include/port/win32.h

Remove dead code in win32.h.

commit   : e54528155a3c4159b01327534691c3342a371cab    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2016 16:16:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2016 16:16:19 -0400    

Click here for diff

There's no longer a need for the MSVC-version-specific code stanza that  
forcibly redefines errno code symbols, because since commit 73838b52 we're  
unconditionally redefining them in the stanza before this one anyway.  
Now it's merely confusing and ugly, so get rid of it; and improve the  
comment that explains what's going on here.  
  
Although this is just cosmetic, back-patch anyway since I'm intending  
to back-patch some less-cosmetic changes in this same hunk of code.  

M src/include/port/win32.h

PGDLLIMPORT-ify old_snapshot_threshold.

commit   : 14216649f3dc8bd9839702440dd593e958b0920b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2016 14:33:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2016 14:33:34 -0400    

Click here for diff

Revert commit 7cb1db1d9599f0a09d6920d2149d956ef6d88b0e, which represented  
a misunderstanding of the problem (if snapmgr.h weren't already included  
in bufmgr.h, things wouldn't compile anywhere).  Instead install what  
I think is the real fix.  

M contrib/bloom/blscan.c
M src/include/utils/snapmgr.h

Fix ruleutils.c's dumping of ScalarArrayOpExpr containing an EXPR_SUBLINK.

commit   : 1f7c85b820814810f985a270e92cde4c12ceded4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2016 14:20:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2016 14:20:18 -0400    

Click here for diff

When we shoehorned "x op ANY (array)" into the SQL syntax, we created a  
fundamental ambiguity as to the proper treatment of a sub-SELECT on the  
righthand side: perhaps what's meant is to compare x against each row of  
the sub-SELECT's result, or perhaps the sub-SELECT is meant as a scalar  
sub-SELECT that delivers a single array value whose members should be  
compared against x.  The grammar resolves it as the former case whenever  
the RHS is a select_with_parens, making the latter case hard to reach ---  
but you can get at it, with tricks such as attaching a no-op cast to the  
sub-SELECT.  Parse analysis would throw away the no-op cast, leaving a  
parsetree with an EXPR_SUBLINK SubLink directly under a ScalarArrayOpExpr.  
ruleutils.c was not clued in on this fine point, and would naively emit  
"x op ANY ((SELECT ...))", which would be parsed as the first alternative,  
typically leading to errors like "operator does not exist: text = text[]"  
during dump/reload of a view or rule containing such a construct.  To fix,  
emit a no-op cast when dumping such a parsetree.  This might well be  
exactly what the user wrote to get the construct accepted in the first  
place; and even if she got there with some other dodge, it is a valid  
representation of the parsetree.  
  
Per report from Karl Czajkowski.  He mentioned only a case involving  
RLS policies, but actually the problem is very old, so back-patch to  
all supported branches.  
  
Report: <[email protected]>  

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

Prevent possible crash reading pg_stat_activity.

commit   : c4a586c4860477ddae6d4f9cef88486f0e37c37e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 21 Apr 2016 14:02:15 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 21 Apr 2016 14:02:15 -0400    

Click here for diff

Also, avoid reading PGPROC's wait_event field twice, once for the wait  
event and again for the wait_event_type, because the value might change  
in the middle.  
  
Petr Jelinek and Robert Haas  

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

Comment improvements for ForeignPath.

commit   : 36f69faeff540cd93de0b6aa7c2d2a7781d637a6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 21 Apr 2016 13:30:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 21 Apr 2016 13:30:48 -0400    

Click here for diff

It's not necessarily just scanning a base relation any more.  
  
Amit Langote and Etsuro Fujita  

M src/backend/optimizer/README
M src/include/nodes/relation.h

Fix assorted defects in 09adc9a8c09c9640de05c7023b27fb83c761e91c.

commit   : 9f84280ae94b43b75dcf32aef433545335e7bb16    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 21 Apr 2016 13:24:09 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 21 Apr 2016 13:24:09 -0400    

Click here for diff

That commit increased all shared memory allocations to the next higher  
multiple of PG_CACHE_LINE_SIZE, but it didn't ensure that allocation  
started on a cache line boundary.  It also failed to remove a couple  
other pieces of now-useless code.  
  
BUFFERALIGN() is perhaps obsolete at this point, and likely should be  
removed at some point, too, but that seems like it can be left to a  
future cleanup.  
  
Mistakes all pointed out by Andres Freund.  The patch is mine, with  
a few extra assertions which I adopted from his version of this fix.  

M src/backend/storage/buffer/buf_init.c
M src/backend/storage/ipc/shmem.c

Include snapmgr.h in blscan.c

commit   : 7cb1db1d9599f0a09d6920d2149d956ef6d88b0e    
  
author   : Kevin Grittner <[email protected]>    
date     : Thu, 21 Apr 2016 11:51:20 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Thu, 21 Apr 2016 11:51:20 -0500    

Click here for diff

Windows builds on buildfarm are failing because  
old_snapshot_threshold is not found in the bloom filter contrib  
module.  

M contrib/bloom/blscan.c

Allow queries submitted by postgres_fdw to be canceled.

commit   : f039eaac7131ef2a4cf63a10cf98486f8bcd09d2    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 21 Apr 2016 10:46:09 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 21 Apr 2016 10:46:09 -0400    

Click here for diff

This fixes a problem which is not new, but with the advent of direct  
foreign table modification in 0bf3ae88af330496517722e391e7c975e6bad219,  
it's somewhat more likely to be annoying than previously.  So,  
arrange for a local query cancelation to propagate to the remote side.  
  
Michael Paquier, reviewed by Etsuro Fujita.	 Original report by  
Thom Brown.  

M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h

Inline initial comparisons in TestForOldSnapshot()

commit   : 11e178d0dc4bc2328ae4759090b3c48b07023fab    
  
author   : Kevin Grittner <[email protected]>    
date     : Thu, 21 Apr 2016 08:40:08 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Thu, 21 Apr 2016 08:40:08 -0500    

Click here for diff

Even with old_snapshot_threshold = -1 (which disables the "snapshot  
too old" feature), performance regressions were seen at moderate to  
high concurrency.  For example, a one-socket, four-core system  
running 200 connections at saturation could see up to a 2.3%  
regression, with larger regressions possible on NUMA machines.  
By inlining the early (smaller, faster) tests in the  
TestForOldSnapshot() function, the i7 case dropped to a 0.2%  
regression, which could easily just be noise, and is clearly an  
improvement.  Further testing will show whether more is needed.  

M src/backend/storage/buffer/bufmgr.c
M src/include/storage/bufmgr.h

postgres_fdw: Don't push down certain full joins.

commit   : 5b1f9ce1d9e8dcae2bcd93b2becffaba5e4f3049    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 20 Apr 2016 23:34:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 20 Apr 2016 23:34:07 -0400    

Click here for diff

If there's a filter condition on either side of a full outer join,  
it is neither correct to attach it to the join's ON clause nor to  
throw it into the toplevel WHERE clause.  Just don't push down the  
join in that case.  
  
To maximize the number of cases where we can still push down full  
joins, push inner join conditions into the ON clause at the first  
opportunity rather than postponing them to the top-level WHERE  
clause.  This produces nicer SQL, anyway.  
  
This bug was introduced in e4106b2528727c4b48639c0e12bf2f70a766b910.  
  
Ashutosh Bapat, per report from Rajkumar Raghuwanshi.  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql

Honor PGCTLTIMEOUT environment variable for pg_regress' startup wait.

commit   : cbabb70f35bb0e5bac84b9f15ecadc82868ad9f9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Apr 2016 23:48:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Apr 2016 23:48:13 -0400    

Click here for diff

In commit 2ffa86962077c588 we made pg_ctl recognize an environment variable  
PGCTLTIMEOUT to set the default timeout for starting and stopping the  
postmaster.  However, pg_regress uses pg_ctl only for the "stop" end of  
that; it has bespoke code for starting the postmaster, and that code has  
historically had a hard-wired 60-second timeout.  Further buildfarm  
experience says it'd be a good idea if that timeout were also controlled  
by PGCTLTIMEOUT, so let's make it so.  Like the previous patch, back-patch  
to all active branches.  
  
Discussion: <[email protected]>  

M src/test/regress/pg_regress.c

Add pg_dump support for the new PARALLEL option for aggregates.

commit   : b4e0f183826e85fd43248d5047eddf393c3d8a30    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 20 Apr 2016 22:47:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 20 Apr 2016 22:47:20 -0400    

Click here for diff

This was an oversight in commit 41ea0c23761ca108e2f08f6e3151e3cb1f9652a1.  
  
Fabrízio de Royes Mello, per a report from Tushar Ahuja  

M src/bin/pg_dump/pg_dump.c

Forbid parallel Hash Right Join or Hash Full Join.

commit   : 9c75e1a36b6b2f3ad9f76ae661f42586c92c6f7c    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 20 Apr 2016 17:48:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 20 Apr 2016 17:48:55 -0400    

Click here for diff

That won't work.  You'll get bogus null-extended rows.  
  
Mithun Cy  

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

Update backup documentation for new APIs

commit   : cfb863f20a2a005ac89f393265d4c37ad9baab41    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 20 Apr 2016 14:40:04 -0400    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 20 Apr 2016 14:40:04 -0400    

Click here for diff

This includes the rest of the documentation that was not included  
in 7117685. A larger restructure would still be wanted, but with  
this commit the documentation of the new features is complete.  

M doc/src/sgml/backup.sgml

Fix memory leak and other bugs in ginPlaceToPage() & subroutines.

commit   : bde361fef5ea3c65074a0c95c724fae5ac8a1bb5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Apr 2016 14:25:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Apr 2016 14:25:15 -0400    

Click here for diff

Commit 36a35c550ac114ca turned the interface between ginPlaceToPage and  
its subroutines in gindatapage.c and ginentrypage.c into a royal mess:  
page-update critical sections were started in one place and finished in  
another place not even in the same file, and the very same subroutine  
might return having started a critical section or not.  Subsequent patches  
band-aided over some of the problems with this design by making things  
even messier.  
  
One user-visible resulting problem is memory leaks caused by the need for  
the subroutines to allocate storage that would survive until ginPlaceToPage  
calls XLogInsert (as reported by Julien Rouhaud).  This would not typically  
be noticeable during retail index updates.  It could be visible in a GIN  
index build, in the form of memory consumption swelling to several times  
the commanded maintenance_work_mem.  
  
Another rather nasty problem is that in the internal-page-splitting code  
path, we would clear the child page's GIN_INCOMPLETE_SPLIT flag well before  
entering the critical section that it's supposed to be cleared in; a  
failure in between would leave the index in a corrupt state.  There were  
also assorted coding-rule violations with little immediate consequence but  
possible long-term hazards, such as beginning an XLogInsert sequence before  
entering a critical section, or calling elog(DEBUG) inside a critical  
section.  
  
To fix, redefine the API between ginPlaceToPage() and its subroutines  
by splitting the subroutines into two parts.  The "beginPlaceToPage"  
subroutine does what can be done outside a critical section, including  
full computation of the result pages into temporary storage when we're  
going to split the target page.  The "execPlaceToPage" subroutine is called  
within a critical section established by ginPlaceToPage(), and it handles  
the actual page update in the non-split code path.  The critical section,  
as well as the XLOG insertion call sequence, are both now always started  
and finished in ginPlaceToPage().  Also, make ginPlaceToPage() create and  
work in a short-lived memory context to eliminate the leakage problem.  
(Since a short-lived memory context had been getting created in the most  
common code path in the subroutines, this shouldn't cause any noticeable  
performance penalty; we're just moving the overhead up one call level.)  
  
In passing, fix a bunch of comments that had gone unmaintained throughout  
all this klugery.  
  
Report: <[email protected]>  

M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/include/access/gin_private.h

Revert no-op changes to BufferGetPage()

commit   : a343e223a5c33a7283a6d8b255c9dbc48dbc5061    
  
author   : Kevin Grittner <[email protected]>    
date     : Wed, 20 Apr 2016 08:31:19 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Wed, 20 Apr 2016 08:31:19 -0500    

Click here for diff

The reverted changes were intended to force a choice of whether any  
newly-added BufferGetPage() calls needed to be accompanied by a  
test of the snapshot age, to support the "snapshot too old"  
feature.  Such an accompanying test is needed in about 7% of the  
cases, where the page is being used as part of a scan rather than  
positioning for other purposes (such as DML or vacuuming).  The  
additional effort required for back-patching, and the doubt whether  
the intended benefit would really be there, have indicated it is  
best just to rely on developers to do the right thing based on  
comments and existing usage, as we do with many other conventions.  
  
This change should have little or no effect on generated executable  
code.  
  
Motivated by the back-patching pain of Tom Lane and Robert Haas  

M contrib/bloom/blinsert.c
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/rawpage.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/pgstattuple.c
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashutil.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogutils.c
M src/backend/catalog/index.c
M src/backend/commands/analyze.c
M src/backend/commands/sequence.c
M src/backend/commands/trigger.c
M src/backend/commands/vacuumlazy.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeSamplescan.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/fsmpage.c
M src/include/storage/bufmgr.h

Improve regression tests for degree-based trigonometric functions.

commit   : 4db0d2d2fe935e086dfd26c00f707dab298b443c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Apr 2016 16:47:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Apr 2016 16:47:21 -0400    

Click here for diff

Print the actual value of each function result that's expected to be exact,  
rather than merely emitting a NULL if it's not right.  Although we print  
these with extra_float_digits = 3, we should not trust that the platform  
will produce a result visibly different from the expected value if it's off  
only in the last place; hence, also include comparisons against the exact  
values as before.  This is a bit bulkier and uglier than the previous  
printout, but it will provide more information and be easier to interpret  
if there's a test failure.  
  
Discussion: <[email protected]>  

M src/test/regress/expected/float8-exp-three-digits-win32.out
M src/test/regress/expected/float8-small-is-zero.out
M src/test/regress/expected/float8-small-is-zero_1.out
M src/test/regress/expected/float8.out
M src/test/regress/sql/float8.sql

Make partition-lock-release coding more transparent in BufferAlloc().

commit   : a0382e2d7e330de13e15cea0921a95faa9da3570    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Apr 2016 18:05:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Apr 2016 18:05:56 -0400    

Click here for diff

Coverity complained that oldPartitionLock was possibly dereferenced after  
having been set to NULL.  That actually can't happen, because we'd only use  
it if (oldFlags & BM_TAG_VALID) is true.  But nonetheless Coverity is  
justified in complaining, because at line 1275 we actually overwrite  
oldFlags, and then still expect its BM_TAG_VALID bit to be a safe guide to  
whether to release the oldPartitionLock.  Thus, the code would be incorrect  
if someone else had changed the buffer's BM_TAG_VALID flag meanwhile.  
That should not happen, since we hold pin on the buffer throughout this  
sequence, but it's starting to look like a rather shaky chain of logic.  
And there's no need for such assumptions, because we can simply replace  
the (oldFlags & BM_TAG_VALID) tests with (oldPartitionLock != NULL),  
which has identical results and makes it plain to all comers that we don't  
dereference a null pointer.  A small side benefit is that the range of  
liveness of oldFlags is greatly reduced, possibly allowing the compiler  
to save a register.  
  
This is just cleanup, not an actual bug fix, so there seems no need  
for a back-patch.  

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

Further reduce the number of semaphores used under --disable-spinlocks.

commit   : 75c24d0f7491f77dfbc0acdf6c18439f288353ef    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Apr 2016 13:33:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Apr 2016 13:33:06 -0400    

Click here for diff

Per discussion, there doesn't seem to be much value in having  
NUM_SPINLOCK_SEMAPHORES set to 1024: under any scenario where you are  
running more than a few backends concurrently, you really had better have a  
real spinlock implementation if you want tolerable performance.  And 1024  
semaphores is a sizable fraction of the system-wide SysV semaphore limit  
on many platforms.  Therefore, reduce this setting's default value to 128  
to make it less likely to cause out-of-semaphores problems.  

M src/include/pg_config_manual.h

Fix typo in docs.

commit   : 8ce8307bd4d6028371c6e8b51bdc6ad260baa03a    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 18 Apr 2016 13:35:21 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 18 Apr 2016 13:35:21 +0900    

Click here for diff

Artur Zakirov  

M doc/src/sgml/indexam.sgml

doc: Document that sequences can also be extension configuration tables

commit   : d460c7cc0fd43a7f7184818c67705a878e938b2d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 17 Apr 2016 23:13:45 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 17 Apr 2016 23:13:45 -0400    

Click here for diff

From: Michael Paquier <[email protected]>  

M doc/src/sgml/extend.sgml

Avoid code duplication in \crosstabview.

commit   : 9603a32594d2f5e6d9a1f098bc554a68f44ccb3c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Apr 2016 11:37:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Apr 2016 11:37:58 -0400    

Click here for diff

In commit 6f0d6a507 I added a duplicate copy of psqlscanslash's identifier  
downcasing code, but actually it's not hard to split that out as a callable  
subroutine and avoid the duplication.  

M src/bin/psql/crosstabview.c
M src/bin/psql/psqlscanslash.h
M src/bin/psql/psqlscanslash.l

Adjust spin.c's spinlock emulation so that 0 is not a valid spinlock value.

commit   : 4039c736eb0955cb1daf88e211f105dbbb78f7ea    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Apr 2016 19:53:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Apr 2016 19:53:38 -0400    

Click here for diff

We've had repeated troubles over the years with failures to initialize  
spinlocks correctly; see 6b93fcd14 for a recent example.  Most of the time,  
on most platforms, such oversights can escape notice because all-zeroes is  
the expected initial content of an slock_t variable.  The only platform  
we have where the initialized state of an slock_t isn't zeroes is HPPA,  
and that's practically gone in the wild.  To make it easier to catch such  
errors without needing one of those, adjust the --disable-spinlocks code  
so that zero is not a valid value for an slock_t for it.  
  
In passing, remove a bunch of unnecessary #include's from spin.c;  
commit daa7527afc227443 removed all the intermodule coupling that  
made them necessary.  

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

doc: Change some "user" to "role" for consistency in the section

commit   : 5fdda1ceab35311367ed0dbb283cd8aea896e49b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 16 Apr 2016 12:54:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 16 Apr 2016 12:54:56 -0400    

Click here for diff

suggested by Johannes Choo  

M doc/src/sgml/ddl.sgml

doc: Markup improvement

commit   : efb25e56d8a43917bcadfe3904691b1e1cdbbe20    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 16 Apr 2016 12:49:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 16 Apr 2016 12:49:36 -0400    

Click here for diff

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

Disallow creation of indexes on system columns (except for OID).

commit   : c34df8a003c3e478d70e8251bd2a24d710b297d4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Apr 2016 12:11:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Apr 2016 12:11:41 -0400    

Click here for diff

Although OID acts pretty much like user data, the other system columns do  
not, so an index on one would likely misbehave.  And it's pretty hard to  
see a use-case for one, anyway.  Let's just forbid the case rather than  
worry about whether it should be supported.  
  
David Rowley  

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

In recordExtensionInitPriv(), keep the scan til we're done with it

commit   : 99f2f3c19ae7d6aa2950a9bdb549217c5a60d941    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 15 Apr 2016 21:57:15 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 15 Apr 2016 21:57:15 -0400    

Click here for diff

For reasons of sheer brain fade, we (I) was calling systable_endscan()  
immediately after systable_getnext() and expecting the tuple returned  
by systable_getnext() to still be valid.  
  
That's clearly wrong.  Move the systable_endscan() down below the tuple  
usage.  
  
Discovered initially by Pavel Stehule and then also by Alvaro.  
  
Add a regression test based on Alvaro's testing.  

M src/backend/catalog/aclchk.c
M src/test/modules/test_extensions/Makefile
M src/test/modules/test_extensions/expected/test_extensions.out
M src/test/modules/test_extensions/sql/test_extensions.sql
A src/test/modules/test_extensions/test_ext6–1.0.sql
A src/test/modules/test_extensions/test_ext6.control

doc: Add missing parentheses

commit   : d2de44c2ce5c697a2de8089fb377816b2387107a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Apr 2016 20:44:10 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Apr 2016 20:44:10 -0400    

Click here for diff

From: Alexander Law <[email protected]>  

M doc/src/sgml/ecpg.sgml

psql: Add new gettext trigger

commit   : c3136876734b31ce50018f39c87b00145a8c7c33    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Apr 2016 20:23:41 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Apr 2016 20:23:41 -0400    

Click here for diff

M src/bin/psql/nls.mk

Use less-generic names in matview.sql.

commit   : 4447f0bcb66547708fa977d6b252046e792a7e04    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Apr 2016 13:04:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Apr 2016 13:04:17 -0400    

Click here for diff

The original coding of this test used table and view names like "t",  
"tv", "foo", etc.  This tended to interfere with doing simple manual  
tests in the regression database; not to mention that it posed a  
considerable risk of conflict with other regression test scripts.  
Prefix these names with "mvtest_" to avoid such conflicts.  
  
Also, change transiently-created role name to be "regress_xxx" per  
discussions about being careful with regression-test role creation.  

M src/test/regress/expected/matview.out
M src/test/regress/expected/rules.out
M src/test/regress/output/misc.source
M src/test/regress/sql/matview.sql

Fix possible crash in ALTER TABLE ... REPLICA IDENTITY USING INDEX.

commit   : 8f1911d5e6d5a1e62c860ddb040d664b01c6415c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Apr 2016 12:11:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Apr 2016 12:11:27 -0400    

Click here for diff

Careless coding added by commit 07cacba983ef79be could result in a crash  
or a bizarre error message if someone tried to select an index on the  
OID column as the replica identity index for a table.  Back-patch to 9.4  
where the feature was introduced.  
  
Discussion: CAKJS1f8TQYgTRDyF1_u9PVCKWRWz+DkieH=U7954HeHVPJKaKg@mail.gmail.com  
  
David Rowley  

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

postgres_fdw: Clean up handling of system columns.

commit   : da7d44b627ba839de32c9409aca659f60324de76    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 15 Apr 2016 11:58:56 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 15 Apr 2016 11:58:56 -0400    

Click here for diff

Previously, querying the xmin column of a single postgres_fdw foreign  
table fetched the tuple length, xmax the typmod, and cmin or cmax the  
composite type OID of the tuple.  However, when you queried several  
such tables and the join got shipped to the remote side, these columns  
ended up containing the remote values of the corresponding columns.  
Both behaviors are rather unprincipled, the former for obvious reasons  
and the latter because the remote values of these columns don't have  
any local significance; our transaction IDs are in a different space  
than those of the remote machine.  Clean this up by setting all of  
these fields to 0 in both cases.  Also fix the handling of tableoid  
to be sane.  
  
Robert Haas and Ashutosh Bapat, reviewed by Etsuro Fujita.  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c

Tweak EXPLAIN for parallel query to show workers launched.

commit   : 5702277ca97396384eaf5c58d582b79b9984ce73    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 15 Apr 2016 11:49:41 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 15 Apr 2016 11:49:41 -0400    

Click here for diff

The previous display was sort of confusing, because it didn't  
distinguish between the number of workers that we planned to launch  
and the number that actually got launched.  This has already confused  
several people, so display both numbers and label them clearly.  
  
Julien Rouhaud, reviewed by me.  

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

Fix portability problem induced by commit a6f6b7819.

commit   : 6b85d4ba9b09dc94cf1b14aef517da095a83cdbb    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Apr 2016 10:44:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Apr 2016 10:44:28 -0400    

Click here for diff

pg_xlogdump includes bufmgr.h.  With a compiler that emits code for  
static inline functions even when they're unreferenced, that leads  
to unresolved external references in the new static-inline version  
of BufferGetPage().  So hide it with #ifndef FRONTEND, as we've done  
for similar issues elsewhere.  Per buildfarm member pademelon.  

M src/backend/storage/buffer/bufmgr.c
M src/include/storage/bufmgr.h

Fix typo in comment

commit   : ba8fe38f58e2f3d86c5361373598af80d5ce4443    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 15 Apr 2016 13:32:54 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 15 Apr 2016 13:32:54 +0200    

Click here for diff

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

Update helptext for vcregress.pl

commit   : cf086b1c2fa1e11c14a9fe5fea05553974a480ef    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 15 Apr 2016 10:04:10 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 15 Apr 2016 10:04:10 +0200    

Click here for diff

This has clearly not been tracking the code changse for quite some time.  
  
Michael Paquier, problem spotted by Kyotaro HORIGUCHI  

M src/tools/msvc/vcregress.pl

Make regression test for multiple synchronous standbys more stable.

commit   : 36c1c91604cee164c6487afb99508f7ff8737b96    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 15 Apr 2016 13:58:14 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 15 Apr 2016 13:58:14 +0900    

Click here for diff

The regression test checks whether the output of pg_stat_replication is  
expected or not after changing synchronous_standby_names and reloading  
the configuration file. Regarding this test logic, previously there was  
a timing issue which made the test result unstable. That is,  
pg_stat_replication could return unexpected result during small window  
after the configuration file was reloaded before new setting value  
took effect, and which made the test fail.  
  
This commit changes the test logic so that it uses a loop with a timeout  
to give some room for the test to pass. Now the test fails only when  
pg_stat_replication keeps returning unexpected result for 30 seconds.  
  
Michael Paquier  

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

Fix memory leak in GIN index scans.

commit   : f0e766bd7f77774075297526bd2da8f3de226c1f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Apr 2016 00:02:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Apr 2016 00:02:26 -0400    

Click here for diff

The code had a query-lifespan memory leak when encountering GIN entries  
that have posting lists (rather than posting trees, ie, there are a  
relatively small number of heap tuples containing this index key value).  
With a suitable data distribution this could add up to a lot of leakage.  
Problem seems to have been introduced by commit 36a35c550, so back-patch  
to 9.4.  
  
Julien Rouhaud  

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

Rethink \crosstabview's argument parsing logic.

commit   : 6f0d6a507889d94a79c0d18577a0cb1ccc2b6815    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2016 22:54:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2016 22:54:26 -0400    

Click here for diff

\crosstabview interpreted its arguments in an unusual way, including  
doing case-insensitive matching of unquoted column names, which is  
surely not the right thing.  Rip that out in favor of doing something  
equivalent to the dequoting/case-folding rules used by other psql  
commands.  To keep it simple, change the syntax so that the optional  
sort column is specified as a separate argument, instead of the  
also-quite-unusual syntax that attached it to the colH argument with  
a colon.  
  
Also, rework the error messages to be closer to project style.  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/crosstabview.c
M src/bin/psql/settings.h
M src/test/regress/expected/psql_crosstab.out
M src/test/regress/sql/psql_crosstab.sql

Make init_spin_delay() C89 compliant #2.

commit   : 4b74c6a40e7ac9dad7cdeb4cfd2d51ea60cfdbb5    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 14 Apr 2016 19:26:13 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 14 Apr 2016 19:26:13 -0700    

Click here for diff

My previous attempt at doing so, in 80abbeba23, was not sufficient. While that  
fixed the problem for bufmgr.c and lwlock.c , s_lock.c still has non-constant  
expressions in the struct initializer, because the file/line/function  
information comes from the caller of s_lock().  
  
Give up on using a macro, and use a static inline instead.  
  
Discussion: [email protected]  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/s_lock.c
M src/include/storage/s_lock.h

Remove trailing commas in enums.

commit   : 533cd2303aa6558721e76295fd1ffb05211764f9    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 14 Apr 2016 18:54:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 14 Apr 2016 18:54:06 -0700    

Click here for diff

These aren't valid C89. Found thanks to gcc's -Wc90-c99-compat. These  
exist in differing places in most supported branches.  

M src/backend/executor/execIndexing.c
M src/include/access/xlog_internal.h
M src/include/pgstat.h

Fix trivial typo.

commit   : 7b16781228d6c0a2db66d71e33e64b9606779feb    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 13 Apr 2016 17:47:41 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 13 Apr 2016 17:47:41 -0700    

Click here for diff

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

Fix core dump in ReorderBufferRestoreChange on alignment-picky platforms.

commit   : 6a3d3965d6d5eec30e1c36b3ffa3355ee9201933    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2016 19:42:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2016 19:42:21 -0400    

Click here for diff

When re-reading an update involving both an old tuple and a new tuple from  
disk, reorderbuffer.c was careless about whether the new tuple is suitably  
aligned for direct access --- in general, it isn't.  We'd missed seeing  
this in the buildfarm because the contrib/test_decoding tests exercise this  
code path only a few times, and by chance all of those cases have old  
tuples with length a multiple of 4, which is usually enough to make the  
access to the new tuple's t_len safe.  For some still-not-entirely-clear  
reason, however, Debian's sparc build gets a bus error, as reported by  
Christoph Berg; perhaps it's assuming 8-byte alignment of the pointer?  
  
The lack of previous field reports is probably because you need all of  
these conditions to trigger a crash: an alignment-picky platform (not  
Intel), a transaction large enough to spill to disk, an update within  
that xact that changes a primary-key field and has an odd-length old tuple,  
and of course logical decoding tracing the transaction.  
  
Avoid the alignment assumption by using memcpy instead of fetching t_len  
directly, and add a test case that exposes the crash on picky platforms.  
Back-patch to 9.4 where the bug was introduced.  
  
Discussion: <[email protected]>  

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

Adjust signature of walrcv_receive hook.

commit   : c2dc194bdbf5f84ceb433ed416eb389c1234ebc9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2016 13:49:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2016 13:49:37 -0400    

Click here for diff

Commit 314cbfc5da988eff redefined the signature of this hook as  
typedef int (*walrcv_receive_type) (char **buffer, int *wait_fd);  
  
But in fact the type of the "wait_fd" variable ought to be pgsocket,  
which is what WaitLatchOrSocket expects, and which is necessary if  
we want to be able to assign PGINVALID_SOCKET to it on Windows.  
So fix that.  

M src/backend/replication/README
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/walreceiver.c
M src/include/replication/walreceiver.h

Adjust datatype of ReplicationState.acquired_by.

commit   : 994f11257328e272a6a43d3de59ffa916cbfbe96    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2016 12:18:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2016 12:18:09 -0400    

Click here for diff

It was declared as "pid_t", which would be fine except that none of  
the places that printed it in error messages took any thought for the  
possibility that it's not equivalent to "int".  This leads to warnings  
on some buildfarm members, and could possibly lead to actually wrong  
error messages on those platforms.  There doesn't seem to be any very  
good reason not to just make it "int"; it's only ever assigned from  
MyProcPid, which is int.  If we want to cope with PIDs that are wider  
than int, this is not the place to start.  
  
Also, fix the comment, which seems to perhaps be a leftover from a time  
when the field was only a bool?  
  
Per buildfarm.  Back-patch to 9.5 which has same issue.  

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

Docs: clarify description of LIMIT/OFFSET behavior.

commit   : fda21aa05bdc96c2c4141f5fd1245a11a41cf62c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2016 10:57:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2016 10:57:29 -0400    

Click here for diff

Section 7.6 was a tad confusing because it specified what LIMIT NULL  
does, but neglected to do the same for OFFSET NULL, making this look  
like perhaps a special case or a wrong restatement of the bit about  
LIMIT ALL.  Wordsmith a bit while at it.  Per bug #14084.  

M doc/src/sgml/queries.sgml

Fix prototype of pgwin32_bind().

commit   : 22989a8e34168f576e0f90b16fc3edabd28c40e6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2016 09:44:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2016 09:44:21 -0400    

Click here for diff

I (tgl) had copied-and-pasted this from pgwin32_accept(), failing to  
notice that the third parameter should be "int" not "int *".  
  
David Rowley  

M src/backend/port/win32/socket.c
M src/include/port/win32.h

Fix broken dependency-mongering for index operator classes/families.

commit   : 92a30a7eb0cadb008e18053f199af7de3fc1abaa    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2016 23:33:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2016 23:33:31 -0400    

Click here for diff

For a long time, opclasscmds.c explained that "we do not create a  
dependency link to the AM [for an opclass or opfamily], because we don't  
currently support DROP ACCESS METHOD".  Commit 473b93287040b200 invented  
DROP ACCESS METHOD, but it batted only 1 for 2 on adding the dependency  
links, and 0 for 2 on updating the comments about the topic.  
  
In passing, undo the same commit's entirely inappropriate decision to  
blow away an existing index as a side-effect of create_am.sql.  

M src/backend/commands/opclasscmds.c
M src/test/regress/expected/create_am.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/create_am.sql

Fix duplicated index entry in doc.

commit   : c8cb7453233b31a177b08a3b2bdac4c31508dc00    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 14 Apr 2016 11:17:41 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 14 Apr 2016 11:17:41 +0900    

Click here for diff

Commit cfe96ae corrected the name of pg_logical_emit_message()  
in its index entry. But this typo fix caused duplicated index  
entry because there was another index entry for the function.  
  
Spotted by Tom Lane.  

M doc/src/sgml/func.sgml

Disallow SET SESSION AUTHORIZATION pg_*

commit   : bfed4ab824789fd7c000286650d4498dccb05634    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 13 Apr 2016 21:31:24 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 13 Apr 2016 21:31:24 -0400    

Click here for diff

As part of reserving the pg_* namespace for default roles and in line  
with SET ROLE and other previous efforts, disallow settings the role  
to a default/reserved role using SET SESSION AUTHORIZATION.  
  
These checks and restrictions on what is allowed regarding default /  
reserved roles are under debate, but it seems prudent to ensure that  
the existing checks at least cover the intended cases while the  
debate rages on.  On me to clean it up if the consensus decision is  
to remove these checks.  

M src/backend/commands/variable.c

Add required database and origin filtering for logical messages.

commit   : be65eddd80093a923b091dc60776aa6f966d1f07    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 13 Apr 2016 17:38:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 13 Apr 2016 17:38:54 -0700    

Click here for diff

Logical messages, added in 3fe3511d05, during decoding failed to filter  
messages emitted in other databases and messages emitted "under" a  
replication origin the output plugin isn't interested in.  
  
Add tests to verify that both types of filtering actually work. While  
touching message.sql remove hunk obsoleted by d25379e.  
  
Bump XLOG_PAGE_MAGIC because xl_logical_message changed and because  
3fe3511d05 had omitted doing so. 3fe3511d05 additionally didn't bump  
catversion, but 7a542700d has done so since.  
  
Author: Petr Jelinek  
Reported-By: Andres Freund  
Discussion: [email protected]  

M contrib/test_decoding/expected/messages.out
M contrib/test_decoding/expected/replorigin.out
M contrib/test_decoding/sql/messages.sql
M contrib/test_decoding/sql/replorigin.sql
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/message.c
M src/include/access/xlog_internal.h
M src/include/replication/message.h

Make init_spin_delay() C89 compliant and change stuck spinlock reporting.

commit   : 80abbeba23d466b6541cf95082a9e1f36704424e    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 13 Apr 2016 16:42:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 13 Apr 2016 16:42:01 -0700    

Click here for diff

The current definition of init_spin_delay (introduced recently in  
48354581a) wasn't C89 compliant. It's not legal to refer to refer to  
non-constant expressions, and the ptr argument was one.  This, as  
reported by Tom, lead to a failure on buildfarm animal pademelon.  
  
The pointer, especially on system systems with ASLR, isn't super helpful  
anyway, though. So instead of making init_spin_delay into an inline  
function, make s_lock_stuck() report the function name in addition to  
file:line and change init_spin_delay() accordingly. While not a direct  
replacement, the function name is likely more useful anyway (line  
numbers are often hard to interpret in third party reports).  
  
This also fixes what file/line number is reported for waits via  
s_lock().  
  
As PG_FUNCNAME_MACRO is now used outside of elog.h, move it to c.h.  
  
Reported-By: Tom Lane  
Discussion: [email protected]  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/s_lock.c
M src/include/c.h
M src/include/storage/s_lock.h
M src/include/utils/elog.h

Fix pg_dump so pg_upgrade'ing an extension with simple opfamilies works.

commit   : 6cead413bb92be0579a2dbf6320121edcc32e369    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2016 18:57:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2016 18:57:52 -0400    

Click here for diff

As reported by Michael Feld, pg_upgrade'ing an installation having  
extensions with operator families that contain just a single operator class  
failed to reproduce the extension membership of those operator families.  
This caused no immediate ill effects, but would create problems when later  
trying to do a plain dump and restore, because the seemingly-not-part-of-  
the-extension operator families would appear separately in the pg_dump  
output, and then would conflict with the families created by loading the  
extension.  This has been broken ever since extensions were introduced,  
and many of the standard contrib extensions are affected, so it's a bit  
astonishing nobody complained before.  
  
The cause of the problem is a perhaps-ill-considered decision to omit  
such operator families from pg_dump's output on the grounds that the  
CREATE OPERATOR CLASS commands could recreate them, and having explicit  
CREATE OPERATOR FAMILY commands would impede loading the dump script into  
pre-8.3 servers.  Whatever the merits of that decision when 8.3 was being  
written, it looks like a poor tradeoff now.  We can fix the pg_upgrade  
problem simply by removing that code, so that the operator families are  
dumped explicitly (and then will be properly made to be part of their  
extensions).  
  
Although this fixes the behavior of future pg_upgrade runs, it does nothing  
to clean up existing installations that may have improperly-linked operator  
families.  Given the small number of complaints to date, maybe we don't  
need to worry about providing an automated solution for that; anyone who  
needs to clean it up can do so with manual "ALTER EXTENSION ADD OPERATOR  
FAMILY" commands, or even just ignore the duplicate-opfamily errors they  
get during a pg_restore.  In any case we need this fix.  
  
Back-patch to all supported branches.  
  
Discussion: <[email protected]>  

M src/bin/pg_dump/pg_dump.c

Avoid atomic operation in MarkLocalBufferDirty().

commit   : 6b93fcd149329d4ee7319561b30fc15a573c6307    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 13 Apr 2016 15:28:29 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 13 Apr 2016 15:28:29 -0700    

Click here for diff

The recent patch to make Pin/UnpinBuffer lockfree in the hot  
path (48354581a), accidentally used pg_atomic_fetch_or_u32() in  
MarkLocalBufferDirty(). Other code operating on local buffers was  
careful to only use pg_atomic_read/write_u32 which just read/write from  
memory; to avoid unnecessary overhead.  
  
On its own that'd just make MarkLocalBufferDirty() slightly less  
efficient, but in addition InitLocalBuffers() doesn't call  
pg_atomic_init_u32() - thus the spinlock fallback for the atomic  
operations isn't initialized. That in turn caused, as reported by Tom,  
buildfarm animal gaur to fail.  As those errors are actually useful  
against this type of error, continue to omit - intentionally this time -  
initialization of the atomic variable.  
  
In addition, add an explicit note about only using pg_atomic_read/write  
on local buffers's state to BufferDesc's description.  
  
Reported-By: Tom Lane  
Discussion: [email protected]  

M src/backend/storage/buffer/localbuf.c
M src/include/storage/buf_internals.h

Widen amount-to-flush arguments of FileWriteback and callers.

commit   : 95ef43c4308102d23afa887c9fc28d9977612a2d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2016 18:12:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2016 18:12:06 -0400    

Click here for diff

It's silly to define these counts as narrower than they might someday  
need to be.  Also, I believe that the BLCKSZ * nflush calculation in  
mdwriteback was capable of overflowing an int.  

M src/backend/storage/file/fd.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/include/storage/fd.h
M src/include/storage/smgr.h

Fix assorted portability issues with using msync() for data flushing.

commit   : fa11a09fed2b6f483231608866a682ee3a376277    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2016 17:17:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2016 17:17:51 -0400    

Click here for diff

Commit 428b1d6b29ca599c5700d4bc4f4ce4c5880369bf introduced the use of  
msync() for flushing dirty data from the kernel's file buffers.  Several  
portability issues were overlooked, though:  
  
* Not all implementations of mmap() think that nbytes == 0 means "map  
the whole file".  To fix, use lseek() to find out the true length.  
Fix callers of pg_flush_data to be aware that nbytes == 0 may result  
in trashing the file's seek position.  
  
* Not all implementations of mmap() will accept partial-page mmap  
requests.  To fix, round down the length request to whatever sysconf()  
says the page size is.  (I think this is OK from a portability standpoint,  
because sysconf() is required by SUS v2, and we aren't trying to compile  
this part on Windows anyway.  Buildfarm should let us know if not.)  
  
* On 32-bit machines, the file size might exceed the available free  
address space, or even exceed what will fit in size_t.  Check for  
the latter explicitly to avoid passing a false request size to mmap().  
If mmap fails, silently fall through to the next implementation method,  
rather than bleating to the postmaster log and giving up.  
  
* mmap'ing directories fails on some platforms, and even if it works,  
msync'ing the directory is quite unlikely to help, as for that matter are  
the other flush implementations.  In pre_sync_fname(), just skip flush  
attempts on directories.  
  
In passing, copy-edit the comments a bit.  
  
Stas Kelvich and myself  

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

Improve documentation for \crosstabview.

commit   : 85e004707715f5ee7a6bfc3d03d0fbc837fb2432    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2016 11:49:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2016 11:49:47 -0400    

Click here for diff

Fix misleading syntax summary (there cannot be a space between colH and  
scolH).  Provide a link from the existing crosstab() function's  
documentation to \crosstabview.  Copy-edit the command's description.  
  
Christoph Berg and Tom Lane  

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

Use PG_INT32_MIN instead of reiterating the constant.

commit   : cbb2a812d710dd58e68088b334f8c492346a0d0f    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 13 Apr 2016 07:53:54 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 13 Apr 2016 07:53:54 -0400    

Click here for diff

Makes no difference, but it's cleaner this way.  
  
Michael Paquier  

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

Provide errno-translation wrappers around bind() and listen() on Windows.

commit   : d1b7d4877b9a71f476e8e5adea3b6afe419896ba    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2016 19:52:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2016 19:52:21 -0400    

Click here for diff

I've seen one too many "could not bind IPv4 socket: No error" log entries  
from the Windows buildfarm members.  Per previous discussion, this is  
likely caused by the fact that we're doing nothing to translate  
WSAGetLastError() to errno.  Put in a wrapper layer to do that.  
  
If this works as expected, it should get back-patched, but let's see what  
happens in the buildfarm first.  
  
Discussion: <[email protected]>  

M src/backend/port/win32/socket.c
M src/include/port/win32.h

Fix costing for parallel aggregation.

commit   : deb71fa9713dfe374a74fc58a5d298b5f25da3f5    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 12 Apr 2016 16:24:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 12 Apr 2016 16:24:55 -0400    

Click here for diff

The original patch kind of ignored the fact that we were doing something  
different from a costing point of view, but nobody noticed.  This patch  
fixes that oversight.  
  
David Rowley  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/clauses.c
M src/include/optimizer/clauses.h

Remove unused function GetOldestWALSendPointer from walsender code.

commit   : 46d73e0d65eef19e25bb0d31f1e5c23ff40a3444    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 13 Apr 2016 04:36:29 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 13 Apr 2016 04:36:29 +0900    

Click here for diff

That unused function was introduced as a sample because synchronous  
replication or replication monitoring tools might need it in the future.  
Recently commit 989be08 added the function SyncRepGetOldestSyncRecPtr  
which provides almost the same functionality for multiple synchronous  
standbys feature. So it's time to remove that unused sample function.  
This commit does that.  

M src/backend/replication/walsender.c

Redefine create_upper_paths_hook as being invoked once per upper relation.

commit   : f1f01de145d0aaca80e6cf8b2ccb7e7f4ed1ad02    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2016 15:23:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2016 15:23:14 -0400    

Click here for diff

Per discussion, this gives potential users of the hook more flexibility,  
because they can build custom Paths that implement only one stage of  
upper processing atop core-provided Paths for earlier stages.  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/include/optimizer/planner.h

Improve coding of column-name parsing in psql's new crosstabview.c.

commit   : 7a5f8b5c59033ac153963f98b9109be9529a824a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2016 12:52:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2016 12:52:35 -0400    

Click here for diff

Coverity complained about this code, not without reason because it was  
rather messy.  Adjust it to not scribble on the passed string; that adds  
one malloc/free cycle per column name, which is going to be insignificant  
in context.  We can actually const-ify both the string argument and the  
PGresult.  
  
Daniel Verité, with some further cleanup by me  

M src/bin/psql/crosstabview.c
M src/bin/psql/crosstabview.h

Avoid extra locks in GetSnapshotData if old_snapshot_threshold < 0

commit   : 2201d801b03c2d1b0bce4d6580b718dc34d38b3e    
  
author   : Kevin Grittner <[email protected]>    
date     : Tue, 12 Apr 2016 11:48:02 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Tue, 12 Apr 2016 11:48:02 -0500    

Click here for diff

On a big NUMA machine with 1000 connections in saturation load  
there was a performance regression due to spinlock contention, for  
acquiring values which were never used.  Just fill with dummy  
values if we're not going to use them.  
  
This patch has not been benchmarked yet on a big NUMA machine, but  
it seems like a good idea on general principle, and it seemed to  
prevent an apparent 2.2% regression on a single-socket i7 box  
running 200 connections at saturation load.  

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

Improve API of GenericXLogRegister().

commit   : 5713f03973e26ad6df6df5ac8b9efa0123d68062    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2016 11:42:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2016 11:42:06 -0400    

Click here for diff

Rename this function to GenericXLogRegisterBuffer() to make it clearer  
what it does, and leave room for other sorts of "register" actions in  
future.  Also, replace its "bool isNew" argument with an integer flags  
argument, so as to allow adding more flags in future without an API  
break.  
  
Alexander Korotkov, adjusted slightly by me  

M contrib/bloom/blinsert.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M doc/src/sgml/generic-wal.sgml
M src/backend/access/transam/generic_xlog.c
M src/include/access/generic_xlog.h

In generic WAL application and replay, ensure page "hole" is always zero.

commit   : bdf7db81921deb99fd9d489cbcc635906c89e215    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2016 11:13:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2016 11:13:52 -0400    

Click here for diff

The previous coding could allow the contents of the "hole" between pd_lower  
and pd_upper to diverge during replay from what it had been when the update  
was originally applied.  This would pose a problem if checksums were in  
use, and in any case would complicate forensic comparisons between master  
and slave servers.  So force the "hole" to contain zeroes, both at initial  
application of a generically-logged action, and at replay.  
  
Alexander Korotkov, adjusted slightly by me  

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

Add page id to bloom index

commit   : 813b456ea21d4cf57b124bf855ec019c7a8099a7    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 12 Apr 2016 18:03:01 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 12 Apr 2016 18:03:01 +0300    

Click here for diff

Added to ensure that bloom index pages can be distinguished from other pages  
by pg_filedump. Because there wasn't any public/production versions before,  
it doesn't pay attention to any compatibility issues.  
  
Per notice from Tom Lane  

M contrib/bloom/bloom.h
M contrib/bloom/blutils.c

Remove unnecessary definition of _WIN64 in libpq/win32.mak.

commit   : e7bcde8ca0d376d9d23d61855baf67122a66c76a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2016 10:52:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2016 10:52:58 -0400    

Click here for diff

In commit b0e40d189325dc7a54d2546245e766f8c47a7c8d, I should have just  
removed the /D switch defining WIN64.  The reason the code worked before  
is that all Windows64 compilers automatically predefine _WIN64.  Perhaps  
at one time we had code that depended on WIN64 being defined, but it's  
long gone, and we should not encourage any reappearance.  Per discussion  
with Christian Ullrich.  

M src/interfaces/libpq/win32.mak

commit   : cd13471f2e9dee6d411cae3ddae72d0ad6b58c4d    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 12 Apr 2016 08:45:09 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 12 Apr 2016 08:45:09 -0400    

Click here for diff

It's 2016 these days (no, not entirely sure how we got here either).  
  
Pointed out by Amit Langote  

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

Fix whitespace

commit   : 70715e6a600f1652a04b4e698dad3c7d6bff6bdb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Apr 2016 20:59:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Apr 2016 20:59:04 -0400    

Click here for diff

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

Fix _SPI_execute_plan() for CREATE TABLE IF NOT EXISTS foo AS ...

commit   : 39c283e498de1bb7c3d5beadfffcf3273ae8cc27    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2016 20:07:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2016 20:07:17 -0400    

Click here for diff

When IF NOT EXISTS was added to CREATE TABLE AS, this logic didn't get  
the memo, possibly resulting in an Assert failure.  It looks like there  
would have been no ill effects in a non-Assert build, though.  Back-patch  
to 9.5 where the IF NOT EXISTS option was added.  
  
Stas Kelvich  

M src/backend/executor/spi.c

Fix two places that thought Windows64 is indicated by WIN64 macro.

commit   : b0e40d189325dc7a54d2546245e766f8c47a7c8d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2016 19:37:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2016 19:37:04 -0400    

Click here for diff

Everyplace else thinks it's _WIN64, so make these places fall in line.  
  
The pg_regress.c usage is not going to result in any change in behavior,  
only suppressing (or not) a compiler warning about downcasting HANDLEs.  
So there seems no need for back-patching there.  
  
The libpq/win32.mak usage might represent an actual bug, if anyone were  
using this script to build for Windows64, which perhaps nobody is.  
Given the lack of field complaints, no back-patch here either.  
  
pg_regress.c problem found by Christian Ullrich, the other by me.  

M src/interfaces/libpq/win32.mak
M src/test/regress/pg_regress.c

Fix freshly-introduced PL/Python portability bug.

commit   : 1d2f9de38d18152f83cf570581cebac0733ff504    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2016 18:17:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2016 18:17:02 -0400    

Click here for diff

It turns out that those PyErr_Clear() calls I removed from plpy_elog.c  
in 7e3bb080387f4143 et al were not quite as random as they appeared: they  
mask a Python 2.3.x bug.  (Specifically, it turns out that PyType_Ready()  
can fail if the error indicator is set on entry, and PLy_traceback's fetch  
of frame.f_code may be the first operation in a session that requires the  
"frame" type to be readied.  Ick.)  Put back the clear call, but in a more  
centralized place closer to what it's protecting, and this time with a  
comment warning what it's really for.  
  
Per buildfarm member prairiedog.  Although prairiedog was only failing  
on HEAD, it seems clearly possible for this to occur in older branches  
as well, so back-patch to 9.2 the same as the previous patch.  

M src/pl/plpython/plpy_elog.c

Use static inline function for BufferGetPage()

commit   : a6f6b78196a701702ec4ff6df56c346bdcf9abd2    
  
author   : Kevin Grittner <[email protected]>    
date     : Mon, 11 Apr 2016 16:47:50 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Mon, 11 Apr 2016 16:47:50 -0500    

Click here for diff

I was initially concerned that the some of the hundreds of  
references to BufferGetPage() where the literal  
BGP_NO_SNAPSHOT_TEST were passed might not optimize as well as a  
macro, leading to some hard-to-find performance regressions in  
corner cases.  Inspection of disassembled code has shown identical  
code at all inspected locations, and the size difference doesn't  
amount to even one byte per such call.  So make it readable.  
  
Per gripes from Álvaro Herrera and Tom Lane  

M src/backend/storage/buffer/bufmgr.c
M src/include/storage/bufmgr.h

Make oldSnapshotControl a pointer to a volatile structure

commit   : 80647bf65a03e232c995c0826ef394dad8d685fe    
  
author   : Kevin Grittner <[email protected]>    
date     : Mon, 11 Apr 2016 15:43:52 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Mon, 11 Apr 2016 15:43:52 -0500    

Click here for diff

It was incorrectly declared as a volatile pointer to a non-volatile  
structure.  Eliminate the OldSnapshotControl struct definition; it  
is really not needed.  Pointed out by Tom Lane.  
  
While at it, add OldSnapshotControlData to pgindent's list of  
structures.  

M src/backend/utils/time/snapmgr.c
M src/tools/pgindent/typedefs.list

Fix whitespace

commit   : d8ed83cd7fd1082f60a5b9897b62216f6b3e2587    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Apr 2016 14:44:51 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Apr 2016 14:44:51 -0400    

Click here for diff

M src/backend/foreign/foreign.c
M src/backend/nodes/extensible.c
M src/backend/utils/adt/tsquery_op.c
M src/pl/plpython/plpy_elog.c
M src/test/modules/snapshot_too_old/sto.conf

Prefix RLS regression test roles with 'regress_'

commit   : 6c7b0388c568e3063c3d40a7d90e1bca9006d505    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 11 Apr 2016 14:12:33 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 11 Apr 2016 14:12:33 -0400    

Click here for diff

To avoid any possible overlap with existing roles on a system when  
doing a 'make installcheck', use role names which start with  
'regress_'.  
  
Pointed out by Tom.  

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

Add directory created during build to gitignore

commit   : 29ca231b83a142ea1633e7c496619accb7dd9e4f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Apr 2016 14:01:15 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Apr 2016 14:01:15 -0400    

Click here for diff

A src/test/modules/snapshot_too_old/.gitignore

Fix missing "volatile" in PLy_output().

commit   : 81ba9348d85fdf87e84cc02112933b592845bda2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2016 11:49:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2016 11:49:48 -0400    

Click here for diff

Commit 5c3c3cd0a3046339 plastered "volatile" on a bunch of variables  
in PLy_output(), but removed the one that actually mattered, ie the  
one on "oldcontext".  This allows some versions of clang to generate  
code in which "oldcontext" has been trashed when control reaches the  
PG_CATCH block.  Per buildfarm member tick.  

M src/pl/plpython/plpy_plpymodule.c

cpluspluscheck: Update include path

commit   : ee5dbc8173d8f434a467380bfd218ef6f91a8e31    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Apr 2016 11:16:16 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Apr 2016 11:16:16 -0400    

Click here for diff

Some things in src/include/fe_utils require libpq headers, so add  
libpq's include path to the command line used here.  

M src/tools/pginclude/cpluspluscheck

Fix documented return type of pg_logical_emit_message() in func.sgml.

commit   : cfe96ae24c97ff376157c48ccd5ca6d3938632be    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 11 Apr 2016 21:28:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 11 Apr 2016 21:28:17 +0900    

Click here for diff

M doc/src/sgml/func.sgml

Use ereport(ERROR) instead of Assert() to emit syncrep_parser error.

commit   : 0038c1e2181b520a9307aae6587e110468072392    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 11 Apr 2016 15:52:27 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 11 Apr 2016 15:52:27 +0900    

Click here for diff

The existing code would either Assert or generate an invalid  
SyncRepConfig variable, neither of which is desirable. A regular  
error should be thrown instead.  
  
This commit silences compiler warning in non assertion-enabled builds.  
  
Per report from Jeff Janes.  
Suggested fix by Tom Lane.  

M src/backend/replication/syncrep.c

Fix poorly thought-through code from commit 5c3c3cd0a3046339.

commit   : f73b2bbbdcb387aa90ff619fe03d1924ed82b868    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2016 00:28:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2016 00:28:44 -0400    

Click here for diff

It's not entirely clear to me whether PyString_AsString can return  
null (looks like the answer might vary between Python 2 and 3).  
But in any case, this code's attempt to cope with the possibility  
was quite broken, because pstrdup() neither allows a null argument  
nor ever returns a null.  
  
Moreover, the code below this point assumes that "message" is a  
palloc'd string, which would not be the case for a dgettext result.  
  
Fix both problems by doing the pstrdup step separately.  

M src/pl/plpython/plpy_plpymodule.c

pg_dump: add missing "destroyPQExpBuffer(query)" in dumpForeignServer().

commit   : 074050f16a2db9b5ebe5c9f8fdb211cbb810e746    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2016 00:00:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2016 00:00:08 -0400    

Click here for diff

Coverity complained about this resource leak (why now, I don't know,  
since it's been like that a long time).  Our general policy in pg_dump  
is that PQExpBuffers are worth cleaning up, so do it here too.  But  
don't bother with a back-patch, because it seems unlikely that very  
many databases contain enough FOREIGN SERVER objects to notice.  

M src/bin/pg_dump/pg_dump.c

Add comment about intentional fallthrough in switch.

commit   : 1630f5b92a3a00aff5674f31af1d418628a00ac7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Apr 2016 23:52:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Apr 2016 23:52:34 -0400    

Click here for diff

Coverity complained about an apparent missing "break" in a switch  
added by bb140506df605fab.  The human-readable comments are pretty  
clear that this is intentional, but add a standard /* FALL THRU */  
comment to make it clear to tools too.  

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

Clean up foreign-key caching code in planner.

commit   : 5306df2831ab012d8008691f833457bc299962aa    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Apr 2016 23:47:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Apr 2016 23:47:30 -0400    

Click here for diff

Coverity complained that the code added by 015e88942aa50f0d lacked an  
error check for SearchSysCache1 failures, which it should have.  But  
the code was pretty duff in other ways too, including failure to think  
about whether it could really cope with arrays of different lengths.  

M src/backend/optimizer/util/plancat.c

Fix access-to-already-freed-memory issue in plpython's error handling.

commit   : 7e3bb080387f4143cdc908bf97daf9a8abdc445f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Apr 2016 23:15:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Apr 2016 23:15:55 -0400    

Click here for diff

PLy_elog() could attempt to access strings that Python had already freed,  
because the strings that PLy_get_spi_error_data() returns are simply  
pointers into storage associated with the error "val" PyObject.  That's  
fine at the instant PLy_get_spi_error_data() returns them, but just after  
that PLy_traceback() intentionally releases the only refcount on that  
object, allowing it to be freed --- so that the strings we pass to  
ereport() are dangling pointers.  
  
In principle this could result in garbage output or a coredump.  In  
practice, I think the risk is pretty low, because there are no Python  
operations between where we decrement that refcount and where we use the  
strings (and copy them into PG storage), and thus no reason for Python  
to recycle the storage.  Still, it's clearly hazardous, and it leads to  
Valgrind complaints when running under a Valgrind that hasn't been  
lobotomized to ignore Python memory allocations.  
  
The code was a mess anyway: we fetched the error data out of Python  
(clearing Python's error indicator) with PyErr_Fetch, examined it, pushed  
it back into Python with PyErr_Restore (re-setting the error indicator),  
then immediately pulled it back out with another PyErr_Fetch.  Just to  
confuse matters even more, there were some gratuitous-and-yet-hazardous  
PyErr_Clear calls in the "examine" step, and we didn't get around to doing  
PyErr_NormalizeException until after the second PyErr_Fetch, making it even  
less clear which object was being manipulated where and whether we still  
had a refcount on it.  (If PyErr_NormalizeException did substitute a  
different "val" object, it's possible that the problem could manifest for  
real, because then we'd be doing assorted Python stuff with no refcount  
on the object we have string pointers into.)  
  
So, rearrange all that into some semblance of sanity, and don't decrement  
the refcount on the Python error objects until the end of PLy_elog().  
In HEAD, I failed to resist the temptation to reformat some messy bits  
from 5c3c3cd0a3046339 along the way.  
  
Back-patch as far as 9.2, because the code is substantially the same  
that far back.  I believe that 9.1 has the bug as well; but the code  
around it is rather different and I don't want to take a chance on  
breaking something for what seems a low-probability problem.  

M src/pl/plpython/plpy_elog.c

Avoid the use of a separate spinlock to protect a LWLock's wait queue.

commit   : 008608b9d51061b1f598c197477b3dc7be9c4a64    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 10 Apr 2016 20:12:32 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 10 Apr 2016 20:12:32 -0700    

Click here for diff

Previously we used a spinlock, in adition to the atomically manipulated  
->state field, to protect the wait queue. But it's pretty simple to  
instead perform the locking using a flag in state.  
  
Due to 6150a1b0 BufferDescs, on platforms (like PPC) with > 1 byte  
spinlocks, increased their size above 64byte. As 64 bytes are the size  
we pad allocated BufferDescs to, this can increase false sharing;  
causing performance problems in turn. Together with the previous commit  
this reduces the size to <= 64 bytes on all common platforms.  
  
Author: Andres Freund  
Discussion: CAA4eK1+ZeB8PMwwktf+3bRS0Pt4Ux6Rs6Aom0uip8c6shJWmyg@mail.gmail.com  
    [email protected]  

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

Allow Pin/UnpinBuffer to operate in a lockfree manner.

commit   : 48354581a49c30f5757c203415aa8412d85b0f70    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 10 Apr 2016 20:12:32 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 10 Apr 2016 20:12:32 -0700    

Click here for diff

Pinning/Unpinning a buffer is a very frequent operation; especially in  
read-mostly cache resident workloads. Benchmarking shows that in various  
scenarios the spinlock protecting a buffer header's state becomes a  
significant bottleneck. The problem can be reproduced with pgbench -S on  
larger machines, but can be considerably worse for queries which touch  
the same buffers over and over at a high frequency (e.g. nested loops  
over a small inner table).  
  
To allow atomic operations to be used, cram BufferDesc's flags,  
usage_count, buf_hdr_lock, refcount into a single 32bit atomic variable;  
that allows to manipulate them together using 32bit compare-and-swap  
operations. This requires reducing MAX_BACKENDS to 2^18-1 (which could  
be lifted by using a 64bit field, but it's not a realistic configuration  
atm).  
  
As not all operations can easily implemented in a lockfree manner,  
implement the previous buf_hdr_lock via a flag bit in the atomic  
variable. That way we can continue to lock the header in places where  
it's needed, but can get away without acquiring it in the more frequent  
hot-paths.  There's some additional operations which can be done without  
the lock, but aren't in this patch; but the most important places are  
covered.  
  
As bufmgr.c now essentially re-implements spinlocks, abstract the delay  
logic from s_lock.c into something more generic. It now has already two  
users, and more are coming up; there's a follupw patch for lwlock.c at  
least.  
  
This patch is based on a proof-of-concept written by me, which Alexander  
Korotkov made into a fully working patch; the committed version is again  
revised by me.  Benchmarking and testing has, amongst others, been  
provided by Dilip Kumar, Alexander Korotkov, Robert Haas.  
  
On a large x86 system improvements for readonly pgbench, with a high  
client count, of a factor of 8 have been observed.  
  
Author: Alexander Korotkov and Andres Freund  
Discussion: 2400449.GjM57CE0Yg@dinodell  

M contrib/pg_buffercache/pg_buffercache_pages.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/lmgr/s_lock.c
M src/include/postmaster/postmaster.h
M src/include/storage/buf_internals.h
M src/include/storage/s_lock.h
M src/tools/pgindent/typedefs.list

Improve contrib/bloom regression test using code coverage info.

commit   : cf223c3bf5ba16232147c66b5fef4037aafe747c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Apr 2016 13:12:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Apr 2016 13:12:24 -0400    

Click here for diff

Originally, this test created a 100000-row test table, which made it  
run rather slowly compared to other contrib tests.  Investigation with  
gcov showed that we got no further improvement in code coverage after  
the first 700 or so rows, making the large table 99% a waste of time.  
Cut it back to 2000 rows to fix the runtime problem and still leave  
some headroom for testing behaviors that may appear later.  
  
A closer look at the gcov results showed that the main coverage  
omissions in contrib/bloom occurred because the test never filled more  
than one entry in the notFullPage array; which is unsurprising because  
it exercised index cleanup only in the scenario of complete table  
deletion, allowing every page in the index to become deleted rather  
than not-full.  Add testing that allows the not-full path to be  
exercised as well.  
  
Also, test the amvalidate function, because blvalidate.c had zero  
coverage without that, and besides it's a good idea to check for  
mistakes in the bloom opclass definitions.  

M contrib/bloom/expected/bloom.out
M contrib/bloom/sql/bloom.sql

Fix possible NULL dereference in ExecAlterObjectDependsStmt

commit   : bd905a0d0416628b4aef153463c1f5e5b80b3e96    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 10 Apr 2016 11:03:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 10 Apr 2016 11:03:35 -0300    

Click here for diff

I used the wrong variable here.  Doesn't make a difference today because  
the only plausible caller passes a non-NULL variable, but someday it  
will be wrong, and even today's correctness is subtle: the caller that  
does pass a NULL is never invoked because of object type constraints.  
Surely not a condition to rely on.  
  
Noted by Coverity  

M src/backend/commands/alter.c

Further minor improvement in generic_xlog.c: always say REGBUF_STANDARD.

commit   : 660d5fb856c61df2de2cedb26249404ffc58cb89    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Apr 2016 00:24:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Apr 2016 00:24:28 -0400    

Click here for diff

Since we're requiring pages handled by generic_xlog.c to be standard  
format, specify REGBUF_STANDARD when doing a full-page image, so that  
xloginsert.c can compress out the "hole" between pd_lower and pd_upper.  
Given the current API in which this path will be taken only for a newly  
initialized page, the hole is likely to be particularly large in such  
cases, so that this oversight could easily be performance-significant.  
I don't notice any particular change in the runtime of contrib/bloom's  
regression test, though.  

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

Micro-optimize GenericXLogFinish().

commit   : 68689c66efcda6f217119432edfbdf95a50b26e2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Apr 2016 19:30:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Apr 2016 19:30:56 -0400    

Click here for diff

Make the inner comparison loops of computeDelta() as tight as possible by  
pulling considerations of valid and invalid ranges out of the inner loops,  
and extending a match or non-match detection as far as possible before  
deciding what to do next.  To keep this tractable, give up the possibility  
of merging fragments across the pd_lower to pd_upper gap.  The fraction of  
pages where that could happen (ie, there are 4 or fewer bytes in the gap,  
*and* data changes immediately adjacent to it on both sides) is too small  
to be worth spending cycles on.  
  
Also, avoid two BLCKSZ-length memcpy()s by computing the delta before  
moving data into the target buffer, instead of after.  This doesn't save  
nearly as many cycles as being tenser about computeDelta(), but it still  
seems worth doing.  
  
On my machine, this patch cuts a full 40% off the runtime of  
contrib/bloom's regression test.  

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

Fix PL/Python ereport() test to work on Python 2.3.

commit   : c7a141a9866b8c15d9e3b6fd5310e54837900394    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Apr 2016 16:44:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Apr 2016 16:44:54 -0400    

Click here for diff

Per buildfarm.  
  
Pavel Stehule  

M src/pl/plpython/expected/plpython_test.out
M src/pl/plpython/sql/plpython_test.sql

Get rid of GenericXLogUnregister().

commit   : 08e785436f84f8824149a2182b0cb9ce2c28e31d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Apr 2016 16:39:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Apr 2016 16:39:30 -0400    

Click here for diff

This routine is unsafe as implemented, because it invalidates the page  
image pointers returned by previous GenericXLogRegister() calls.  
  
Rather than complicate the API or the implementation to avoid that,  
let's just get rid of it; the use-case for having it seems much  
too thin to justify a lot of work here.  
  
While at it, do some wordsmithing on the SGML docs for generic WAL.  

M doc/src/sgml/generic-wal.sgml
M src/backend/access/transam/generic_xlog.c
M src/include/access/generic_xlog.h

Get rid of blinsert()'s use of GenericXLogUnregister().

commit   : 80cf18910c8edf2575c306dde9ead192bdb0863a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Apr 2016 15:39:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Apr 2016 15:39:14 -0400    

Click here for diff

That routine is dangerous, and unnecessary once we get rid of this  
one caller.  
  
In passing, fix failure to clean up temp memory context, or switch  
back to caller's context, during slowest exit path.  

M contrib/bloom/blinsert.c

Code review/prettification for generic_xlog.c.

commit   : db03cf375d602e417eda6b7a55eead91618e1398    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Apr 2016 15:02:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Apr 2016 15:02:19 -0400    

Click here for diff

Improve commentary, use more specific names for the delta fields,  
const-ify pointer arguments where possible, avoid assuming that  
initializing only the first element of a local array will guarantee  
that the remaining elements end up as we need them.  (I think that  
code in generic_redo actually worked, but only because InvalidBuffer  
is zero; this is a particularly ugly way of depending on that ...)  

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

Run pgindent on generic_xlog.c.

commit   : 2dd318d277b8e1d8269b030f545240193943162f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Apr 2016 13:33:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Apr 2016 13:33:33 -0400    

Click here for diff

This code desperately needs some micro-optimization, and I'd like it  
to be formatted a bit more nicely while I work on it.  

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

Fix typo in C comment.

commit   : 381200be4b565292eba6f62200248cb775f06940    
  
author   : Kevin Grittner <[email protected]>    
date     : Sat, 9 Apr 2016 09:07:42 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Sat, 9 Apr 2016 09:07:42 -0500    

Click here for diff

M src/include/storage/bufpage.h

Turn special page pointer validation to static inline function

commit   : 56dffb5a73ab157fc8d35a76c1170d656a051f14    
  
author   : Kevin Grittner <[email protected]>    
date     : Sat, 9 Apr 2016 08:17:22 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Sat, 9 Apr 2016 08:17:22 -0500    

Click here for diff

Inclusion of multiple macros inside another macro was pushing MSVC  
past its size liimit.  Reported by buildfarm.  

M src/include/storage/bufpage.h

Move \crosstabview regression tests to a separate file

commit   : 1ff3f420d470fae46759e948a20e9550af012816    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 8 Apr 2016 23:42:24 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 8 Apr 2016 23:42:24 -0300    

Click here for diff

It cannot run in the same parallel group as misc, because it creates a  
table which is unpredictably visible in that test.  
  
Per buildfarm member crake.  

M doc/src/sgml/ref/psql-ref.sgml
M src/test/regress/expected/psql.out
A src/test/regress/expected/psql_crosstab.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/psql.sql
A src/test/regress/sql/psql_crosstab.sql

Support \crosstabview in psql

commit   : c09b18f21c52cbcf8718d6c267c84fcfea3739a9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 8 Apr 2016 20:23:18 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 8 Apr 2016 20:23:18 -0300    

Click here for diff

\crosstabview is a completely different way to display results from a  
query: instead of a vertical display of rows, the data values are placed  
in a grid where the column and row headers come from the data itself,  
similar to a spreadsheet.  
  
The sort order of the horizontal header can be specified by using  
another column in the query, and the vertical header determines its  
ordering from the order in which they appear in the query.  
  
This only allows displaying a single value in each cell.  If more than  
one value correspond to the same cell, an error is thrown.  Merging of  
values can be done in the query itself, if necessary.  This may be  
revisited in the future.  
  
Author: Daniel Verité  
Reviewed-by: Pavel Stehule, Dean Rasheed  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/Makefile
M src/bin/psql/command.c
M src/bin/psql/common.c
A src/bin/psql/crosstabview.c
A src/bin/psql/crosstabview.h
M src/bin/psql/help.c
M src/bin/psql/settings.h
M src/bin/psql/tab-complete.c
M src/fe_utils/print.c
M src/include/fe_utils/print.h
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Add snapshot_too_old to NSVC @contrib_excludes

commit   : 279d86afdbed550425bc9d1327ade2dc0028ad33    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 8 Apr 2016 17:18:10 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 8 Apr 2016 17:18:10 -0500    

Click here for diff

The buildfarm showed failure for Windows MSVC builds due to this  
omission.  This might not be the only problem with the Makefile for  
this feature, but hopefully this will get it past the immediate  
problem.  
  
Fix suggested by Tom Lane  

M src/tools/msvc/Mkvcbuild.pm

Expose more out/readfuncs support functions.

commit   : c1ddd2361f6eb071d51b856c697a4aab22f8c776    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 8 Apr 2016 14:26:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 8 Apr 2016 14:26:36 -0700    

Click here for diff

Previously bcac23d exposed a subset of support functions, namely the  
ones Kaigai found useful. In  
[email protected] I mentioned that  
there's some functions missing to use the facility in an external  
project.  
  
To avoid having to add functions piecemeal, add all the functions which  
are used to define READ_* and WRITE_* macros; users of the extensible  
node functionality are likely to need these. Additionally expose  
outDatum(), which doesn't have it's own WRITE_ macro, as it needs  
information from the embedding struct.  
  
Discussion: [email protected]  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/nodes/nodes.h

Create default roles

commit   : 7a542700df25eaf97b794bff63606176433dcdda    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 8 Apr 2016 16:56:27 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 8 Apr 2016 16:56:27 -0400    

Click here for diff

This creates an initial set of default roles which administrators may  
use to grant access to, historically, superuser-only functions.  Using  
these roles instead of granting superuser access reduces the number of  
superuser roles required for a system.  Documention for each of the  
default roles has been added to user-manag.sgml.  
  
Bump catversion to 201604082, as we had a commit that bumped it to  
201604081 and another that set it back to 201604071...  
  
Reviews by José Luis Tallón and Robert Haas  

M doc/src/sgml/func.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/utils/adt/misc.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_authid.h
M src/test/regress/expected/rolenames.out
M src/test/regress/sql/rolenames.sql

Reserve the "pg_" namespace for roles

commit   : 293007898d3fa5a815c1c5814df53627553f114d    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 8 Apr 2016 16:56:27 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 8 Apr 2016 16:56:27 -0400    

Click here for diff

This will prevent users from creating roles which begin with "pg_" and  
will check for those roles before allowing an upgrade using pg_upgrade.  
  
This will allow for default roles to be provided at initdb time.  
  
Reviews by José Luis Tallón and Robert Haas  

M doc/src/sgml/ref/psql-ref.sgml
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/commands/alter.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/policy.c
M src/backend/commands/schemacmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/user.c
M src/backend/commands/variable.c
M src/backend/utils/adt/acl.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_upgrade/check.c
M src/bin/psql/command.c
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/include/utils/acl.h
M src/test/regress/expected/rolenames.out
M src/test/regress/sql/rolenames.sql

Fix improper usage of 'dump' bitmap

commit   : fa6075e5515c6878b2c1fe1c6435dd7ed847857d    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 8 Apr 2016 16:30:02 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 8 Apr 2016 16:30:02 -0400    

Click here for diff

Now that 'dump' is a bitmap, we can't simply set it to 'true'.  
  
Noticed while debugging the prior issue.  

M src/bin/pg_dump/pg_dump_sort.c

Add the "snapshot too old" feature

commit   : 848ef42bb8c7909c9d7baa38178d4a209906e7c1    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 8 Apr 2016 14:36:30 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 8 Apr 2016 14:36:30 -0500    

Click here for diff

This feature is controlled by a new old_snapshot_threshold GUC.  A  
value of -1 disables the feature, and that is the default.  The  
value of 0 is just intended for testing.  Above that it is the  
number of minutes a snapshot can reach before pruning and vacuum  
are allowed to remove dead tuples which the snapshot would  
otherwise protect.  The xmin associated with a transaction ID does  
still protect dead tuples.  A connection which is using an "old"  
snapshot does not get an error unless it accesses a page modified  
recently enough that it might not be able to produce accurate  
results.  
  
This is similar to the Oracle feature, and we use the same SQLSTATE  
and error message for compatibility.  

M contrib/bloom/blscan.c
M doc/src/sgml/config.sgml
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gist/gistget.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/spgist/spgscan.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumlazy.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/utils/errcodes.txt
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/backend/utils/time/snapmgr.c
M src/include/access/brin_revmap.h
M src/include/access/gin_private.h
M src/include/access/nbtree.h
M src/include/storage/bufmgr.h
M src/include/utils/rel.h
M src/include/utils/snapmgr.h
M src/include/utils/snapshot.h
M src/test/modules/Makefile
A src/test/modules/snapshot_too_old/Makefile
A src/test/modules/snapshot_too_old/expected/sto_using_cursor.out
A src/test/modules/snapshot_too_old/expected/sto_using_select.out
A src/test/modules/snapshot_too_old/specs/sto_using_cursor.spec
A src/test/modules/snapshot_too_old/specs/sto_using_select.spec
A src/test/modules/snapshot_too_old/sto.conf

Modify BufferGetPage() to prepare for "snapshot too old" feature

commit   : 8b65cf4c5edabdcae45ceaef7b9ac236879aae50    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 8 Apr 2016 14:30:10 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 8 Apr 2016 14:30:10 -0500    

Click here for diff

This patch is a no-op patch which is intended to reduce the chances  
of failures of omission once the functional part of the "snapshot  
too old" patch goes in.  It adds parameters for snapshot, relation,  
and an enum to specify whether the snapshot age check needs to be  
done for the page at this point.  This initial patch passes NULL  
for the first two new parameters and BGP_NO_SNAPSHOT_TEST for the  
third.  The follow-on patch will change the places where the test  
needs to be made.  

M contrib/bloom/blinsert.c
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/rawpage.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/pgstattuple.c
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashutil.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogutils.c
M src/backend/catalog/index.c
M src/backend/commands/analyze.c
M src/backend/commands/sequence.c
M src/backend/commands/trigger.c
M src/backend/commands/vacuumlazy.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeSamplescan.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/fsmpage.c
M src/include/storage/bufmgr.h

In dumpTable, re-instate the skipping logic

commit   : 689f9a058854a1a32e994818dd6d79f49d8f8a1b    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 8 Apr 2016 15:00:44 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 8 Apr 2016 15:00:44 -0400    

Click here for diff

Pretty sure I removed this based on some incorrect thinking that it was  
no longer possible to reach this point for a table which will not be  
dumped, but that's clearly wrong.  
  
Pointed out on IRC by Erik Rijkers.  

M src/bin/pg_dump/pg_dump.c

Revert CREATE INDEX ... INCLUDING ...

commit   : 8b99edefcab1e82c43139a2c7dc06d31fb27b3e4    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 8 Apr 2016 21:52:13 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 8 Apr 2016 21:52:13 +0300    

Click here for diff

It's not ready yet, revert two commits  
690c543550b0d2852060c18d270cdb534d339d9a - unstable test output  
386e3d7609c49505e079c40c65919d99feb82505 - patch itself  

M contrib/dblink/dblink.c
M contrib/tcn/tcn.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/access/brin/brin.c
M src/backend/access/common/indextuple.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/index/genam.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/spgist/spgutils.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/toasting.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/executor/execIndexing.c
M src/backend/executor/nodeIndexscan.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/sort/tuplesort.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/include/access/amapi.h
M src/include/access/itup.h
M src/include/access/nbtree.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_constraint_fn.h
M src/include/catalog/pg_index.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/relation.h
M src/include/utils/rel.h
M src/test/regress/expected/create_index.out
D src/test/regress/expected/index_including.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/create_index.sql
D src/test/regress/sql/index_including.sql

Add authentication parameters compat_realm and upn_usename for SSPI

commit   : 35e2e357cb054dc9e5d890fe754c56f0722f015e    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 8 Apr 2016 20:23:52 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 8 Apr 2016 20:23:52 +0200    

Click here for diff

These parameters are available for SSPI authentication only, to make  
it possible to make it behave more like "normal gssapi", while  
making it possible to maintain compatibility.  
  
compat_realm is on by default, but can be turned off to make the  
authentication use the full Kerberos realm instead of the NetBIOS name.  
  
upn_username is off by default, and can be turned on to return the users  
Kerberos UPN rather than the SAM-compatible name (a user in Active  
Directory can have both a legacy SAM-compatible username and a new  
Kerberos one. Normally they are the same, but not always)  
  
Author: Christian Ullrich  
Reviewed by: Robbie Harwood, Alvaro Herrera, me  

M doc/src/sgml/client-auth.sgml
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/include/libpq/hba.h

Fix possible use of uninitialised value in ts_headline()

commit   : cb0c8cbf316f9362c11d7a8356e6f459258ae78e    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 8 Apr 2016 21:25:14 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 8 Apr 2016 21:25:14 +0300    

Click here for diff

Found during investigation of failure of skink buildfarm member and its  
valgrind report.  
  
Backpatch to all supported branches  

M src/backend/tsearch/wparser_def.c

Fix unstable regression test output.

commit   : 690c543550b0d2852060c18d270cdb534d339d9a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Apr 2016 14:15:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Apr 2016 14:15:12 -0400    

Click here for diff

Output order from the pg_indexes view might vary depending on the  
phase of the moon, so add ORDER BY to ensure stable results of tests  
added by commit 386e3d7609c49505e079c40c65919d99feb82505.  
Per buildfarm.  

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

Distrust external OpenSSL clients; clear err queue

commit   : 7c7d4fddab82dc756d8caa67b1b31fcdde355aab    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Apr 2016 13:48:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Apr 2016 13:48:14 -0400    

Click here for diff

OpenSSL has an unfortunate tendency to mix per-session state error  
handling with per-thread error handling.  This can cause problems when  
programs that link to libpq with OpenSSL enabled have some other use of  
OpenSSL; without care, one caller of OpenSSL may cause problems for the  
other caller.  Backend code might similarly be affected, for example  
when a third party extension independently uses OpenSSL without taking  
the appropriate precautions.  
  
To fix, don't trust other users of OpenSSL to clear the per-thread error  
queue.  Instead, clear the entire per-thread queue ahead of certain I/O  
operations when it appears that there might be trouble (these I/O  
operations mostly need to call SSL_get_error() to check for success,  
which relies on the queue being empty).  This is slightly aggressive,  
but it's pretty clear that the other callers have a very dubious claim  
to ownership of the per-thread queue.  Do this is both frontend and  
backend code.  
  
Finally, be more careful about clearing our own error queue, so as to  
not cause these problems ourself.  It's possibly that control previously  
did not always reach SSLerrmessage(), where ERR_get_error() was supposed  
to be called to clear the queue's earliest code.  Make sure  
ERR_get_error() is always called, so as to spare other users of OpenSSL  
the possibility of similar problems caused by libpq (as opposed to  
problems caused by a third party OpenSSL library like PHP's OpenSSL  
extension).  Again, do this is both frontend and backend code.  
  
See bug #12799 and https://bugs.php.net/bug.php?id=68276  
  
Based on patches by Dave Vitek and Peter Eisentraut.  
  
From: Peter Geoghegan <[email protected]>  

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

Add BSD authentication method.

commit   : 34c33a1f00259ce5e3e1d1b4a784037adfca6057    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Apr 2016 13:51:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Apr 2016 13:51:54 -0400    

Click here for diff

Create a "bsd" auth method that works the same as "password" so far as  
clients are concerned, but calls the BSD Authentication service to  
check the password.  This is currently only available on OpenBSD.  
  
Marisa Emerson, reviewed by Thomas Munro  

M configure
M configure.in
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/installation.sgml
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/bin/initdb/initdb.c
M src/include/libpq/hba.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Add combine functions for various floating-point aggregates.

commit   : af025eed536d3842d085ed9e4f9107eb976575cc    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2016 13:44:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2016 13:44:50 -0400    

Click here for diff

This allows parallel aggregation to use them.  It may seem surprising  
that we use float8_combine for both float4_accum and float8_accum  
transition functions, but that's because those functions differ only  
in the type of the non-transition-state argument.  
  
Haribabu Kommi, reviewed by David Rowley and Tomas Vondra  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/float.c
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h

Fix output of regression test of contrib/tsearch2

commit   : 38627f687823eae57e932c3b234656342403e909    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 8 Apr 2016 20:37:12 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 8 Apr 2016 20:37:12 +0300    

Click here for diff

Just forget to add in 1ec4c7c055ca045c5df6352a4cdacd9aa778e598  

M contrib/tsearch2/expected/tsearch2.out

Restore original tsquery operation numbering.

commit   : 1ec4c7c055ca045c5df6352a4cdacd9aa778e598    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 8 Apr 2016 20:11:30 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 8 Apr 2016 20:11:30 +0300    

Click here for diff

As noticed by Tom Lane changing operation's number in commit  
bb140506df605fab58f48926ee1db1f80bdafb59 causes on-disk format incompatibility.  
Revert to previous numbering, that is reason to add special array to store  
priorities of operation. Also it reverts order of tsquery to previous.  
  
Author: Dmitry Ivanov  

M src/backend/utils/adt/tsquery.c
M src/include/tsearch/ts_type.h
M src/test/regress/expected/tsearch.out
M src/test/regress/expected/tstypes.out

Silence warning from modern perl about unescaped braces

commit   : 76a1c97bf21c301f61bb41345e0cdd0d365b2086    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 8 Apr 2016 12:50:30 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 8 Apr 2016 12:50:30 -0400    

Click here for diff

M src/tools/msvc/Install.pm

CREATE INDEX ... INCLUDING (column[, ...])

commit   : 386e3d7609c49505e079c40c65919d99feb82505    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 8 Apr 2016 19:31:49 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 8 Apr 2016 19:31:49 +0300    

Click here for diff

Now indexes (but only B-tree for now) can contain "extra" column(s) which  
doesn't participate in index structure, they are just stored in leaf  
tuples. It allows to use index only scan by using single index instead  
of two or more indexes.  
  
Author: Anastasia Lubennikova with minor editorializing by me  
Reviewers: David Rowley, Peter Geoghegan, Jeff Janes  

M contrib/dblink/dblink.c
M contrib/tcn/tcn.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/access/brin/brin.c
M src/backend/access/common/indextuple.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/index/genam.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/spgist/spgutils.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/toasting.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/executor/execIndexing.c
M src/backend/executor/nodeIndexscan.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/sort/tuplesort.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/include/access/amapi.h
M src/include/access/itup.h
M src/include/access/nbtree.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_constraint_fn.h
M src/include/catalog/pg_index.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/relation.h
M src/include/utils/rel.h
M src/test/regress/expected/create_index.out
A src/test/regress/expected/index_including.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/create_index.sql
A src/test/regress/sql/index_including.sql

Replace printf format %i by %d

commit   : 339025c68f95d3cb2c42478109cafeaf414c7fe0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Apr 2016 12:40:15 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Apr 2016 12:40:15 -0400    

Click here for diff

see also ce8d7bb6440710058503d213b2aafcdf56a5b481  

M contrib/pageinspect/heapfuncs.c
M src/backend/commands/matview.c
M src/test/isolation/isolation_main.c

Turn down MSVC compiler verbosity

commit   : 01a07e6c11562127ad5e6f58d3d6128416b8ab65    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 8 Apr 2016 12:25:10 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 8 Apr 2016 12:25:10 -0400    

Click here for diff

Most of what is produced by the detailed verbosity level is of no  
interest at all, so switch to the normal level for more usable output.  
  
Christian Ullrich  
  
Backpatch to all live branches  

M src/tools/msvc/build.pl

Fix printf format

commit   : 8b737f90843157706b8b5eb401b2aff08da77781    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Apr 2016 12:31:44 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Apr 2016 12:31:44 -0400    

Click here for diff

M contrib/pageinspect/heapfuncs.c

commit   : 93c301fc4ff7d4f06bff98fea8db47ce67f28155    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Apr 2016 12:31:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Apr 2016 12:31:42 -0400    

Click here for diff

Don't try to examine S_ISLNK(st.st_mode) after a failed lstat().  
It's undefined.  
  
Also, if the lstat() reported ENOENT, we do not wish that to be a hard  
error, but the code might nonetheless treat it as one (giving an entirely  
misleading error message, too) depending on luck-of-the-draw as to what  
S_ISLNK() returned.  
  
Don't throw error for ENOENT from rmdir(), either.  (We're not really  
expecting ENOENT because we just stat'd the file successfully; but  
if we're going to allow ENOENT in the symlink code path, surely the  
directory code path should too.)  
  
Generate an appropriate errcode for its-the-wrong-type-of-file complaints.  
(ERRCODE_SYSTEM_ERROR doesn't seem appropriate, and failing to write  
errcode() around it certainly doesn't work, and not writing an errcode  
at all is not per project policy.)  
  
Valgrind noticed the undefined S_ISLNK result; the other problems emerged  
while reading the code in the area.  
  
All of this appears to have been introduced in 8f15f74a44f68f9c.  
Back-patch to 9.5 where that commit appeared.  

M src/backend/commands/tablespace.c

Document which aggregates support partial mode.

commit   : 752b948dfca23ca8229d4490adc1d54be41c09a3    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2016 12:09:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2016 12:09:58 -0400    

Click here for diff

David Rowley, reviewed by Tomas Vondra  

M doc/src/sgml/func.sgml

Enhanced custom error in PLPythonu

commit   : 5c3c3cd0a3046339597a03bc708cb5530dc07059    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 8 Apr 2016 18:30:25 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 8 Apr 2016 18:30:25 +0300    

Click here for diff

Patch adds a new, more rich,  way to emit error message or exception from  
PL/Pythonu code.  
  
Author: Pavel Stehule  
Reviewers: Catalin Iacob, Peter Eisentraut, Jim Nasby  

M doc/src/sgml/plpython.sgml
M src/pl/plpython/expected/plpython_test.out
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_elog.h
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/sql/plpython_test.sql

Increase maximum number of clog buffers.

commit   : 5364b357fb115ed4dc7174085d8f59d9425638dd    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 8 Apr 2016 08:18:52 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 8 Apr 2016 08:18:52 -0700    

Click here for diff

Benchmarking has shown that the current number of clog buffers limits  
scalability. We've previously increased the number in 33aaa139, but  
that's not sufficient with a large number of clients.  
  
We've benchmarked the cost of increasing the limit by benchmarking worst  
case scenarios; testing showed that 128 buffers don't cause a  
regression, even in contrived scenarios, whereas 256 does  
  
There are a number of more complex patches flying around to address  
various clog scalability problems, but this is simple enough that we can  
get it into 9.6; and is beneficial even after those patches have been  
applied.  
  
It is a bit unsatisfactory to increase this in small steps every few  
releases, but a better solution seems to require a rewrite of slru.c;  
not something done quickly.  
  
Author: Amit Kapila and Andres Freund  
Discussion: CAA4eK1+-=18HOrdqtLXqOMwZDbC_15WTyHiFruz7BvVArZPaAw@mail.gmail.com  

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

Add a 'parallel_degree' reloption.

commit   : 25fe8b5f1ac93c3ec01519854e4f554b2e57a926    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2016 11:14:56 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2016 11:14:56 -0400    

Click here for diff

The code that estimates what parallel degree should be uesd for the  
scan of a relation is currently rather stupid, so add a parallel_degree  
reloption that can be used to override the planner's rather limited  
judgement.  
  
Julien Rouhaud, reviewed by David Rowley, James Sewell, Amit Kapila,  
and me.  Some further hacking by me.  

M doc/src/sgml/ref/create_table.sgml
M src/backend/access/common/reloptions.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/bin/psql/tab-complete.c
M src/include/nodes/relation.h
M src/include/utils/rel.h

Attempt to fix breakage due to declaration following code.

commit   : b0b64f65054e6b858b845b46298a624aaaea1deb    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2016 10:52:56 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2016 10:52:56 -0400    

Click here for diff

Per Tom Lane and the buildfarm.  

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

Set PAM_RHOST item for PAM authentication

commit   : 2f1d2b7a75fecad25295cb3f453503eb6a176d4f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Apr 2016 10:45:16 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Apr 2016 10:45:16 -0400    

Click here for diff

The PAM_RHOST item is set to the remote IP address or host name and can  
be used by PAM modules.  A pg_hba.conf option is provided to choose  
between IP address and resolved host name.  
  
From: Grzegorz Sampolski <[email protected]>  
Reviewed-by: Haribabu Kommi <[email protected]>  

M doc/src/sgml/client-auth.sgml
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/include/libpq/hba.h

Rename comparePos() to compareWordEntryPos()

commit   : 4e55b3f0335c2aa658cd9d1fda4dea2a1f9ab80d    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 8 Apr 2016 12:02:45 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 8 Apr 2016 12:02:45 +0300    

Click here for diff

Rename comparePos() to compareWordEntryPos() to prevent export of too  
generic name.  
  
Per gripe from Tom Lane.  

M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/include/tsearch/ts_type.h

Add regression tests for multiple synchronous standbys.

commit   : 196b72fb9a5556c66f2b012cc4e869175a3049fa    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 8 Apr 2016 16:48:53 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 8 Apr 2016 16:48:53 +0900    

Click here for diff

Authors: Suraj Kharage, Michael Paquier, Masahiko Sawada, refactored by me  
Reviewed-By: Kyotaro Horiguchi  

M src/test/perl/PostgresNode.pm
A src/test/recovery/t/007_sync_rep.pl

Use quicksort, not replacement selection, for external sorting.

commit   : 0711803775a37e0bf39d7efdd1e34d9d7e640ea1    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2016 02:36:26 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2016 02:36:26 -0400    

Click here for diff

We still use replacement selection for the first run of the sort only  
and only when the number of tuples is relatively small.  Otherwise,  
the first run, and subsequent runs in all cases, are produced using  
quicksort.  This tends to be faster except perhaps for very small  
amounts of working memory.  
  
Peter Geoghegan, reviewed by Tomas Vondra, Jeff Janes, Mithun Cy,  
Greg Stark, and me.  

M doc/src/sgml/config.sgml
M src/backend/optimizer/path/costsize.c
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/backend/utils/sort/tuplesort.c
M src/include/miscadmin.h

Extend relations multiple blocks at a time to improve scalability.

commit   : 719c84c1be51f3d3fe6049b77ddbaa0c4b58a9a9    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2016 02:04:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2016 02:04:46 -0400    

Click here for diff

Contention on the relation extension lock can become quite fierce when  
multiple processes are inserting data into the same relation at the same  
time at a high rate.  Experimentation shows the extending the relation  
multiple blocks at a time improves scalability.  
  
Dilip Kumar, reviewed by Petr Jelinek, Amit Kapila, and me.  

M src/backend/access/heap/hio.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/include/storage/freespace.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h

Fix a couple of places in doc that implied there was only one sync standby.

commit   : 8643b91ecf8f47a1307df4a00d66b2fceada0d6f    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 8 Apr 2016 13:24:50 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 8 Apr 2016 13:24:50 +0900    

Click here for diff

Thomas Munro  

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

Use Foreign Key relationships to infer multi-column join selectivity

commit   : 137805f89acb361144ec98d9847e26d2848aa57e    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 8 Apr 2016 02:51:09 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 8 Apr 2016 02:51:09 +0100    

Click here for diff

In cases where joins use multiple columns we currently assess each join  
separately causing gross mis-estimates for join cardinality.  
  
This patch adds use of FK information for the first time into the  
planner. When FKs are present and we have multi-column join information,  
plan estimates will be drastically improved. Cases with multiple FKs  
are handled, though partial matches are ignored currently.  
  
Net effect is substantial performance improvements for joins in many  
common cases. Additional planning time is isolated to cases that are  
currently performing poorly, measured at 0.08 - 0.15 ms.  
  
Please watch for planner performance regressions; circumstances seem  
unlikely but the law of unintended consequences may apply somewhen.  
Additional complex tests welcome to prove this before release.  
  
Tests can be performed using SET enable_fkey_estimates = on | off  
using scripts provided during Hackers discussions, message id:  
[email protected]  
  
Authors: Tomas Vondra and David Rowley  
Reviewed and tested by Simon Riggs, adding comments only  

M src/backend/optimizer/path/costsize.c
M src/backend/utils/misc/guc.c
M src/include/optimizer/cost.h
M src/include/optimizer/paths.h
M src/test/regress/expected/rangefuncs.out

GRANT rights to CURRENT_USER instead of adding roles

commit   : 6928484bda454f9ab2456d385b2d317f18b6bf1a    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 7 Apr 2016 14:40:23 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 7 Apr 2016 14:40:23 -0400    

Click here for diff

We shouldn't be adding roles during the regression tests as that can  
cause back-to-back installcheck runs to fail and users running the  
regression tests likley don't want those extra roles.  
  
Pointed out by Tom  

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

Zeroing unused parts ducring tsquery construction.

commit   : 3308467905aa157139d24375850cfe49ee90a0cf    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 7 Apr 2016 20:45:24 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 7 Apr 2016 20:45:24 +0300    

Click here for diff

Per investigation failure skink buildfarm member and  
RANDOMIZE_ALLOCATED_MEMORY help  

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

Refactor join_is_removable() to separate out distinctness-proving logic.

commit   : f338dd7585cab45da9053e883ad65a440a99d3be    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Apr 2016 13:11:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Apr 2016 13:11:30 -0400    

Click here for diff

Extracted from pending unique-join patch, since this is a rather large  
delta but it's simply moving code out into separately-accessible  
subroutines.  
  
I (tgl) did choose to add a bit more logic to rel_supports_distinctness,  
so that it verifies that there's at least one potentially usable unique  
index rather than just checking indexlist != NIL.  Otherwise there's  
no functional change here.  
  
David Rowley  

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

Make testing of phraseto_tsquery independ from value of default_text_search_config variable.

commit   : a7ace3b6d96c7a1539ed0700865d320258a12f73    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 7 Apr 2016 19:28:31 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 7 Apr 2016 19:28:31 +0300    

Click here for diff

Per skink buldfarm member  

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

Detect SSI conflicts before reporting constraint violations

commit   : fcff8a575198478023ada8a48e13b50f70054766    
  
author   : Kevin Grittner <[email protected]>    
date     : Thu, 7 Apr 2016 11:12:35 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Thu, 7 Apr 2016 11:12:35 -0500    

Click here for diff

While prior to this patch the user-visible effect on the database  
of any set of successfully committed serializable transactions was  
always consistent with some one-at-a-time order of execution of  
those transactions, the presence of declarative constraints could  
allow errors to occur which were not possible in any such ordering,  
and developers had no good workarounds to prevent user-facing  
errors where they were not necessary or desired.  This patch adds  
a check for serialization failure ahead of duplicate key checking  
so that if a developer explicitly (redundantly) checks for the  
pre-existing value they will get the desired serialization failure  
where the problem is caused by a concurrent serializable  
transaction; otherwise they will get a duplicate key error.  
  
While it would be better if the reads performed by the constraints  
could count as part of the work of the transaction for  
serialization failure checking, and we will hopefully get there  
some day, this patch allows a clean and reliable way for developers  
to work around the issue.  In many cases existing code will already  
be doing the right thing for this to "just work".  
  
Author: Thomas Munro, with minor editing of docs by me  
Reviewed-by: Marko Tiikkaja, Kevin Grittner  

M doc/src/sgml/mvcc.sgml
M src/backend/access/nbtree/nbtinsert.c
A src/test/isolation/expected/read-write-unique-2.out
A src/test/isolation/expected/read-write-unique-3.out
A src/test/isolation/expected/read-write-unique-4.out
A src/test/isolation/expected/read-write-unique.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/read-write-unique-2.spec
A src/test/isolation/specs/read-write-unique-3.spec
A src/test/isolation/specs/read-write-unique-4.spec
A src/test/isolation/specs/read-write-unique.spec

Phrase full text search.

commit   : bb140506df605fab58f48926ee1db1f80bdafb59    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 7 Apr 2016 18:44:18 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 7 Apr 2016 18:44:18 +0300    

Click here for diff

Patch introduces new text search operator (<-> or <DISTANCE>) into tsquery.  
On-disk and binary in/out format of tsquery are backward compatible.  
It has two side effect:  
- change order for tsquery, so, users, who has a btree index over tsquery,  
  should reindex it  
- less number of parenthesis in tsquery output, and tsquery becomes more  
  readable  
  
Authors: Teodor Sigaev, Oleg Bartunov, Dmitry Ivanov  
Reviewers: Alexander Korotkov, Artur Zakirov  

M contrib/tsearch2/expected/tsearch2.out
M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/textsearch.sgml
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_proc.h
M src/include/tsearch/ts_public.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/test/regress/expected/tsdicts.out
M src/test/regress/expected/tsearch.out
M src/test/regress/expected/tstypes.out
M src/test/regress/sql/tsdicts.sql
M src/test/regress/sql/tsearch.sql
M src/test/regress/sql/tstypes.sql

Load FK defs into relcache for use by planner

commit   : 015e88942aa50f0d419ddac00e63bb06d6e62e86    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 7 Apr 2016 12:08:33 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 7 Apr 2016 12:08:33 +0100    

Click here for diff

Fastpath ignores this if no triggers defined.  
  
Author: Tomas Vondra, with fastpath and comments added by me  
Reviewers: David Rowley, Simon Riggs  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/cache/relcache.c
M src/include/nodes/nodes.h
M src/include/nodes/relation.h
M src/include/utils/rel.h
M src/include/utils/relcache.h

Standardize GetTokenInformation() error reporting.

commit   : f2b1b3079ce9d2965f6e450585f24d18cdf5647b    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 6 Apr 2016 23:41:43 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 6 Apr 2016 23:41:43 -0400    

Click here for diff

Commit c22650cd6450854e1a75064b698d7dcbb4a8821a sparked a discussion  
about diverse interpretations of "token user" in error messages.  Expel  
old and new specimens of that phrase by making all GetTokenInformation()  
callers report errors the way GetTokenUser() has been reporting them.  
These error conditions almost can't happen, so users are unlikely to  
observe this change.  
  
Reviewed by Tom Lane and Stephen Frost.  

M src/backend/libpq/auth.c
M src/port/win32security.c
M src/test/regress/pg_regress.c

Remove redundant message in AddUserToTokenDacl().

commit   : 33d3fc5e2aac32fcf356c09cee4bfded6613a1f3    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 6 Apr 2016 23:40:51 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 6 Apr 2016 23:40:51 -0400    

Click here for diff

GetTokenUser() will have reported an adequate error message.  These  
error conditions almost can't happen, so users are unlikely to observe  
this change.  
  
Reviewed by Tom Lane and Stephen Frost.  

M src/common/exec.c

Bump catversion for pg_dump dump catalog ACL patches

commit   : 29dd1504a12f324c75f6b5ce8863505e499633ec    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2016 23:04:48 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2016 23:04:48 -0400    

Click here for diff

Pointed out by Tom.  

M src/include/catalog/catversion.h

Use GRANT system to manage access to sensitive functions

commit   : 1574783b4ced0356fbc626af1a1a469faa6b41e1    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2016 21:45:32 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2016 21:45:32 -0400    

Click here for diff

Now that pg_dump will properly dump out any ACL changes made to  
functions which exist in pg_catalog, switch to using the GRANT system  
to manage access to those functions.  
  
This means removing 'if (!superuser()) ereport()' checks from the  
functions themselves and then REVOKEing EXECUTE right from 'public' for  
these functions in system_views.sql.  
  
Reviews by Alexander Korotkov, Jose Luis Tallon  

M doc/src/sgml/backup.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/system_views.sql
M src/backend/postmaster/pgstat.c
M src/backend/utils/adt/misc.c

In pg_dump, include pg_catalog and extension ACLs, if changed

commit   : 23f34fa4ba358671adab16773e79c17c92cbc870    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2016 21:45:32 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2016 21:45:32 -0400    

Click here for diff

Now that all of the infrastructure exists, add in the ability to  
dump out the ACLs of the objects inside of pg_catalog or the ACLs  
for objects which are members of extensions, but only if they have  
been changed from their original values.  
  
The original values are tracked in pg_init_privs.  When pg_dump'ing  
9.6-and-above databases, we will dump out the ACLs for all objects  
in pg_catalog and the ACLs for all extension members, where the ACL  
has been changed from the original value which was set during either  
initdb or CREATE EXTENSION.  
  
This should not change dumps against pre-9.6 databases.  
  
Reviews by Alexander Korotkov, Jose Luis Tallon  

M doc/src/sgml/extend.sgml
M src/backend/catalog/aclchk.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dumpall.c
M src/include/catalog/binary_upgrade.h
M src/include/catalog/pg_proc.h
A src/test/regress/expected/init_privs.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/init_privs.sql

In pg_dump, split "dump" into "dump" and "dump_contains"

commit   : d217b2c360cb9a746b4ef122c568bdfedb6d726e    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2016 21:45:32 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2016 21:45:32 -0400    

Click here for diff

Historically, the "dump" component of the namespace has been used  
to decide if the objects inside of the namespace should be dumped  
also.  Given that "dump" is now a bitmask and may be partial, and  
we may want to dump out all components of the namespace object but  
only some of the components of objects contained in the namespace,  
create a "dump_contains" bitmask which will represent what components  
of the objects inside of a namespace should be dumped out.  
  
No behavior change here, but in preparation for a change where we  
will dump out just the ACLs of objects in pg_catalog, but we might  
not dump out the ACL of the pg_catalog namespace itself (for instance,  
when it hasn't been changed from the value set at initdb time).  
  
Reviews by Alexander Korotkov, Jose Luis Tallon  

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

In pg_dump, use a bitmap to represent what to include

commit   : a9f0e8e5a2e779a888988cb64479a6723f668c84    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2016 21:45:32 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2016 21:45:32 -0400    

Click here for diff

pg_dump has historically used a simple boolean 'dump' value to indicate  
if a given object should be included in the dump or not.  Instead, use  
a bitmap which breaks down the components of an object into their  
distinct pieces and use that bitmap to only include the components  
requested.  
  
This does not include any behavioral change, but is in preperation for  
the change to dump out just ACLs for objects in pg_catalog.  
  
Reviews by Alexander Korotkov, Jose Luis Tallon  

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

Add new catalog called pg_init_privs

commit   : 6c268df1276e9dd73e4d2cc89cf8787e8f186bda    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2016 21:45:32 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2016 21:45:32 -0400    

Click here for diff

This new catalog holds the privileges which the system was  
initialized with at initdb time, along with any permissions set  
by extensions at CREATE EXTENSION time.  This allows pg_dump  
(and any other similar use-cases) to detect when the privileges  
set on initdb-created or extension-created objects have been  
changed from what they were set to at initdb/extension-creation  
time and handle those changes appropriately.  
  
Reviews by Alexander Korotkov, Jose Luis Tallon  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/bin/initdb/initdb.c
M src/include/catalog/indexing.h
A src/include/catalog/pg_init_privs.h
M src/test/regress/expected/sanity_check.out

Add jsonb_insert

commit   : 0b62fd036e1ac48a8432bb9664b21e1f036c1b08    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 6 Apr 2016 19:20:17 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 6 Apr 2016 19:20:17 +0300    

Click here for diff

It inserts a new value into an jsonb array at arbitrary position or  
a new key to jsonb object.  
  
Author: Dmitry Dolgov  
Reviewers: Petr Jelinek, Vitaly Burovoy, Andrew Dunstan  

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

pg_dump: Add table qualifications to some tags

commit   : 3b3fcc4eeaeecff315420833975e7c87d760bfe1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Feb 2016 18:56:37 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Feb 2016 18:56:37 -0500    

Click here for diff

Some object types have names that are only unique for one table.  But  
for those we generally didn't put the table name into the dump TOC tag.  
So it was impossible to identify these objects if the same name was used  
for multiple tables.  This affects policies, column defaults,  
constraints, triggers, and rules.  
  
Fix by adding the table name to the TOC tag, so that it now reads  
"$schema $table $object".  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/bin/pg_dump/pg_dump.c

commit   : de94e2af184e25576b13cbda8cf825118835d1cd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Apr 2016 11:34:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Apr 2016 11:34:02 -0400    

Click here for diff

Getting annoyed at the amount of unrelated chatter I get from pgindent'ing  
Rowley's unique-joins patch.  Re-indent all the files it touches.  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/commands/explain.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/relnode.c
M src/backend/parser/parse_clause.c
M src/include/nodes/nodes.h
M src/include/nodes/relation.h
M src/include/optimizer/planmain.h

Modify test_decoding/messages to remove non-ascii chars

commit   : d25379eb23383f1d2f969e65e0332b47c19aea94    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 6 Apr 2016 14:55:11 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 6 Apr 2016 14:55:11 +0100    

Click here for diff

M contrib/test_decoding/expected/messages.out
M contrib/test_decoding/sql/messages.sql

Use proper format specifier %X/%X for LSN, again.

commit   : ead9963c471ccde50ff220e8294ea11a57eee91c    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 6 Apr 2016 22:20:52 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 6 Apr 2016 22:20:52 +0900    

Click here for diff

Commit cee31f5 fixed this problem, but commit 989be08 accidentally  
reverted the fix.  
  
Thomas Munro  

M src/backend/replication/syncrep.c

Revert bf08f2292ffca14fd133aa0901d1563b6ecd6894

commit   : cac0e36682970ec1276d3da3d3ee37325544a2bb    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 6 Apr 2016 14:03:46 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 6 Apr 2016 14:03:46 +0100    

Click here for diff

Remove recent changes to logging XLOG_RUNNING_XACTS by request.  

M src/backend/postmaster/bgwriter.c
M src/backend/storage/ipc/standby.c

Generic Messages for Logical Decoding

commit   : 3fe3511d05127cc024b221040db2eeb352e7d716    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 6 Apr 2016 10:05:41 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 6 Apr 2016 10:05:41 +0100    

Click here for diff

API and mechanism to allow generic messages to be inserted into WAL that are  
intended to be read by logical decoding plugins. This commit adds an optional  
new callback to the logical decoding API.  
  
Messages are either text or bytea. Messages can be transactional, or not, and  
are identified by a prefix to allow multiple concurrent decoding plugins.  
  
(Not to be confused with Generic WAL records, which are intended to allow crash  
recovery of extensible objects.)  
  
Author: Petr Jelinek and Andres Freund  
Reviewers: Artur Zakirov, Tomas Vondra, Simon Riggs  
Discussion: [email protected]  

M contrib/test_decoding/Makefile
M contrib/test_decoding/expected/ddl.out
A contrib/test_decoding/expected/messages.out
M contrib/test_decoding/sql/ddl.sql
A contrib/test_decoding/sql/messages.sql
M contrib/test_decoding/test_decoding.c
M doc/src/sgml/func.sgml
M doc/src/sgml/logicaldecoding.sgml
M src/backend/access/rmgrdesc/Makefile
A src/backend/access/rmgrdesc/logicalmsgdesc.c
M src/backend/access/transam/rmgr.c
M src/backend/replication/logical/Makefile
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
A src/backend/replication/logical/message.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/bin/pg_xlogdump/.gitignore
M src/bin/pg_xlogdump/rmgrdesc.c
M src/include/access/rmgrlist.h
M src/include/catalog/pg_proc.h
M src/include/replication/logicalfuncs.h
A src/include/replication/message.h
M src/include/replication/output_plugin.h
M src/include/replication/reorderbuffer.h
M src/include/replication/snapbuild.h

Support multiple synchronous standby servers.

commit   : 989be0810dffd08b54e1caecec0677608211c339    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 6 Apr 2016 17:18:25 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 6 Apr 2016 17:18:25 +0900    

Click here for diff

Previously synchronous replication offered only the ability to confirm  
that all changes made by a transaction had been transferred to at most  
one synchronous standby server.  
  
This commit extends synchronous replication so that it supports multiple  
synchronous standby servers. It enables users to consider one or more  
standby servers as synchronous, and increase the level of transaction  
durability by ensuring that transaction commits wait for replies from  
all of those synchronous standbys.  
  
Multiple synchronous standby servers are configured in  
synchronous_standby_names which is extended to support new syntax of  
'num_sync ( standby_name [ , ... ] )', where num_sync specifies  
the number of synchronous standbys that transaction commits need to  
wait for replies from and standby_name is the name of a standby  
server.  
  
The syntax of 'standby_name [ , ... ]' which was used in 9.5 or before  
is also still supported. It's the same as new syntax with num_sync=1.  
  
This commit doesn't include "quorum commit" feature which was discussed  
in pgsql-hackers. Synchronous standbys are chosen based on their priorities.  
synchronous_standby_names determines the priority of each standby for  
being chosen as a synchronous standby. The standbys whose names appear  
earlier in the list are given higher priority and will be considered as  
synchronous. Other standby servers appearing later in this list  
represent potential synchronous standbys.  
  
The regression test for multiple synchronous standbys is not included  
in this commit. It should come later.  
  
Authors: Sawada Masahiko, Beena Emerson, Michael Paquier, Fujii Masao  
Reviewed-By: Kyotaro Horiguchi, Amit Kapila, Robert Haas, Simon Riggs,  
Amit Langote, Thomas Munro, Sameer Thakur, Suraj Kharage, Abhijit Menon-Sen,  
Rajeev Rastogi  
  
Many thanks to the various individuals who were involved in  
discussing and developing this feature.  

M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M src/backend/Makefile
M src/backend/replication/.gitignore
M src/backend/replication/Makefile
M src/backend/replication/syncrep.c
A src/backend/replication/syncrep_gram.y
A src/backend/replication/syncrep_scanner.l
M src/backend/replication/walsender.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/replication/syncrep.h
M src/tools/msvc/Mkvcbuild.pm

Fix broken ALTER INDEX documentation

commit   : 2143f5e127903cb50c10537fc22392083cb033b7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 5 Apr 2016 19:03:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 5 Apr 2016 19:03:42 -0300    

Click here for diff

Commit b8a91d9d1c put the description of the new IF EXISTS clause in the  
wrong place -- move it where it belongs.  
  
Backpatch to 9.2.  

M doc/src/sgml/ref/alter_index.sgml

Support ALTER THING .. DEPENDS ON EXTENSION

commit   : f2fcad27d59c8e5c48f8fa0a96c8355e40f24273    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 5 Apr 2016 18:38:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 5 Apr 2016 18:38:54 -0300    

Click here for diff

This introduces a new dependency type which marks an object as depending  
on an extension, such that if the extension is dropped, the object  
automatically goes away; and also, if the database is dumped, the object  
is included in the dump output.  Currently the grammar supports this for  
indexes, triggers, materialized views and functions only, although the  
utility code is generic so adding support for more object types is a  
matter of touching the parser rules only.  
  
Author: Abhijit Menon-Sen  
Reviewed-by: Alexander Korotkov, Álvaro Herrera  
Discussion: http://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_function.sgml
M doc/src/sgml/ref/alter_index.sgml
M doc/src/sgml/ref/alter_materialized_view.sgml
M doc/src/sgml/ref/alter_trigger.sgml
M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/alter.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/objectaddress.h
M src/include/commands/alter.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/test/modules/test_extensions/Makefile
A src/test/modules/test_extensions/expected/test_extdepend.out
A src/test/modules/test_extensions/sql/test_extdepend.sql
M src/tools/pgindent/typedefs.list

Fix parallel-safety code for parallel aggregation.

commit   : 41ea0c23761ca108e2f08f6e3151e3cb1f9652a1    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 Apr 2016 16:06:15 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 Apr 2016 16:06:15 -0400    

Click here for diff

has_parallel_hazard() was ignoring the proparallel markings for  
aggregates, which is no good.  Fix that.  There was no way to mark  
an aggregate as actually being parallel-safe, either, so add a  
PARALLEL option to CREATE AGGREGATE.  
  
Patch by me, reviewed by David Rowley.  

M doc/src/sgml/ref/create_aggregate.sgml
M src/backend/catalog/pg_aggregate.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/functioncmds.c
M src/backend/optimizer/util/clauses.c
M src/include/catalog/pg_aggregate.h
M src/test/regress/expected/create_aggregate.out
M src/test/regress/sql/create_aggregate.sql

Align all shared memory allocations to cache line boundaries.

commit   : 09adc9a8c09c9640de05c7023b27fb83c761e91c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 Apr 2016 15:47:49 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 Apr 2016 15:47:49 -0400    

Click here for diff

Experimentation shows this only costs about 6kB, which seems well  
worth it given the major performance effects that can be caused  
by insufficient alignment, especially on larger systems.  
  
Discussion: [email protected]  

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

Fix PL/Python for recursion and interleaved set-returning functions.

commit   : 1d2fe56e42640613781fc17ab1534fd0551de9bd    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Apr 2016 14:50:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Apr 2016 14:50:30 -0400    

Click here for diff

PL/Python failed if a PL/Python function was invoked recursively via SPI,  
since arguments are passed to the function in its global dictionary  
(a horrible decision that's far too ancient to undo) and it would delete  
those dictionary entries on function exit, leaving the outer recursion  
level(s) without any arguments.  Not deleting them would be little better,  
since the outer levels would then see the innermost level's arguments.  
  
Since PL/Python uses ValuePerCall mode for evaluating set-returning  
functions, it's possible for multiple executions of the same SRF to be  
interleaved within a query.  PL/Python failed in such a case, because  
it stored only one iterator per function, directly in the function's  
PLyProcedure struct.  Moreover, one interleaved instance of the SRF  
would see argument values that should belong to another.  
  
Hence, invent code for saving and restoring the argument entries.  To fix  
the recursion case, we only need to save at recursive entry and restore  
at recursive exit, so the overhead in non-recursive cases is negligible.  
To fix the SRF case, we have to save when suspending a SRF and restore  
when resuming it, which is potentially not negligible; but fortunately  
this is mostly a matter of manipulating Python object refcounts and  
should not involve much physical data copying.  
  
Also, store the Python iterator and saved argument values in a structure  
associated with the SRF call site rather than the function itself.  This  
requires adding a memory context deletion callback to ensure that the SRF  
state is cleaned up if the calling query exits before running the SRF to  
completion.  Without that we'd leak a refcount to the iterator object in  
such a case, resulting in session-lifespan memory leakage.  (In the  
pre-existing code, there was no memory leak because there was only one  
iterator pointer, but what would happen is that the previous iterator  
would be resumed by the next query attempting to use the SRF.  Hardly the  
semantics we want.)  
  
We can buy back some of whatever overhead we've added by getting rid of  
PLy_function_delete_args(), which seems a useless activity: there is no  
need to delete argument entries from the global dictionary on exit,  
since the next time anyone would see the global dict is on the next  
fresh call of the PL/Python function, at which time we'd overwrite those  
entries with new arg values anyway.  
  
Also clean up some really ugly coding in the SRF implementation, including  
such gems as returning directly out of a PG_TRY block.  (The only reason  
that failed to crash hard was that all existing call sites immediately  
exited their own PG_TRY blocks, popping the dangling longjmp pointer before  
there was any chance of it being used.)  
  
In principle this is a bug fix; but it seems a bit too invasive relative to  
its value for a back-patch, and besides the fix depends on memory context  
callbacks so it could not go back further than 9.5 anyway.  
  
Alexey Grishchenko and Tom Lane  

M src/pl/plpython/expected/plpython_setof.out
M src/pl/plpython/expected/plpython_spi.out
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/plpy_procedure.h
M src/pl/plpython/sql/plpython_setof.sql
M src/pl/plpython/sql/plpython_spi.sql

Add parallel query support functions for assorted aggregates.

commit   : 11c8669c0cc7abc7a7702594cf13452c378d2517    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 Apr 2016 14:24:59 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 Apr 2016 14:24:59 -0400    

Click here for diff

This lets us use parallel aggregate for a variety of useful cases  
that didn't work before, like sum(int8), sum(numeric), several  
versions of avg(), and various other functions.  
  
Add some regression tests, as well, testing the general sanity of  
these and future catalog entries.  
  
David Rowley, reviewed by Tomas Vondra, with a few further changes  
by me.  

M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/timestamp.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h
M src/include/utils/timestamp.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

Implement backup API functions for non-exclusive backups

commit   : 7117685461af50f50c03f43e6a622284c8d54694    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 5 Apr 2016 20:03:49 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 5 Apr 2016 20:03:49 +0200    

Click here for diff

Previously non-exclusive backups had to be done using the replication protocol  
and pg_basebackup. With this commit it's now possible to make them using  
pg_start_backup/pg_stop_backup as well, as long as the backup program can  
maintain a persistent connection to the database.  
  
Doing this, backup_label and tablespace_map are returned as results from  
pg_stop_backup() instead of being written to the data directory. This makes  
the server safe from a crash during an ongoing backup, which can be a problem  
with exclusive backups.  
  
The old syntax of the functions remain and work exactly as before, but since the  
new syntax is safer this should eventually be deprecated and removed.  
  
Only reference documentation is included. The main section on backup still needs  
to be rewritten to cover this, but since that is already scheduled for a separate  
large rewrite, it's not included in this patch.  
  
Reviewed by David Steele and Amit Kapila  

M doc/src/sgml/func.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/system_views.sql
M src/backend/replication/basebackup.c
M src/include/access/xlog.h
M src/include/access/xlog_fn.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h

Fix typo

commit   : 9457b591b949d3c256dd91043df71fb11657227a    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 5 Apr 2016 11:05:01 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 5 Apr 2016 11:05:01 +0200    

Click here for diff

Etsuro Fujita  

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

Fix error message from wal_level value renaming

commit   : 4dcd4da98c786c48b0dbf129c8f7ea592c34a185    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Apr 2016 21:17:54 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Apr 2016 21:17:54 -0400    

Click here for diff

found by Ian Barwick  

M src/backend/replication/slot.c

Disallow newlines in parameter values to be set in ALTER SYSTEM.

commit   : 99f3b5613bd1f145b5dbbe86000337bbe37fb094    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2016 18:05:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2016 18:05:23 -0400    

Click here for diff

As noted by Julian Schauder in bug #14063, the configuration-file parser  
doesn't support embedded newlines in string literals.  While there might  
someday be a good reason to remove that restriction, there doesn't seem  
to be one right now.  However, ALTER SYSTEM SET could accept strings  
containing newlines, since many of the variable-specific value-checking  
routines would just see a newline as whitespace.  This led to writing a  
postgresql.auto.conf file that was broken and had to be removed manually.  
  
Pending a reason to work harder, just throw an error if someone tries this.  
  
In passing, fix several places in the ALTER SYSTEM logic that failed to  
provide an errcode() for an ereport(), and thus would falsely log the  
failure as an internal XX000 error.  
  
Back-patch to 9.4 where ALTER SYSTEM was introduced.  

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

Display WAL pointer in rm_redo error callback

commit   : 890614d2b35bd20468352043870edc7f24a7b8ec    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 4 Apr 2016 18:12:12 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 4 Apr 2016 18:12:12 -0300    

Click here for diff

This makes it easier to identify the source of a recovery problem  
in case of a bug or data corruption.  

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

Add a few comments about ANALYZE's strategy for collecting MCVs.

commit   : 3c69b33f459f62fe6db66c386ef12620ea697f74    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2016 17:06:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2016 17:06:33 -0400    

Click here for diff

Alex Shulgin complained that the underlying strategy wasn't all that  
apparent, particularly not the fact that we intentionally have two  
code paths depending on whether we think the column has a limited set  
of possible values or not.  Try to make it clearer.  

M src/backend/commands/analyze.c

Partially revert commit 3d3bf62f30200500637b24fdb7b992a99f9704c3.

commit   : 391159e03a8b69dd04a1432ceb800c7c4c3d608c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2016 16:48:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2016 16:48:13 -0400    

Click here for diff

On reflection, the pre-existing logic in ANALYZE is specifically meant to  
compare the frequency of a candidate MCV against the estimated frequency of  
a random distinct value across the whole table.  The change to compare it  
against the average frequency of values actually seen in the sample doesn't  
seem very principled, and if anything it would make us less likely not more  
likely to consider a value an MCV.  So revert that, but keep the aspect of  
considering only nonnull values, which definitely is correct.  
  
In passing, rename the local variables in these stanzas to  
"ndistinct_table", to avoid confusion with the "ndistinct" that appears at  
an outer scope in compute_scalar_stats.  

M src/backend/commands/analyze.c

Silence compiler warning

commit   : c9ff752a854b687fc0a05fd4aba1066028ec5495    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 4 Apr 2016 17:07:18 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 4 Apr 2016 17:07:18 -0300    

Click here for diff

Reported by Peter Eisentraut to occur on 32bit systems  

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

Add a \gexec command to psql for evaluation of computed queries.

commit   : 2bbe9112aec60abc2d3b4c39e75d0cbdcaaa45e1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2016 15:25:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2016 15:25:16 -0400    

Click here for diff

\gexec executes the just-entered query, like \g, but instead of printing  
the results it takes each field as a SQL command to send to the server.  
Computing a series of queries to be executed is a fairly common thing,  
but up to now you always had to resort to kluges like writing the queries  
to a file and then inputting the file.  Now it can be done with no  
intermediate step.  
  
The implementation is fairly straightforward except for its interaction  
with FETCH_COUNT.  ExecQueryUsingCursor isn't capable of being called  
recursively, and even if it were, its need to create a transaction  
block interferes unpleasantly with the desired behavior of \gexec after  
a failure of a generated query (i.e., that it can continue).  Therefore,  
disable use of ExecQueryUsingCursor when doing the master \gexec query.  
We can still apply it to individual generated queries, however, and there  
might be some value in doing so.  
  
While testing this feature's interaction with single-step mode, I (tgl) was  
led to conclude that SendQuery needs to recognize SIGINT (cancel_pressed)  
as a negative response to the single-step prompt.  Perhaps that's a  
back-patchable bug fix, but for now I just included it here.  
  
Corey Huinker, reviewed by Jim Nasby, Daniel Vérité, and myself  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/help.c
M src/bin/psql/settings.h
M src/bin/psql/tab-complete.c
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Introduce a LOG_SERVER_ONLY ereport level, which is never sent to client.

commit   : 66229ac0040cf1e0f5b9d72271aa9feaf3b3a37e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2016 12:32:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2016 12:32:42 -0400    

Click here for diff

This elevel is useful for logging audit messages and similar information  
that should not be passed to the client.  It's equivalent to LOG in terms  
of decisions about logging priority in the postmaster log, but messages  
with this elevel will never be sent to the client.  
  
In the current implementation, it's just an alias for the longstanding  
COMMERROR elevel (or more accurately, we've made COMMERROR an alias for  
this).  At some point it might be interesting to allow a LOG_ONLY flag to  
be attached to any elevel, but that would be considerably more complicated,  
and it's not clear there's enough use-cases to justify the extra work.  
For now, let's just take the easy 90% solution.  
  
David Steele, reviewed by Fabien Coelho, Petr Jelínek, and myself  

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

Fix latent portability issue in pgwin32_dispatch_queued_signals().

commit   : 58666ed28ab59a2686ee08bc648b4e9959aacfce    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2016 11:13:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2016 11:13:17 -0400    

Click here for diff

The first iteration of the signal-checking loop would compute sigmask(0)  
which expands to 1<<(-1) which is undefined behavior according to the  
C standard.  The lack of field reports of trouble suggest that it  
evaluates to 0 on all existing Windows compilers, but that's hardly  
something to rely on.  Since signal 0 isn't a queueable signal anyway,  
we can just make the loop iterate from 1 instead, and save a few cycles  
as well as avoiding the undefined behavior.  
  
In passing, avoid evaluating the volatile expression UNBLOCKED_SIGNAL_QUEUE  
twice in a row; there's no reason to waste cycles like that.  
  
Noted by Aleksander Alekseev, though this isn't his proposed fix.  
Back-patch to all supported branches.  

M src/backend/port/win32/signal.c

Fix typo

commit   : eb7308d29875df773b5b52b06ed3d8b60f1b8242    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 4 Apr 2016 14:55:29 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 4 Apr 2016 14:55:29 +0300    

Click here for diff

Michael Paquier  

M contrib/bloom/blutils.c

fix typo

commit   : 9b27aebe7124210c1b0dbacac657edfefa16a006    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 4 Apr 2016 13:15:24 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 4 Apr 2016 13:15:24 +0300    

Click here for diff

Andreas Ulbrich  

M doc/src/sgml/generic-wal.sgml

Improve estimate of distinct values in estimate_num_groups().

commit   : 84f9a35e398f863c62440d3f82fc57b4fedc5d08    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 4 Apr 2016 12:41:56 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 4 Apr 2016 12:41:56 +0100    

Click here for diff

When adjusting the estimate for the number of distinct values from a  
rel in a grouped query to take into account the selectivity of the  
rel's restrictions, use a formula that is less likely to produce  
under-estimates.  
  
The old formula simply multiplied the number of distinct values in the  
rel by the restriction selectivity, which would be correct if the  
restrictions were fully correlated with the grouping expressions, but  
can produce significant under-estimates in cases where they are not  
well correlated.  
  
The new formula is based on the random selection probability, and so  
assumes that the restrictions are not correlated with the grouping  
expressions. This is guaranteed to produce larger estimates, and of  
course risks over-estimating in cases where the restrictions are  
correlated, but that has less severe consequences than  
under-estimating, which might lead to a HashAgg that consumes an  
excessive amount of memory.  
  
This could possibly be improved upon in the future by identifying  
correlated restrictions and using a hybrid of the old and new  
formulae.  
  
Author: Tomas Vondra, with some hacking be me  
Reviewed-by: Mark Dilger, Alexander Korotkov, Dean Rasheed and Tom Lane  
Discussion: http://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/utils/adt/selfuncs.c
M src/test/regress/expected/subselect.out

Avoid archiving XLOG_RUNNING_XACTS on idle server

commit   : bf08f2292ffca14fd133aa0901d1563b6ecd6894    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 4 Apr 2016 07:18:05 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 4 Apr 2016 07:18:05 +0100    

Click here for diff

If archive_timeout > 0 we should avoid logging XLOG_RUNNING_XACTS if idle.  
  
Bug 13685 reported by Laurence Rowe, investigated in detail by Michael Paquier,  
though this is not his proposed fix.  
[email protected]  
  
Simple non-invasive patch to allow later backpatch to 9.4 and 9.5  

M src/backend/postmaster/bgwriter.c
M src/backend/storage/ipc/standby.c

Clean up dubious code in contrib/seg.

commit   : a75a418d07bf852dc9fdb85ccfb39c763aa057a9    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Apr 2016 17:36:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Apr 2016 17:36:53 -0400    

Click here for diff

The restore() function assumed that the result of sprintf() with %e format  
would necessarily contain an 'e', which is false: what if the supplied  
number is an infinity or NaN?  If that did happen, we'd get a  
null-pointer-dereference core dump.  The case appears impossible currently,  
because seg_in() does not accept such values, and there are no seg-creating  
functions that would create one.  But it seems unwise to rely on it never  
happening in future.  
  
Quite aside from that, the code was pretty ugly: it relied on modifying a  
static format string when it could use a "*" precision argument, and it  
used strtok() entirely gratuitously, and it stripped off trailing spaces  
by hand instead of just not asking for them to begin with.  
  
Coverity noticed the potential null pointer dereference (though I wonder  
why it didn't complain years ago, since this code is ancient).  
  
Since this is just code cleanup and forestalling a hypothetical future  
bug, there seems no need for back-patching.  

M contrib/seg/seg.c

Fix contrib/bloom to not fail under CLOBBER_CACHE_ALWAYS.

commit   : 8f75fd1f402acbc30bc15dbf51eb6dec1bbec600    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Apr 2016 15:16:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Apr 2016 15:16:07 -0400    

Click here for diff

The code was supposing that rd_amcache wouldn't disappear from under it  
during a scan; which is wrong.  Copy the data out of the relcache rather  
than trying to reference it there.  

M contrib/bloom/bloom.h
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c

Clean up some stuff in new contrib/bloom module.

commit   : a9284849b48b04fa2836aaf704659974c13e610d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Apr 2016 14:17:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Apr 2016 14:17:20 -0400    

Click here for diff

Coverity complained about implicit sign-extension in the  
BloomPageGetFreeSpace macro, probably because sizeOfBloomTuple isn't wide  
enough for size calculations.  No overflow is really possible as long as  
maxoff and sizeOfBloomTuple are small enough to represent a realistic  
situation, but it seems like a good idea to declare sizeOfBloomTuple as  
Size not int32.  
  
Add missing check on BloomPageAddItem() result, again from Coverity.  
  
Avoid core dump due to not allocating so->sign array when  
scan->numberOfKeys is zero.  Also thanks to Coverity.  
  
Use FLEXIBLE_ARRAY_MEMBER rather than declaring an array as size 1  
when it isn't necessarily.  
  
Very minor beautification of related code.  
  
Unfortunately, none of the Coverity-detected mistakes look like they  
could account for the remaining buildfarm unhappiness with this  
module.  It's barely possible that the FLEXIBLE_ARRAY_MEMBER mistake  
does account for that, if it's enabling bogus compiler optimizations;  
but I'm not terribly optimistic.  We probably still have bugs to  
find here.  

M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blscan.c

Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases

commit   : 3e4b7d87988f0835f137f15f5c1a40598dd21f3d    
  
author   : Simon Riggs <[email protected]>    
date     : Sun, 3 Apr 2016 17:46:09 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Sun, 3 Apr 2016 17:46:09 +0100    

Click here for diff

Replay of XLOG_BTREE_VACUUM during Hot Standby was previously thought to require  
complex interlocking that matched the requirements on the master. This required  
an O(N) operation that became a significant problem with large indexes, causing  
replication delays of seconds or in some cases minutes while the  
XLOG_BTREE_VACUUM was replayed.  
  
This commit skips the pin scan that was previously required, by observing in  
detail when and how it is safe to do so, with full documentation. The pin  
scan is skipped only in replay; the VACUUM code path on master is not  
touched here and WAL is identical.  
  
The current commit applies in all cases, effectively replacing commit  
687f2cd7a0150647794efe432ae0397cb41b60ff.  

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

Add psql \errverbose command to see last server error at full verbosity.

commit   : 3cc38ca7d21255721d600eb75d7cc6708c14764b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Apr 2016 12:29:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Apr 2016 12:29:55 -0400    

Click here for diff

Often, upon getting an unexpected error in psql, one's first wish is that  
the verbosity setting had been higher; for example, to be able to see the  
schema-name field or the server code location info.  Up to now the only way  
has been to adjust the VERBOSITY variable and repeat the failing query.  
That's a pain, and it doesn't work if the error isn't reproducible.  
  
This commit adds a psql feature that redisplays the most recent server  
error at full verbosity, without needing to make any variable changes or  
re-execute the failed command.  We just need to hang onto the latest error  
PGresult in case the user executes \errverbose, and then apply libpq's  
new PQresultVerboseErrorMessage() function to it.  This will consume  
some trivial amount of psql memory, but otherwise the cost when the  
feature isn't used should be negligible.  
  
Alex Shulgin, reviewed by Daniel Vérité, some improvements by me  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/help.c
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/tab-complete.c

Add libpq support for recreating an error message with different verbosity.

commit   : e3161b231cfaadd4b6438eff2fc1f6cd086f41a9    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Apr 2016 12:24:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Apr 2016 12:24:54 -0400    

Click here for diff

Often, upon getting an unexpected error in psql, one's first wish is that  
the verbosity setting had been higher; for example, to be able to see the  
schema-name field or the server code location info.  Up to now the only way  
has been to adjust the VERBOSITY variable and repeat the failing query.  
That's a pain, and it doesn't work if the error isn't reproducible.  
  
This commit adds support in libpq for regenerating the error message for  
an existing error PGresult at any desired verbosity level.  This is almost  
just a matter of refactoring the existing code into a subroutine, but there  
is one bit of possibly-needed information that was not getting put into  
PGresults: the text of the last query sent to the server.  We must add that  
string to the contents of an error PGresult.  But we only need to save it  
if it might be used, which with the existing error-formatting code only  
happens if there is a PG_DIAG_STATEMENT_POSITION error field, which is  
probably pretty rare for errors in production situations.  So really the  
overhead when the feature isn't used should be negligible.  
  
Alex Shulgin, reviewed by Daniel Vérité, some improvements by me  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h

Add missing "static".

commit   : 5a5b917184b630529635db2e037d298ad90c355d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Apr 2016 13:59:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Apr 2016 13:59:11 -0400    

Click here for diff

Per buildfarm member pademelon.  

M contrib/bloom/blutils.c

Make all the declarations of WaitEventSetWaitBlock be marked "inline".

commit   : a1953f3a60cc7d1b8516d0b2c7e82ae8e9242de3    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Apr 2016 13:55:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Apr 2016 13:55:44 -0400    

Click here for diff

The inconsistency here triggered compiler warnings on some buildfarm  
members, and it's surely pretty pointless.  

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

Suppress compiler warning.

commit   : 45aae8e78967b37f285e99617b919319bf2bf536    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Apr 2016 13:49:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Apr 2016 13:49:17 -0400    

Click here for diff

Some buildfarm members are showing "comparison is always false due to  
limited range of data type" complaints on this test, so #ifdef it out  
on machines with 32-bit int.  

M src/timezone/zic.c

Fix condition in e9e441c9fac6cbc0510cded6abb9d0e6b646ecaf

commit   : 9c50372d20aabdb23963f8d28651728d546acefb    
  
author   : Teodor Sigaev <[email protected]>    
date     : Sat, 2 Apr 2016 18:36:46 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Sat, 2 Apr 2016 18:36:46 +0300    

Click here for diff

Comment is right, but if - not.  

M contrib/bloom/blvacuum.c

Fix typo in pg_regress.c

commit   : 62b5cd234ba982f71f2501f405a26ed80c92a229    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 2 Apr 2016 11:12:17 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 2 Apr 2016 11:12:17 -0400    

Click here for diff

s/afer/after  
  
Pointed out by Andreas 'ads' Scherbaum  

M src/test/regress/pg_regress.c

Prevent mark as deleted and as 'has free space' page in bloom module

commit   : e9e441c9fac6cbc0510cded6abb9d0e6b646ecaf    
  
author   : Teodor Sigaev <[email protected]>    
date     : Sat, 2 Apr 2016 14:20:46 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Sat, 2 Apr 2016 14:20:46 +0300    

Click here for diff

Vacuum might put page into list of pages with some free space and mark as  
deleted at the same time.  

M contrib/bloom/blvacuum.c

Fixes in bloom contrib module

commit   : 80afb62db0f118f70367a357cef0509a11112ebb    
  
author   : Teodor Sigaev <[email protected]>    
date     : Sat, 2 Apr 2016 13:47:04 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Sat, 2 Apr 2016 13:47:04 +0300    

Click here for diff

Looking at result of buildfarm member jaguarundi it seems to me that  
BloomOptions isn't inited sometime, but I don't see yet how it's possible.  
Nevertheless, check of signature length's is missed, so, add  
a limit of it. Also add missed GenericXLogAbort() in case of already  
deleted page in vacuum + minor code refactoring.  

M contrib/bloom/bloom.h
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c

Refer to a TOKEN_USER payload as a "token user," not as a "user token".

commit   : c22650cd6450854e1a75064b698d7dcbb4a8821a    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 1 Apr 2016 21:53:18 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 1 Apr 2016 21:53:18 -0400    

Click here for diff

This corrects messages for can't-happen errors.  The corresponding "user  
token" appears in the HANDLE argument of GetTokenInformation().  

M src/backend/libpq/auth.c
M src/common/exec.c

Copyedit comments and documentation.

commit   : 4ad6f13500cd9a3ca0652e43232f9515319e55e2    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 1 Apr 2016 21:53:10 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 1 Apr 2016 21:53:10 -0400    

Click here for diff

M config/c-compiler.m4
M contrib/pgstattuple/pgstatapprox.c
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/xml2.sgml
M src/backend/executor/execParallel.c
M src/backend/storage/buffer/README
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/smgr/md.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/hash/dynahash.c
M src/pl/plperl/plperl.c
M src/test/perl/TestLib.pm
M src/tools/valgrind.supp

test_slot_timelines: Fix alternate expected output

commit   : f07d18b6e94da6ef93dc4e00096f1e7542814fdb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Apr 2016 18:36:07 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Apr 2016 18:36:07 -0300    

Click here for diff

M src/test/modules/test_slot_timelines/expected/load_extension_1.out

Omit null rows when setting the threshold for what's a most-common value.

commit   : 3d3bf62f30200500637b24fdb7b992a99f9704c3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Apr 2016 17:03:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Apr 2016 17:03:18 -0400    

Click here for diff

As with the previous patch, large numbers of null rows could skew this  
calculation unfavorably, causing us to discard values that have a  
legitimate claim to be MCVs, since our definition of MCV is that it's  
most common among the non-null population of the column.  Hence, make  
the numerator of avgcount be the number of non-null sample values not  
the number of sample rows; likewise for maxmincount in the  
compute_scalar_stats variant.  
  
Also, make the denominator be the number of distinct values actually  
observed in the sample, rather than reversing it back out of the computed  
stadistinct.  This avoids depending on the accuracy of the Haas-Stokes  
approximation, and really it's what we want anyway; the threshold should  
depend only on what we see in the sample, not on what we extrapolate  
about the contents of the whole column.  
  
Alex Shulgin, reviewed by Tomas Vondra and myself  

M src/backend/commands/analyze.c

pgbench: Remove unused parameter

commit   : 5cb882675ae239db9d00b16a9467c4f900fb10b6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Apr 2016 17:10:30 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Apr 2016 17:10:30 -0300    

Click here for diff

For some reason this parameter was introduced as unused in 3da0dfb4b146,  
and has never been used for anything.  Remove it.  
  
Author: Fabien Coelho  

M src/bin/pgbench/pgbench.c

Omit null rows when applying the Haas-Stokes estimator for ndistinct.

commit   : be4b4dc75955318e763f5b2e3a990e35366ac797    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Apr 2016 15:47:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Apr 2016 15:47:52 -0400    

Click here for diff

Previously, we included null rows in the values of n and N that went  
into the formula, which amounts to considering null as a value in its  
own right; but the d and f1 values do not include nulls.  This is  
inconsistent, and it contributes to significant underestimation of  
ndistinct when the column is mostly nulls.  In any case stadistinct  
is defined as the number of distinct non-null values, so we should  
exclude nulls when doing this computation.  
  
This is an aboriginal bug in our application of the Haas-Stokes formula,  
but we'll refrain from back-patching for fear of destabilizing plan  
choices in released branches.  
  
While at it, make the code a bit more readable by omitting unnecessary  
casts and intermediate variables.  
  
Observation and original patch by Tomas Vondra, adjusted to fix both  
uses of the formula by Alex Shulgin, cosmetic improvements by me  

M src/backend/commands/analyze.c

Fix logical_decoding_timelines test crashes

commit   : 82c83b337202fa0f5b235bdfaeb992a5cee40ed5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Apr 2016 16:47:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Apr 2016 16:47:00 -0300    

Click here for diff

In the test_slot_timelines test module, we were abusing passing NULL  
values which was received as zeroes in x86, but this breaks in ARM  
(buildfarm member hamster) by crashing instead.  Fix the breakage by  
marking these functions as STRICT; the InvalidXid value that was  
previously implicit in NULL values (on x86 at least) can now be passed  
as 0.  Failing to follow the fmgr protocol to check for NULLs beforehand  
was causing ARM to fail, as evidenced by segmentation faults in  
buildfarm member hamster.  
  
In order to use the new functionality in the test script, use COALESCE  
in the right spot to avoid forwarding NULL values.  
  
This was diagnosed from the hamster crash by Craig Ringer, who also  
proposed a different patch (checking for NULL values explicitely in the  
C function code, and keeping the non-strictness in the C functions).  
I decided to go with this approach instead.  

M src/test/modules/test_slot_timelines/expected/load_extension.out
M src/test/modules/test_slot_timelines/sql/load_extension.sql
M src/test/modules/test_slot_timelines/test_slot_timelines–1.0.sql
M src/test/modules/test_slot_timelines/test_slot_timelines.c
M src/test/recovery/t/006_logical_decoding_timelines.pl

Fixes in bloom contrib module missed during review

commit   : 27f3bbfad46e694fcbf2fa39cb621110d46ec95c    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 1 Apr 2016 20:09:13 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 1 Apr 2016 20:09:13 +0300    

Click here for diff

- macroses llike (var & FLAG) are changed to ((var & FLAG) != 0)  
- do not copy uninitialized part of notFullPage array to page  

M contrib/bloom/bloom.h
M contrib/bloom/blvacuum.c

Type names should not be quoted

commit   : f402b9950120358d1870aacc10070e121d8a17de    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Apr 2016 13:35:48 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Apr 2016 13:35:48 -0300    

Click here for diff

Our actual convention, contrary to what I said in 59a2111b23f, is not to  
quote type names, as evidenced by unquoted use of format_type_be()  
result value in error messages.  Remove quotes from recently tweaked  
messages accordingly.  
  
Per note from Tom Lane  

M src/backend/commands/amcmds.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/proclang.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/parser/parse_clause.c
M src/test/regress/expected/event_trigger.out

Get rid of minus zero in box regression test.

commit   : a067b50470cf7fda77dd28b03519f2483c2322bf    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Apr 2016 12:25:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Apr 2016 12:25:17 -0400    

Click here for diff

Commit acdf2a8b added a test case involving minus zero as a box endpoint.  
This is not very portable, as evidenced by the several older buildfarm  
members that are failing on the test because they print minus zero as  
just "0".  If there were any significant reason to test this behavior,  
we could consider carrying a separate expected-file; but it doesn't look  
to me like there's adequate justification to accept such a maintenance  
burden.  Just change the test to use plain zero, instead.  

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

Fix oversight in getParamDescriptions(), and improve comments.

commit   : 2306696004dc6b9259a45e76522c01d6ee5d2ee7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Apr 2016 12:14:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Apr 2016 12:14:08 -0400    

Click here for diff

When getParamDescriptions was changed to handle out-of-memory better  
by cribbing error recovery logic from getRowDescriptions/getAnotherTuple,  
somebody omitted to copy the stanza about checking for excess data in  
the message.  But you need to do that, since continue'ing out of the  
switch in pqParseInput3 means no such check gets applied there anymore.  
Noted while looking at Michael Paquier's patch that made yet another  
copy of this advance_and_error logic.  
  
(This whole business desperately needs refactoring, because I sure don't  
want to see a dozen copies of this code, but that's where we seem to be  
headed.  What's more, the "suspend parsing on EOF return" convention is a  
holdover from protocol 2 and shouldn't exist at all in protocol 3, because  
we don't process partial messages anymore.  But for now, just fix the  
obvious bug.)  
  
Also, fix some wrong/missing comments about what the API spec is  
for these three functions.  
  
This doesn't seem worthy of back-patching, even though it's a bug;  
the case shouldn't ever arise in the field.  

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

Fix English in bloom module documentation

commit   : a361c22ebfa8c87683f07f83f55a8456e7892e6d    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 1 Apr 2016 18:47:44 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 1 Apr 2016 18:47:44 +0300    

Click here for diff

Author: Erik Rijkers  

M doc/src/sgml/bloom.sgml

Bloom index contrib module

commit   : 9ee014fc899a28a198492b074e32b60ed8915ea9    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 1 Apr 2016 16:42:24 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 1 Apr 2016 16:42:24 +0300    

Click here for diff

Module provides new access method. It is actually a simple Bloom filter  
implemented as pgsql's index. It could give some benefits on search  
with large number of columns.  
  
Module is a single way to test generic WAL interface committed earlier.  
  
Author: Teodor Sigaev, Alexander Korotkov  
Reviewers: Aleksander Alekseev, Michael Paquier, Jim Nasby  

M contrib/Makefile
A contrib/bloom/.gitignore
A contrib/bloom/Makefile
A contrib/bloom/blcost.c
A contrib/bloom/blinsert.c
A contrib/bloom/bloom–1.0.sql
A contrib/bloom/bloom.control
A contrib/bloom/bloom.h
A contrib/bloom/blscan.c
A contrib/bloom/blutils.c
A contrib/bloom/blvacuum.c
A contrib/bloom/blvalidate.c
A contrib/bloom/expected/bloom.out
A contrib/bloom/sql/bloom.sql
A contrib/bloom/t/001_wal.pl
A doc/src/sgml/bloom.sgml
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml

Fix typo in generic wal docs

commit   : 4e56e5a6de766a6983ce723b1945d68a4e098a06    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 1 Apr 2016 16:37:42 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 1 Apr 2016 16:37:42 +0300    

Click here for diff

Markus Nullmeier  

M doc/src/sgml/generic-wal.sgml

Add Generic WAL interface

commit   : 65578341af1ae50e52e0f45e691ce88ad5a1b9b1    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 1 Apr 2016 12:21:48 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 1 Apr 2016 12:21:48 +0300    

Click here for diff

This interface is designed to give an access to WAL for extensions which  
could implement new access method, for example. Previously it was  
impossible because restoring from custom WAL would need to access system  
catalog to find a redo custom function. This patch suggests generic way  
to describe changes on page with standart layout.  
  
Bump XLOG_PAGE_MAGIC because of new record type.  
  
Author: Alexander Korotkov with a help of Petr Jelinek, Markus Nullmeier and  
	minor editorization by my  
Reviewers: Petr Jelinek, Alvaro Herrera, Teodor Sigaev, Jim Nasby,  
	Michael Paquier  

M doc/src/sgml/filelist.sgml
A doc/src/sgml/generic-wal.sgml
M doc/src/sgml/postgres.sgml
M src/backend/access/rmgrdesc/Makefile
A src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/transam/Makefile
A src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/rmgr.c
M src/backend/replication/logical/decode.c
M src/bin/pg_xlogdump/.gitignore
M src/bin/pg_xlogdump/rmgrdesc.c
A src/include/access/generic_xlog.h
M src/include/access/rmgrlist.h
M src/include/access/xlog_internal.h

Another zic portability fix.

commit   : c202ecf9023ac3571709c274b326038ae39e90a7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 31 Mar 2016 16:14:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 31 Mar 2016 16:14:55 -0400    

Click here for diff

I should have remembered that we can't use INT64_MODIFIER with sscanf():  
configure chooses that to work with snprintf(), but it might be for our  
src/port/snprintf.c implementation and so not compatible with the  
platform's sscanf().  This appears to be the explanation for buildfarm  
member frogmouth's continuing unhappiness with the tzcode update.  
  
Fortunately, in all of the places where zic is attempting to read into  
an int64 variable, it's reading a year which certainly will fit just fine  
into an int.  So make it read into an int with %d, and then cast or copy  
as necessary.  

M src/timezone/zic.c

Fix recovery_min_apply_delay test

commit   : 61608d38361f911a741d4a7df63afe3c7221437e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 31 Mar 2016 15:41:18 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 31 Mar 2016 15:41:18 -0300    

Click here for diff

Previously this test was relying too much on WAL replay to occur in the  
exact configured interval, which was unreliable on slow or overly busy  
servers.  Use a custom loop instead of poll_query_until, which is  
hopefully more reliable.  
  
Per continued failures on buildfarm member hamster (which is probably  
the only one running this test suite)  
  
Author: Michaël Paquier  

M src/test/recovery/t/005_replay_delay.pl

Support using index-only scans with partial indexes in more cases.

commit   : f9aefcb91fc1f73fc43e384f660c120e515af931    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 31 Mar 2016 14:48:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 31 Mar 2016 14:48:56 -0400    

Click here for diff

Previously, the planner would reject an index-only scan if any restriction  
clause for its table used a column not available from the index, even  
if that restriction clause would later be dropped from the plan entirely  
because it's implied by the index's predicate.  This is a fairly common  
situation for partial indexes because predicates using columns not included  
in the index are often the most useful kind of predicate, and we have to  
duplicate (or at least imply) the predicate in the WHERE clause in order  
to get the index to be considered at all.  So index-only scans were  
essentially unavailable with such partial indexes.  
  
To fix, we have to do detection of implied-by-predicate clauses much  
earlier in the planner.  This patch puts it in check_index_predicates  
(nee check_partial_indexes), meaning it gets done for every partial index,  
whereas we previously only considered this issue at createplan time,  
so that the work was only done for an index actually selected for use.  
That could result in a noticeable planning slowdown for queries against  
tables with many partial indexes.  However, testing suggested that there  
isn't really a significant cost, especially not with reasonable numbers  
of partial indexes.  We do get a small additional benefit, which is that  
cost_index is more accurate since it correctly discounts the evaluation  
cost of clauses that will be removed.  We can also avoid considering such  
clauses as potential indexquals, which saves useless matching cycles in  
the case where the predicate columns aren't in the index, and prevents  
generating bogus plans that double-count the clause's selectivity when  
the columns are in the index.  
  
Tomas Vondra and Kyotaro Horiguchi, reviewed by Kevin Grittner and  
Konstantin Knizhnik, and whacked around a little by me  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/plancat.c
M src/include/nodes/relation.h
M src/include/optimizer/paths.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/select.out
M src/test/regress/sql/select.sql

Fix broken variable declaration

commit   : 3501f71c21e31b275b7816551b06a666d9c0c9c9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 30 Mar 2016 23:39:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 30 Mar 2016 23:39:15 -0300    

Click here for diff

Author: Konstantin Knizhnik  

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

Blind attempt at fixing Win32 issue on 24c5f1a103c

commit   : 3dd0792ae014c9ceb2c2ade43d0a3132cfeb4fc5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 30 Mar 2016 23:06:34 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 30 Mar 2016 23:06:34 -0300    

Click here for diff

As best as I can tell, MyReplicationSlot needs to be PGDLLIMPORT in  
order for the new test_slot_timelines test module to compile.  
  
Per buildfarm  

M src/include/replication/slot.h

Use proper format specifier %X/%X for LSN.

commit   : cee31f5fee950fed4159a4e093dab60b70ef215a    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 31 Mar 2016 11:03:40 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 31 Mar 2016 11:03:40 +0900    

Click here for diff

M src/backend/replication/syncrep.c

I forgot the alternate expected file in previous commit

commit   : 3a3b309041b0f30066f0b6cb6640563b6ea27cde    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 30 Mar 2016 20:46:01 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 30 Mar 2016 20:46:01 -0300    

Click here for diff

Without this, the test_slot_timelines modules fails "make installcheck"  
because the required feature is not enabled in a stock server.  
  
Per buildfarm  

A src/test/modules/test_slot_timelines/expected/load_extension_1.out

Enable logical slots to follow timeline switches

commit   : 24c5f1a103ce6656a5cb430d9a996c34e61ab2a5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 30 Mar 2016 20:07:05 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 30 Mar 2016 20:07:05 -0300    

Click here for diff

When decoding from a logical slot, it's necessary for xlog reading to be  
able to read xlog from historical (i.e. not current) timelines;  
otherwise, decoding fails after failover, because the archives are in  
the historical timeline.  This is required to make "failover logical  
slots" possible; it currently has no other use, although theoretically  
it could be used by an extension that creates a slot on a standby and  
continues to replay from the slot when the standby is promoted.  
  
This commit includes a module in src/test/modules with functions to  
manipulate the slots (which is not otherwise possible in SQL code) in  
order to enable testing, and a new test in src/test/recovery to ensure  
that the behavior is as expected.  
  
Author: Craig Ringer  
Reviewed-By: Oleksii Kliukin, Andres Freund, Petr Jelínek  

M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/logical/logicalfuncs.c
M src/include/access/xlogreader.h
M src/test/modules/Makefile
A src/test/modules/test_slot_timelines/.gitignore
A src/test/modules/test_slot_timelines/Makefile
A src/test/modules/test_slot_timelines/README
A src/test/modules/test_slot_timelines/expected/load_extension.out
A src/test/modules/test_slot_timelines/sql/load_extension.sql
A src/test/modules/test_slot_timelines/test_slot_timelines–1.0.sql
A src/test/modules/test_slot_timelines/test_slot_timelines.c
A src/test/modules/test_slot_timelines/test_slot_timelines.conf
A src/test/modules/test_slot_timelines/test_slot_timelines.control
M src/test/recovery/Makefile
A src/test/recovery/t/006_logical_decoding_timelines.pl

XLogReader general code cleanup

commit   : 3b02ea4f0780ccce7dc116010201dad7ee50a401    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 30 Mar 2016 18:56:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 30 Mar 2016 18:56:13 -0300    

Click here for diff

Some minor tweaks and comment additions, for cleanliness sake and to  
avoid having the upcoming timeline-following patch be polluted with  
unrelated cleanup.  
  
Extracted from a larger patch by Craig Ringer, reviewed by Andres  
Freund, with some additions by myself.  

M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/logical/logicalfuncs.c
M src/include/access/xlogreader.h
M src/include/access/xlogutils.h

Improve portability of I/O behavior for the geometric types.

commit   : 50861cd683e86d5ef2dc1cb669fb503225e4eb98    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Mar 2016 17:25:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Mar 2016 17:25:03 -0400    

Click here for diff

Formerly, the geometric I/O routines such as box_in and point_out relied  
directly on strtod() and sprintf() for conversion of the float8 component  
values of their data types.  However, the behavior of those functions is  
pretty platform-dependent, especially for edge-case values such as  
infinities and NaNs.  This was exposed by commit acdf2a8b372aec1d, which  
added test cases involving boxes with infinity endpoints, and immediately  
failed on Windows and AIX buildfarm members.  We solved these problems  
years ago in the main float8in and float8out functions, so let's fix it  
by making the geometric types use that code instead of depending directly  
on the platform-supplied functions.  
  
To do this, refactor the float8in code so that it can be used to parse  
just part of a string, and as a convenience make the guts of float8out  
usable without going through DirectFunctionCall.  
  
While at it, get rid of geo_ops.c's fairly shaky assumptions about the  
maximum output string length for a double, by having it build results in  
StringInfo buffers instead of fixed-length strings.  
  
In passing, convert all the "invalid input syntax for type foo" messages  
in this area of the code into "invalid input syntax for type %s" to reduce  
the number of distinct translatable strings, per recent discussion.  
We would have needed a fair number of the latter anyway for code-sharing  
reasons, so we might as well just go whole hog.  
  
Note: this patch is by no means intended to guarantee that the geometric  
types uniformly behave sanely for infinity or NaN component values.  
But any bugs we have in that line were there all along, they were just  
harder to reach in a platform-independent way.  

M src/backend/utils/adt/float.c
M src/backend/utils/adt/geo_ops.c
M src/include/utils/builtins.h
M src/test/regress/expected/box.out

Suppress uninitialized-variable warnings.

commit   : 818e59373625d194bdec89631b661c4355d15f13    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Mar 2016 13:36:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Mar 2016 13:36:18 -0400    

Click here for diff

My compiler doesn't like the lack of initialization of "flag", and  
I think it's right: if there were zero keys we'd have an undefined  
result.  The AND of zero items is TRUE, so initialize to TRUE.  

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

Bump catalog version, forget in acdf2a8b372aec1da09370fca77ff7dccac7646d

commit   : 2d02a856e8331329121ac2fa2c0b5dab0d106ca0    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 30 Mar 2016 18:56:21 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 30 Mar 2016 18:56:21 +0300    

Click here for diff

M src/include/catalog/catversion.h

Introduce SP-GiST operator class over box.

commit   : acdf2a8b372aec1da09370fca77ff7dccac7646d    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 30 Mar 2016 18:42:36 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 30 Mar 2016 18:42:36 +0300    

Click here for diff

Patch implements quad-tree over boxes, naive approach of 2D quad tree will not  
work for any non-point objects because splitting space on node is not  
efficient. The idea of pathc is treating 2D boxes as 4D points, so,  
object will not overlap (in 4D space).  
  
The performance tests reveal that this technique especially beneficial  
with too much overlapping objects, so called "spaghetti data".  
  
Author: Alexander Lebedev with editorization by Emre Hasegeli and me  

M doc/src/sgml/spgist.sgml
M src/backend/utils/adt/Makefile
A src/backend/utils/adt/geo_spgist.c
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_proc.h
M src/include/utils/geo_decls.h
M src/test/regress/expected/box.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/box.sql

Use traversalValue in SP-GiST range opclass.

commit   : 87545f541278ffde4fa1ccf396affbc4e9d59a23    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 30 Mar 2016 18:38:53 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 30 Mar 2016 18:38:53 +0300    

Click here for diff

Author: Alexander Lebedev  

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

Introduce traversalValue for SP-GiST scan

commit   : ccd6eb49a4ae924290ab7eba5540218f5beb48b8    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 30 Mar 2016 18:29:28 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 30 Mar 2016 18:29:28 +0300    

Click here for diff

During scan sometimes it would be very helpful to know some information about  
parent node or all 	ancestor nodes. Right now reconstructedValue could be used  
but it's not a right usage of it (range opclass uses that).  
  
traversalValue is arbitrary piece of memory in separate MemoryContext while  
reconstructedVale should have the same type as indexed column.  
  
Subsequent patches for range opclass and quad4d tree will use it.  
  
Author: Alexander Lebedev, Teodor Sigaev  

M doc/src/sgml/spgist.sgml
M src/backend/access/spgist/spgscan.c
M src/include/access/spgist.h

Add missing gss option to msvc config template

commit   : 3063e7a84026ced2aadd2262f75eebbe6240f85b    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 30 Mar 2016 10:49:44 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 30 Mar 2016 10:49:44 +0200    

Click here for diff

Michael Paquier  

M src/tools/msvc/config_default.pl

Remove just-added tests for to_timestamp(float8) with out-of-range inputs.

commit   : c53ab8a3af46029b72634ec0643e78661b252f62    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 22:23:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 22:23:32 -0400    

Click here for diff

Reporting the specific out-of-range input value produces platform-dependent  
results.  We could skip reporting the value, but that's contrary to our  
message style guidelines and unhelpful to users.  Or we could add a  
separate expected-output file for Windows, but that would be a substantial  
maintenance burden, and these test cases seem unlikely to be worth it.  
  
Per buildfarm.  

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

Remove TZ environment-variable entry from postgres reference page.

commit   : c3834ef9e8abaca54ae542eac960f96e9fecc9a8    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 21:38:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 21:38:14 -0400    

Click here for diff

The server hasn't paid attention to the TZ environment variable since  
commit ca4af308c32d03db, but that commit missed removing this documentation  
reference, as did commit d883b916a947a3c6 which added the reference where  
it now belongs (initdb).  
  
Back-patch to 9.2 where the behavior changed.  Also back-patch  
d883b916a947a3c6 as needed.  
  
Matthew Somerville  

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

Add new replication mode synchronous_commit = 'remote_apply'.

commit   : 314cbfc5da988eff8998655158f84c9815ecfbcd    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2016 21:16:12 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2016 21:16:12 -0400    

Click here for diff

In this mode, the master waits for the transaction to be applied on  
the remote side, not just written to disk.  That means that you can  
count on a transaction started on the standby to see all commits  
previously acknowledged by the master.  
  
To make this work, the standby sends a reply after replaying each  
commit record generated with synchronous_commit >= 'remote_apply'.  
This introduces a small inefficiency: the extra replies will be sent  
even by standbys that aren't the current synchronous standby.  But  
previously-existing synchronous_commit levels make no attempt at all  
to optimize which replies are sent based on what the primary cares  
about, so this is no worse, and at least avoids any extra replies for  
people not using the feature at all.  
  
Thomas Munro, reviewed by Michael Paquier and by me.  Some additional  
tweaks by me.  

M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/replication/README
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h

Fix interval_mul() to not produce insane results.

commit   : a898b409f66f956e99694710f537829db02652c0    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 17:21:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 17:21:12 -0400    

Click here for diff

interval_mul() attempts to prevent its calculations from producing silly  
results, but it forgot that zero times infinity yields NaN in IEEE  
arithmetic.  Hence, a case like '1 second'::interval * 'infinity'::float8  
produced a NaN for the months product, which didn't trigger the range  
check, resulting in bogus and possibly platform-dependent output.  
  
This isn't terribly obvious to the naked eye because if you try that  
exact case, you get "interval out of range" which is what you expect  
--- but if you look closer, the error is coming from interval_out not  
interval_mul.  interval_mul has allowed a bogus value into the system.  
  
Fix by adding isnan tests.  
  
Noted while testing Vitaly Burovoy's fix for infinity input to  
to_timestamp().  Given the lack of field complaints, I doubt this  
is worth a back-patch.  

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

Allow to_timestamp(float8) to convert float infinity to timestamp infinity.

commit   : e511d878f3bbc205cd260a79740e646eea3c1cd3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 17:09:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 17:09:21 -0400    

Click here for diff

With the original SQL-function implementation, such cases failed because  
we don't support infinite intervals.  Converting the function to C lets  
us bypass the interval representation, which should be a bit faster as  
well as more flexible.  
  
Vitaly Burovoy, reviewed by Anastasia Lubennikova  

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

Fix bug in aggregate (de)serialization commit.

commit   : 96f8373cad5d6066baeb7a1c5a88f6f5c9661974    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2016 15:21:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2016 15:21:57 -0400    

Click here for diff

resulttypeLen and resulttypeByVal must be set correctly when serializing  
aggregates, not just when finalizing them.  This was in David's final  
patch but I downloaded the wrong version by mistake and failed to spot  
the error.  
  
David Rowley  

M src/backend/executor/nodeAgg.c

Allow aggregate transition states to be serialized and deserialized.

commit   : 5fe5a2cee91117673e04617aeb1a38e305dcd783    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2016 15:04:05 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2016 15:04:05 -0400    

Click here for diff

This is necessary infrastructure for supporting parallel aggregation  
for aggregates whose transition type is "internal".  Such values  
can't be passed between cooperating processes, because they are  
just pointers.  
  
David Rowley, reviewed by Tomas Vondra and by me.  

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/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/tlist.c
M src/backend/parser/parse_agg.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/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/planmain.h
M src/include/parser/parse_agg.h

Improve pgbench docs regarding per-transaction logging.

commit   : 7f0a2c85fb221bae6908fb2fddad21a4c6d14438    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2016 14:07:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2016 14:07:55 -0400    

Click here for diff

The old documentation didn't know about the new -b flag, only about -f.  
  
Fabien Coelho  

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

Fix pgbench documentation error.

commit   : d797bf7da2cc954f7b5cd2776b65c6e91cd0cb04    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2016 13:46:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2016 13:46:57 -0400    

Click here for diff

The description of what the per-transaction log file says for skipped  
transactions is just plain wrong.  
  
Report and patch by Tomas Vondra, reviewed by Fabien Coelho and  
modified by me.  

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

pgbench: allow a script weight of zero

commit   : a1c935d3b71e44ba36530d47c3ccab6cc9b9eafe    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 29 Mar 2016 14:13:51 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 29 Mar 2016 14:13:51 -0300    

Click here for diff

This refines the previous weight range and allows a script to be "turned  
off" by passing a zero weight, which is useful when scripting multiple  
pgbench runs.  
  
I did not apply the suggested warning when a script uses zero weight; we  
use the principle elsewhere that if there's nothing to be done, do  
nothing quietly.  
  
Adjust docs accordingly.  
  
Author: Jeff Janes, Fabien Coelho  

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

pgbench: Remove \setrandom.

commit   : ad9566470b1ba63167d1dc7ae2cb52d88a448f76    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2016 12:08:49 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2016 12:08:49 -0400    

Click here for diff

You can now do the same thing via \set using the appropriate function,  
either random(), random_gaussian(), or random_exponential(), depending  
on the desired distribution.  This is not backward-compatible, but per  
discussion, it's worth it to avoid having the old syntax hang around  
forever.  
  
Fabien Coelho, reviewed by Michael Paquier, and adjusted by me.  

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

Avoid possibly-unsafe use of Windows' FormatMessage() function.

commit   : 7abc1571652a924ba4258bda0a26df2de03b790e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 11:54:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 11:54:57 -0400    

Click here for diff

Whenever this function is used with the FORMAT_MESSAGE_FROM_SYSTEM flag,  
it's good practice to include FORMAT_MESSAGE_IGNORE_INSERTS as well.  
Otherwise, if the message contains any %n insertion markers, the function  
will try to fetch argument strings to substitute --- which we are not  
passing, possibly leading to a crash.  This is exactly analogous to the  
rule about not giving printf() a format string you're not in control of.  
  
Noted and patched by Christian Ullrich.  
Back-patch to all supported branches.  

M src/backend/libpq/auth.c
M src/backend/port/win32/socket.c
M src/interfaces/libpq/fe-auth.c
M src/port/dirmod.c

Fix support of digits in email/hostnames.

commit   : 61d66c44f18c73094a50a2ef97d26cc03e171dc0    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 29 Mar 2016 17:59:58 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 29 Mar 2016 17:59:58 +0300    

Click here for diff

When tsearch was implemented I did several mistakes in hostname/email  
definition rules:  
1) allow underscore in hostname what prohibited by RFC  
2) forget to allow leading digits separated by hyphen (like 123-x.com)  
   in hostname  
3) do no allow underscore/hyphen after leading digits in localpart of email  
  
Artur's patch resolves two last issues, but by the way allows hosts name like  
123_x.com together with 123-x.com. RFC forbids underscore usage in hostname  
but pg allows that since initial tsearch version in core, although only  
for non-digits. Patch syncs support digits and nondigits in both hostname and  
email.  
  
Forbidding underscore in hostname may break existsing usage of tsearch and,  
anyhow, it should be done by separate patch.  
  
Author: Artur Zakirov  
BUG: #13964  

M src/backend/tsearch/wparser_def.c
M src/test/regress/expected/tsearch.out
M src/test/regress/sql/tsearch.sql

Rework custom scans to work more like the new extensible node stuff.

commit   : f9143d102ffd0947ca904c62b1d3d6fd587e0c80    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2016 11:00:18 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2016 11:00:18 -0400    

Click here for diff

Per discussion, the new extensible node framework is thought to be  
better designed than the custom path/scan/scanstate stuff we added  
in PostgreSQL 9.5.  Rework the latter to be more like the former.  
  
This is not backward-compatible, but we generally don't promise that  
for C APIs, and there probably aren't many people using this yet  
anyway.  
  
KaiGai Kohei, reviewed by Petr Jelinek and me.  Some further  
cosmetic changes by me.  

M src/backend/commands/explain.c
M src/backend/nodes/extensible.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/include/executor/nodeCustom.h
M src/include/nodes/execnodes.h
M src/include/nodes/extensible.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h

commit   : 534da37927f97ae7cb1b468963ba9bca747209ea    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 11:06:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 11:06:44 -0400    

Click here for diff

The IANA crew seem to think that symlink() exists everywhere nowadays,  
and they may well be right.  But we use #ifdef HAVE_SYMLINK elsewhere  
so for consistency we should do it here too.  Noted by Michael Paquier.  

M src/timezone/zic.c

Fix zic for Windows.

commit   : 6d257e732b358ee601a114fe3d1640a46317e554    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 10:40:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 10:40:08 -0400    

Click here for diff

The new coding of dolink() is dependent on link() returning an on-point  
errno when it fails; but the quick-hack implementation of link() that  
we'd put in for Windows didn't bother with setting errno.  Fix that.  
  
Analysis and patch by Christian Ullrich.  

M src/timezone/zic.c

Fix portability issues in 86c43f4e22c0771fd0cc6bce2799802c894ee2ec.

commit   : 656ee8489053aafc85324b9ef7e91b645674ffb9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 00:53:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Mar 2016 00:53:53 -0400    

Click here for diff

INT64_MIN/MAX should be spelled PG_INT64_MIN/MAX, per well established  
convention in our sources.  Less obviously, a symbol named DOUBLE causes  
problems on Windows builds, so rename that to DOUBLE_CONST; and rename  
INTEGER to INTEGER_CONST for consistency.  
  
Also, get rid of incorrect/obsolete hand-munging of yycolumn, and fix  
the grammar for float constants to handle expected cases such as ".1".  
  
First two items by Michael Paquier, second two by me.  

M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.c

Don't require a user mapping for FDWs to work.

commit   : 5d4171d1c70edfe3e9be1de9e66603af28e3afe1    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 28 Mar 2016 21:50:28 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 28 Mar 2016 21:50:28 -0400    

Click here for diff

Commit fbe5a3fb73102c2cfec11aaaa4a67943f4474383 accidentally changed  
this behavior; put things back the way they were, and add some  
regression tests.  
  
Report by Andres Freund; patch by Ashutosh Bapat, with a bit of  
kibitzing by me.  

M contrib/file_fdw/input/file_fdw.source
M contrib/file_fdw/output/file_fdw.source
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/foreign/foreign.c
M src/backend/optimizer/util/relnode.c
M src/include/foreign/foreign.h

On all Windows platforms, not just Cygwin, use _timezone and _tzname.

commit   : 868628e4fd44d75987d6c099ac63613cc5417629    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 28 Mar 2016 20:59:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 28 Mar 2016 20:59:25 -0400    

Click here for diff

Up until now, we've been using timezone and tzname, but Visual Studio  
2015 (for which we wish to add support) no longer declares those  
symbols.  All versions since Visual Studio 2003 apparently support the  
underscore-equipped names, and we don't support anything older than  
Visual Studio 2005, so this should work OK everywhere.  But let's see  
what the buildfarm thinks.  
  
Michael Paquier, reviewed by Petr Jelinek  

M src/include/port.h

Fix typo in comment.

commit   : bd0f206f5588767aac2456ebf6a21f7a6344cd58    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 28 Mar 2016 20:55:15 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 28 Mar 2016 20:55:15 -0400    

Click here for diff

Thomas Munro  

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

pgbench: Support double constants and functions.

commit   : 86c43f4e22c0771fd0cc6bce2799802c894ee2ec    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 28 Mar 2016 20:45:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 28 Mar 2016 20:45:57 -0400    

Click here for diff

The new functions are pi(), random(), random_exponential(),  
random_gaussian(), and sqrt().  I was worried that this would be  
slower than before, but, if anything, it actually turns out to be  
slightly faster, because we now express the built-in pgbench scripts  
using fewer lines; each \setrandom can be merged into a subsequent  
\set.  
  
Fabien Coelho  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h

PostgresNode: initialize $timed_out if passed

commit   : 9bd61311bd48ea53b18bfecb9adddfd844acbffa    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2016 19:17:06 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2016 19:17:06 -0300    

Click here for diff

Corrects an oversight in 2c83f435a3 where the $timed_out reference var  
isn't initialized; using it would require the caller to initialize it  
beforehand, which is cumbersome.  
  
Author: Craig Ringer  

M src/test/perl/PostgresNode.pm

Mention BRIN as able to do multi-column indexes

commit   : 80b986cf528c912f4efc2b0e9f03611f0f15f4df    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2016 19:11:12 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2016 19:11:12 -0300    

Click here for diff

Documentation mentioned B-tree, GiST and GIN as able to do multicolumn  
indexes; I failed to add BRIN to the list.  
  
Author: Petr Jediný  
Reviewed-By: Fujii Masao, Emre Hasegeli  

M doc/src/sgml/indices.sgml

Sync tzload() and tzparse() APIs with IANA release tzcode2016c.

commit   : 1f4e9da624a0caf78bcb526f6b05f5993e26f2c7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2016 17:19:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2016 17:19:29 -0400    

Click here for diff

This brings us a bit closer to matching upstream, but since it affects  
files outside src/timezone/, we might choose not to back-patch it.  
Hence keep it separate from the main update patch.  

M src/bin/initdb/findtimezone.c
M src/timezone/localtime.c
M src/timezone/pgtz.c
M src/timezone/pgtz.h

Fix MSVC build for changes in zic.

commit   : f5f15ea6aad1b75c1c133a914cf29f9831089a6e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2016 16:02:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2016 16:02:07 -0400    

Click here for diff

zic now only needs zic.c, but I didn't realize knowledge about it was  
hardwired into Mkvcbuild.pm.  Per buildfarm.  

M src/tools/msvc/Mkvcbuild.pm

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

commit   : 1c1a7cbd6a1600c97dfcd9b5dc78a23b5db9bbf6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2016 15:10:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2016 15:10:17 -0400    

Click here for diff

We hadn't done this in about six years, which proves to have been a mistake  
because there's been a lot of code churn upstream, making the merge rather  
painful.  But putting it off any further isn't going to lessen the pain,  
and there are at least two incompatible changes that we need to absorb  
before someone starts complaining that --with-system-tzdata doesn't work  
at all on their platform, or we get blindsided by a tzdata release that  
our out-of-date zic can't compile.  Last week's "time zone abbreviation  
differs from POSIX standard" mess was a wake-up call in that regard.  
  
This is a sufficiently large patch that I'm afraid to back-patch it  
immediately, though the foregoing considerations imply that we probably  
should do so eventually.  For the moment, just put it in HEAD so that  
it can get some testing.  Maybe we can wait till the end of the 9.6  
beta cycle before deeming it okay.  

M src/timezone/Makefile
M src/timezone/README
D src/timezone/ialloc.c
M src/timezone/localtime.c
M src/timezone/pgtz.c
M src/timezone/pgtz.h
M src/timezone/private.h
D src/timezone/scheck.c
M src/timezone/strftime.c
M src/timezone/tzfile.h
M src/timezone/zic.c

Document errhidecontext() where it ought to be documented.

commit   : e5a4dea80f2506a7a565508e48aaa52296ff410a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2016 14:18:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2016 14:18:00 -0400    

Click here for diff

Seems to have been missed when this function was added.  Noted while  
looking at David Steele's proposal to add another similar function.  

M doc/src/sgml/sources.sgml
M src/backend/utils/error/elog.c

Update expected file from quoting change

commit   : 4b746f0d07c762cf4b421b59a14dfd053eda1761    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2016 14:40:32 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2016 14:40:32 -0300    

Click here for diff

I neglected to update this in 59a2111b23f.  
  
Per buildfarm  

M src/test/regress/expected/event_trigger.out

pg_rewind: Improve internationalization

commit   : cad3edef4f51c37c4b4d8667a2e76a81ca53f9e7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2016 14:33:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2016 14:33:00 -0300    

Click here for diff

This is mostly cosmetic since two of the three changes are debug  
messages, and the third one is just a progress indicator.  
  
Author: Michaël Paquier  

M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/pg_rewind.c

Fix minor leak in pg_dump for ACCESS METHOD.

commit   : 37732a2555f109b09b7eedfc44a9de22e22268a4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2016 14:27:41 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2016 14:27:41 -0300    

Click here for diff

Bug reported by Coverity.  
  
Author: Michaël Paquier  

M src/bin/pg_dump/pg_dump.c

Improve internationalization of messages involving type names

commit   : 59a2111b23f6ceec4c777d68e20c1027d3c57c6f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2016 14:12:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2016 14:12:00 -0300    

Click here for diff

Change the slightly different variations of the message  
  function FOO must return type BAR  
to a single wording, removing the variability in type name so that they  
all create a single translation entry; since the type name is not to be  
translated, there's no point in it being part of the message anyway.  
  
Also, change them all to use the same quoting convention, namely that  
the function name is not to be quoted but the type name is.  (I'm not  
quite sure why this is so, but it's the clear majority.)  
  
Some similar messages such as "encoding conversion function FOO must ..."  
are also changed.  

M src/backend/commands/conversioncmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/proclang.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/parser/parse_clause.c

psql tab-complete for CREATE/DROP ACCESS METHOD

commit   : 559e7a0a6d4450c09825055e3d255d30ee869c67    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 28 Mar 2016 19:32:13 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 28 Mar 2016 19:32:13 +0300    

Click here for diff

Alexander Korotkov  

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

Fix comment in pg_dump.

commit   : dabd255d584785c61b1187f10b7bdbf99022ae2d    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 28 Mar 2016 19:17:28 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 28 Mar 2016 19:17:28 +0300    

Click here for diff

It was missed in 473b93287040b20017cc25a157cffdc5b978c254,  
CREATE ACCESS METHOD  
  
Alexander Korotkov  

M src/bin/pg_dump/pg_dump.c

Last-minute updates for release notes.

commit   : 4c46f83386a7e3556856d1e4c9f0c294d16b0dcc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2016 11:32:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2016 11:32:17 -0400    

Click here for diff

Security: CVE-2016-2193, CVE-2016-3065  

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

Add missing checks to some of pageinspect's BRIN functions

commit   : 3e1338475ffc2eac25de60a9de9ce689b763aced    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2016 10:57:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2016 10:57:42 -0300    

Click here for diff

brin_page_type() and brin_metapage_info() did not enforce being called  
by superuser, like other pageinspect functions that take bytea do.  
Since they don't verify the passed page thoroughly, it is possible to  
use them to read the server memory with a carefully crafted bytea value,  
up to a file kilobytes from where the input bytea is located.  
  
Have them throw errors if called by a non-superuser.  
  
Report and initial patch: Andreas Seltenreich  
  
Security: CVE-2016-3065  

M contrib/pageinspect/brinfuncs.c

Reset plan->row_security_env and planUserId

commit   : 86ebf30fd6d8964bbd5d48db053b0a7ff709a0d7    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 28 Mar 2016 09:03:20 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 28 Mar 2016 09:03:20 -0400    

Click here for diff

In the plancache, we check if the environment we planned the query under  
has changed in a way which requires us to re-plan, such as when the user  
for whom the plan was prepared changes and RLS is being used (and,  
therefore, there may be different policies to apply).  
  
Unfortunately, while those values were set and checked, they were not  
being reset when the query was re-planned and therefore, in cases where  
we change role, re-plan, and then change role again, we weren't  
re-planning again.  This leads to potentially incorrect policies being  
applied in cases where role-specific policies are used and a given query  
is planned under one role and then executed under other roles, which  
could happen under security definer functions or when a common user and  
query is planned initially and then re-used across multiple SET ROLEs.  
  
Further, extensions which made use of CopyCachedPlan() may suffer from  
similar issues as the RLS-related fields were not properly copied as  
part of the plan and therefore RevalidateCachedQuery() would copy in the  
current settings without invalidating the query.  
  
Fix by using the same approach used for 'search_path', where we set the  
correct values in CompleteCachedPlan(), check them early on in  
RevalidateCachedQuery() and then properly reset them if re-planning.  
Also, copy through the values during CopyCachedPlan().  
  
Pointed out by Ashutosh Bapat.  Reviewed by Michael Paquier.  
  
Back-patch to 9.5 where RLS was introduced.  
  
Security: CVE-2016-2193  

M src/backend/utils/cache/plancache.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Code and docs review for commit 3187d6de0e5a9e805b27c48437897e8c39071d45.

commit   : d12e5bb79bb535c2df13b76cd7d01f0bb8dc8e4d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2016 01:00:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2016 01:00:30 -0400    

Click here for diff

Fix up check for high-bit-set characters, which provoked "comparison is  
always true due to limited range of data type" warnings on some compilers,  
and was unlike the way we do it elsewhere anyway.  Fix omission of "$"  
from the set of valid identifier continuation characters.  Get rid of  
sanitize_text(), which was utterly inconsistent with any other error report  
anywhere in the system, and wasn't even well designed on its own terms  
(double-quoting the result string without escaping contained double quotes  
doesn't seem very well thought out).  Fix up error messages, which didn't  
follow the message style guidelines very well, and were overly specific in  
situations where the actual mistake might not be what they said.  Improve  
documentation.  
  
(I started out just intending to fix the compiler warning, but the more  
I looked at the patch the less I liked it.)  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/misc.c
M src/test/regress/expected/name.out

Release notes for 9.5.2, 9.4.7, 9.3.12, 9.2.16, 9.1.21.

commit   : 499a50571c72f41bb1365970d55dae5c8afcb6ba    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 27 Mar 2016 19:26:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 27 Mar 2016 19:26:26 -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

Guard against zero vardata.rel->tuples in estimate_hash_bucketsize().

commit   : d65b665d524a67273b075f468bf3d60ce31f4040    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 27 Mar 2016 18:21:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 27 Mar 2016 18:21:03 -0400    

Click here for diff

If the referenced rel was proven empty, we'd compute 0/0 here, which  
results in the function returning NaN.  That's a bit more serious  
than the other zero-divide case.  Still, it only seems to be possible  
in HEAD, so no back-patch.  
  
Per report from Piotr Stefaniak.  I looked through the rest of selfuncs.c  
and found no other likely trouble spots.  

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

Clamp adjusted ndistinct to positive integer in estimate_hash_bucketsize().

commit   : fa09f8935156533584b4e215bdf70ec1ff968dad    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 27 Mar 2016 18:06:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 27 Mar 2016 18:06:53 -0400    

Click here for diff

This avoids a possible divide-by-zero in the following calculation,  
and rounding the number to an integer seems like saner behavior anyway.  
Assuming IEEE math, the division would yield +Infinity which would get  
replaced by 1.0 at the bottom of the function, so nothing really  
interesting would ensue; but avoiding divide-by-zero seems like a  
good idea on general principles.  
  
Per report from Piotr Stefaniak.  No back-patch since this seems  
mostly cosmetic.  

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

pg_rewind: fsync target data directory.

commit   : 408f0438531eec17ac62f91fc23f72bcfc48dd36    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2016 23:46:25 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2016 23:46:25 +0200    

Click here for diff

Previously pg_rewind did not fsync any files. That's problematic, given  
that the target directory is modified. If the database was started  
afterwards, 2ce439f33 luckily already caused the data directory to be  
synced to disk at postmaster startup; reducing the scope of the problem.  
  
To fix, use initdb -S, at the end of the pg_rewind run. It doesn't seem  
worthwhile to duplicate the code into pg_rewind, and initdb -S is  
already used that way by pg_upgrade.  
  
Reported-By: Andres Freund  
Author: Michael Paquier, somewhat edited by me  
Discussion: [email protected]  
    CAB7nPqSytVG1o4S3S2pA1O=692ekurJ+fckW2PywEG3sNw54Ow@mail.gmail.com  
Backpatch: 9.5, where pg_rewind was introduced  

M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/pg_rewind.c

Fix LWLockReportWaitEnd() parameter list to be (void).

commit   : 9f7c527af308dcdaba2f0ff9d362d672e8886fb1    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2016 22:53:31 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2016 22:53:31 +0200    

Click here for diff

Previously it was an "old style" function declaration.  

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

pg_rewind: Close backup_label file descriptor.

commit   : a6c845946dac5c1f26cf8729cf61f1d852f75484    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2016 22:48:31 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2016 22:48:31 +0200    

Click here for diff

This was a relatively harmless leak, as createBackupLabel() is only  
called once per pg_rewind invocation.  
  
Author: Michael Paquier  
Reported-By: Michael Paquier  
Discussion: CAB7nPqRnOw30gOXe2_SPLjh37bgm4V+txbYAPwoXb97nGQ297w@mail.gmail.com  
Backpatch: 9.5, where pg_rewind was introduced  

M src/bin/pg_rewind/pg_rewind.c

Don't use !! but != 0/NULL to force boolean evaluation.

commit   : 1a7a43672bf2939dda93a27d498349e7a4aa3c14    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2016 17:17:00 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2016 17:17:00 +0200    

Click here for diff

I introduced several uses of !! to force bit arithmetic to be boolean,  
but per discussion the project prefers != 0/NULL.  
  
Discussion: CA+TgmoZP5KakLGP6B4vUjgMBUW0woq_dJYi0paOz-My0Hwt_vQ@mail.gmail.com  

M contrib/sepgsql/uavc.c
M src/backend/access/transam/xact.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/lmgr/lwlock.c
M src/include/access/xact.h

Change various Gin*Is* macros to return 0/1.

commit   : af4472bcb88ab36b9abbe7fd5858e570a65a2d1a    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2016 16:59:58 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2016 16:59:58 +0200    

Click here for diff

Returning the direct result of bit arithmetic, in a macro intended to be  
used in a boolean manner, can be problematic if the return value is  
stored in a variable of type 'bool'. If bool is implemented using C99's  
_Bool, that can lead to comparison failures if the variable is then  
compared again with the expression (see ginStepRight() for an example  
that fails), as _Bool forces the result to be 0/1. That happens in some  
configurations of newer MSVC compilers.  It's also problematic when  
storing the result of such an expression in a narrower type.  
  
Several gin macros have been declared in that style since gin's initial  
commit in 8a3631f8d86.  
  
There's a lot more macros like this, but this is the only one causing  
regression test failures; and I don't want to commit and backpatch a  
larger patch with lots of conflicts just before the next set of minor  
releases.  
  
Discussion: [email protected]  
Backpatch: All supported branches  

M src/include/access/gin_private.h

First-draft release notes for 9.5.2.

commit   : 29b6123ecb4113e366325245cec5a5c221dae691    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Mar 2016 19:27:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Mar 2016 19:27:58 -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

Modernize zic's test for valid timezone abbreviations.

commit   : 221619ad69b7e060041796a1974fbb0eeb9542d7    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Mar 2016 15:58:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Mar 2016 15:58:44 -0400    

Click here for diff

We really need to sync all of our IANA-derived timezone code with upstream,  
but that's going to be a large patch and I certainly don't care to shove  
such a thing into stable branches immediately before a release.  As a  
stopgap, copy just the tzcode2016c logic that checks validity of timezone  
abbreviations.  This prevents getting multiple "time zone abbreviation  
differs from POSIX standard" bleats with tzdata 2014b and later.  

M src/timezone/zic.c

Avoid a couple of zero-divide scenarios in the planner.

commit   : 76281aa9647e6a5dfc646514554d0f519e3b8a58    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Mar 2016 12:03:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Mar 2016 12:03:12 -0400    

Click here for diff

cost_subplan() supposed that the given subplan must have plan_rows > 0,  
which as far as I can tell was true until recent refactoring of the  
code in createplan.c; but now that code allows the Result for a provably  
empty subquery to have plan_rows = 0.  Rather than undo that change,  
put in a clamp to prevent zero divide.  
  
get_cheapest_fractional_path() likewise supposed that best_path->rows > 0.  
This assumption has been wrong for longer.  It's actually harmless given  
IEEE float math, because a positive value divided by zero gives +Infinity  
and compare_fractional_path_costs() will do the right thing with that.  
Still, best not to assume that.  
  
final_cost_nestloop() also seems to have some risks in this area, so  
borrow the clamping logic already present in the mergejoin cost functions.  
  
Lastly, remove unnecessary clamp_row_est() in planner.c's calls to  
get_number_of_groups().  The only thing that function does with path_rows  
is pass it to estimate_num_groups() which already has an internal clamp,  
so we don't need the extra call; and if we did, the callers are arguably  
the wrong place for it anyway.  
  
First two items reported by Piotr Stefaniak, the others are products  
of my nosing around for similar problems.  No back-patch since there's  
no evidence that problems arise in the back branches.  

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

Update time zone data files to tzdata release 2016c.

commit   : 676265eb7b57ba5bfae859630b909e6045893b68    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Mar 2016 19:03:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Mar 2016 19:03:08 -0400    

Click here for diff

DST law changes in Azerbaijan, Chile, Haiti, Palestine, and Russia (Altai,  
Astrakhan, Kirov, Sakhalin, Ulyanovsk regions).  Historical corrections  
for Lithuania, Moldova, Russia (Kaliningrad, Samara, Volgograd).  
  
As of 2015b, the keepers of the IANA timezone database started to use  
numeric time zone abbreviations (e.g., "+04") instead of inventing  
abbreviations not found in the wild like "ASTT".  This causes our rather  
old copy of zic to whine "warning: time zone abbreviation differs from  
POSIX standard" several times during "make install".  This warning is  
harmless according to the IANA folk, and I don't see any problems with  
these abbreviations in some simple tests; but it seems like now would be  
a good time to update our copy of the tzcode stuff.  I'll look into that  
soon.  

M src/timezone/data/asia
M src/timezone/data/australasia
M src/timezone/data/europe
M src/timezone/data/iso3166.tab
M src/timezone/data/leapseconds
M src/timezone/data/northamerica
M src/timezone/data/southamerica
M src/timezone/data/zone.tab
M src/timezone/data/zone1970.tab
M src/timezone/known_abbrevs.txt
M src/timezone/tznames/America.txt
M src/timezone/tznames/Antarctica.txt
M src/timezone/tznames/Asia.txt
M src/timezone/tznames/Default
M src/timezone/tznames/Pacific.txt

Fix PL/Tcl for vpath builds.

commit   : 9f73a2f6d1c1305cf0dc749dbf631cffe26beda0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Mar 2016 17:13:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Mar 2016 17:13:03 -0400    

Click here for diff

Commit cd37bb78599dcf24 works for in-tree builds, but not so much for  
VPATH.  Per buildfarm.  

M src/pl/tcl/Makefile

Improve PL/Tcl errorCode facility by providing decoded name for SQLSTATE.

commit   : cd37bb78599dcf24cd22a124ce9174b5e2a76880    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Mar 2016 16:54:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Mar 2016 16:54:52 -0400    

Click here for diff

We don't really want to encourage people to write numeric SQLSTATEs in  
programs; that's unreadable and error-prone.  Copy plpgsql's infrastructure  
for converting between SQLSTATEs and exception names shown in Appendix A,  
and modify examples in tests and documentation to do it that way.  

M doc/src/sgml/pltcl.sgml
M src/backend/utils/errcodes.txt
M src/pl/tcl/.gitignore
M src/pl/tcl/Makefile
M src/pl/tcl/expected/pltcl_setup.out
A src/pl/tcl/generate-pltclerrcodes.pl
M src/pl/tcl/pltcl.c
M src/pl/tcl/sql/pltcl_setup.sql
M src/tools/msvc/Solution.pm

In PL/Tcl, make database errors return additional info in the errorCode.

commit   : fb8d2a7f57d87102f0a95025fbf1cad9c341739b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Mar 2016 15:52:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Mar 2016 15:52:53 -0400    

Click here for diff

Tcl has a convention for returning additional info about an error in a  
global variable named errorCode.  Up to now PL/Tcl has ignored that,  
but this patch causes database errors caught by PL/Tcl to fill in  
errorCode with useful information from the ErrorData struct.  
  
Jim Nasby, reviewed by Pavel Stehule and myself  

M doc/src/sgml/pltcl.sgml
M src/pl/tcl/expected/pltcl_setup.out
M src/pl/tcl/pltcl.c
M src/pl/tcl/sql/pltcl_setup.sql

commit   : c94959d4110a1965472956cfd631082a96f64a84    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Mar 2016 12:33:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Mar 2016 12:33:16 -0400    

Click here for diff

This avoids leaving dangling links in pg_operator; which while fairly  
harmless are also unsightly.  
  
While we're at it, simplify OperatorUpd, which went through  
heap_modify_tuple for no very good reason considering it had already made  
a tuple copy it could just scribble on.  
  
Roma Sokolov, reviewed by Tomas Vondra, additional hacking by Robert Haas  
and myself.  

M src/backend/catalog/pg_operator.c
M src/backend/commands/operatorcmds.c
M src/include/catalog/pg_operator_fn.h
A src/test/regress/expected/drop_operator.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/drop_operator.sql

Don't split up SRFs when choosing to postpone SELECT output expressions.

commit   : d543170f2fdd6d9845aaf91dc0f6be7a2bf0d9e7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Mar 2016 11:19:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Mar 2016 11:19:51 -0400    

Click here for diff

In commit 9118d03a8cca3d97 we taught the planner to postpone evaluation of  
set-returning functions in a SELECT's targetlist until after any sort done  
to satisfy ORDER BY.  However, if we postpone some SRFs this way while  
others do not get postponed (because they're sort or group key columns)  
we will break the traditional behavior by which all SRFs in the tlist run  
in-step during ExecTargetList(), so that you get the least common multiple  
of their periods not the product.  Fix make_sort_input_target() so it will  
not split up SRF evaluation in such cases.  
  
There is still a hazard of similar odd behavior if there's a SRF in a  
grouping column and another one that isn't, but that was true before  
and we're just trying to preserve bug-compatibility with the traditional  
behavior.  This whole area is overdue to be rethought and reimplemented,  
but we'll try to avoid changing behavior until then.  
  
Per report from Regina Obe.  

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

commit   : 7caaeaf3607fae91318f24debce3dc017ca299a3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2016 20:45:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2016 20:45:31 -0400    

Click here for diff

Some of the non-MSVC Windows buildfarm members seem to need this to avoid  
getting "undefined symbol" errors on libpgfeutils' references to libpq.  
I could understand that if libpq were a static library, but surely it is  
not?  Oh well, at least the extra reference is no more harmful than it is  
for libpgcommon or libpgport.  

M src/bin/pg_dump/Makefile
M src/bin/pgbench/Makefile
M src/bin/psql/Makefile
M src/bin/scripts/Makefile

Move psql's psqlscan.l into src/fe_utils.

commit   : c1156411ad0879a71956b64aa487babe7572685b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2016 20:28:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2016 20:28:47 -0400    

Click here for diff

This completes (at least for now) the project of getting rid of ad-hoc  
linkages among the src/bin/ subdirectories.  Everything they share is now  
in src/fe_utils/ and is included from a static library at link time.  
  
A side benefit is that we can restore the FLEX_NO_BACKUP check for  
psqlscanslash.l.  We might need to think of another way to do that check  
if we ever need to build two lexers with that property in the same source  
directory, but there's no foreseeable reason to need that.  

M src/backend/parser/scan.l
M src/bin/pgbench/Makefile
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.h
M src/bin/psql/.gitignore
M src/bin/psql/Makefile
M src/bin/psql/command.h
M src/bin/psql/mainloop.c
M src/bin/psql/mainloop.h
M src/bin/psql/nls.mk
M src/bin/psql/prompt.h
M src/bin/psql/psqlscanslash.h
M src/bin/psql/psqlscanslash.l
A src/fe_utils/.gitignore
M src/fe_utils/Makefile
R097 src/bin/psql/psqlscan.l src/fe_utils/psqlscan.l
R064 src/bin/psql/psqlscan.h src/include/fe_utils/psqlscan.h
R085 src/bin/psql/psqlscan_int.h src/include/fe_utils/psqlscan_int.h
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/clean.bat

Move psql's print.c and mbprint.c into src/fe_utils.

commit   : d65bea26a867e3bbd053bf87b985b0e113256414    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2016 18:27:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2016 18:27:28 -0400    

Click here for diff

Just turning the crank ...  

M src/bin/psql/Makefile
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/describe.c
D src/bin/psql/mbprint.h
M src/bin/psql/nls.mk
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/scripts/.gitignore
M src/bin/scripts/Makefile
M src/bin/scripts/createlang.c
M src/bin/scripts/droplang.c
M src/bin/scripts/nls.mk
M src/fe_utils/Makefile
R093 src/bin/psql/mbprint.c src/fe_utils/mbprint.c
R098 src/bin/psql/print.c src/fe_utils/print.c
A src/include/fe_utils/mbprint.h
R093 src/bin/psql/print.h src/include/fe_utils/print.h
M src/tools/msvc/Mkvcbuild.pm

Suppress compiler warning for get_am_type_string().

commit   : a376960c8f8ec08783e1c529f36fbeb60236b378    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2016 17:22:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2016 17:22:24 -0400    

Click here for diff

Compilers that don't know that elog(ERROR) doesn't return complained  
that this function might fail to return a value.  Per buildfarm.  
  
While at it, const-ify the function's declaration, since the intent  
is evidently to always return a constant string.  

M src/backend/commands/amcmds.c

Add missed inclusion requirement in Mkvcbuild.pm.

commit   : 0ecd3fedfcf3427ebeb73cc61b2fcf6ed67c43a2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2016 17:12:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2016 17:12:40 -0400    

Click here for diff

Per buildfarm.  

M src/tools/msvc/Mkvcbuild.pm

Create src/fe_utils/, and move stuff into there from pg_dump's dumputils.

commit   : 588d963b00e5e4385b6425418e3faa726f63f72e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2016 15:55:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2016 15:55:44 -0400    

Click here for diff

Per discussion, we want to create a static library and put the stuff into  
it that until now has been shared across src/bin/ directories by ad-hoc  
methods like symlinking a source file.  This commit creates the library and  
populates it with a couple of files that contain the widely-useful portions  
of pg_dump's dumputils.c file.  dumputils.c survives, because it has some  
stuff that didn't seem appropriate for fe_utils, but it's significantly  
smaller and is no longer referenced from any other directory.  
  
Follow-on patches will move more stuff into fe_utils.  
  
The Mkvcbuild.pm hacking here is just a best guess; we'll see how the  
buildfarm likes it.  

M src/Makefile
M src/Makefile.global.in
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/common.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_null.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dumpall.c
M src/bin/psql/.gitignore
M src/bin/psql/Makefile
M src/bin/psql/command.c
M src/bin/psql/copy.c
M src/bin/psql/describe.c
M src/bin/scripts/.gitignore
M src/bin/scripts/Makefile
M src/bin/scripts/clusterdb.c
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
A src/fe_utils/Makefile
A src/fe_utils/simple_list.c
A src/fe_utils/string_utils.c
M src/include/Makefile
A src/include/fe_utils/simple_list.h
A src/include/fe_utils/string_utils.h
M src/tools/msvc/Mkvcbuild.pm

Improve documentation for combine functions.

commit   : a596db332b8c7f593a82af86f69353ba08f6214c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 24 Mar 2016 12:59:18 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 24 Mar 2016 12:59:18 -0400    

Click here for diff

David Rowley  

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

Use correct GetDatum function.

commit   : 59a02815e2d11e5a7b4848897c763175b6b42f8a    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 24 Mar 2016 08:57:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 24 Mar 2016 08:57:48 -0400    

Click here for diff

Oops.  

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

Avoid PGDLLIMPORT for simple local references in frontend programs.

commit   : c2d1eea9e750edb267e3f071a129e03d79ad198b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Mar 2016 23:26:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Mar 2016 23:26:44 -0400    

Click here for diff

I was wondering if this would be an issue, and buildfarm member frogmouth  
says it is.  

M src/include/common/keywords.h

Support CREATE ACCESS METHOD

commit   : 473b93287040b20017cc25a157cffdc5b978c254    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 23 Mar 2016 23:01:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 23 Mar 2016 23:01:35 -0300    

Click here for diff

This enables external code to create access methods.  This is useful so  
that extensions can add their own access methods which can be formally  
tracked for dependencies, so that DROP operates correctly.  Also, having  
explicit support makes pg_dump work correctly.  
  
Currently only index AMs are supported, but we expect different types to  
be added in the future.  
  
Authors: Alexander Korotkov, Petr Jelínek  
Reviewed-By: Teodor Sigaev, Petr Jelínek, Jim Nasby  
Commitfest-URL: https://commitfest.postgresql.org/9/353/  
Discussion: https://www.postgresql.org/message-id/CAPpHfdsXwZmojm6Dx+TJnpYk27kT4o7Ri6X_4OSWcByu1Rm+VA@mail.gmail.com  

M doc/src/sgml/indexam.sgml
M doc/src/sgml/ref/allfiles.sgml
A doc/src/sgml/ref/create_access_method.sgml
A doc/src/sgml/ref/drop_access_method.sgml
M doc/src/sgml/reference.sgml
M src/backend/access/index/amapi.c
M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/Makefile
A src/backend/commands/amcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/opclasscmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/selfuncs.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/pg_am.h
M src/include/commands/defrem.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/utils/selfuncs.h
A src/test/regress/expected/create_am.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/create_am.sql
M src/test/regress/sql/object_address.sql

Move keywords.c/kwlookup.c into src/common/.

commit   : 2c6af4f44228d76d3351fe26f68b00b55cdd239a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Mar 2016 20:22:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Mar 2016 20:22:08 -0400    

Click here for diff

Now that we have src/common/ for code shared between frontend and backend,  
we can get rid of (most of) the klugy ways that the keyword table and  
keyword lookup code were formerly shared between different uses.  
This is a first step towards a more general plan of getting rid of  
special-purpose kluges for sharing code in src/bin/.  
  
I chose to merge kwlookup.c back into keywords.c, as it once was, and  
always has been so far as keywords.h is concerned.  We could have  
kept them separate, but there is noplace that uses ScanKeywordLookup  
without also wanting access to the backend's keyword list, so there  
seems little point.  
  
ecpg is still a bit weird, but at least now the trickiness is documented.  
  
I think that the MSVC build script should require no adjustments beyond  
what's done here ... but we'll soon find out.  

M src/backend/parser/Makefile
M src/backend/parser/README
D src/backend/parser/keywords.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/ruleutils.c
M src/bin/pg_dump/.gitignore
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/dumputils.c
D src/bin/pg_dump/keywords.c
M src/bin/psql/.gitignore
M src/bin/psql/Makefile
M src/bin/scripts/.gitignore
M src/bin/scripts/Makefile
M src/common/Makefile
R073 src/backend/parser/kwlookup.c src/common/keywords.c
R096 src/include/parser/keywords.h src/include/common/keywords.h
M src/include/parser/gramparse.h
M src/include/parser/scanner.h
M src/interfaces/ecpg/preproc/.gitignore
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/extern.h
M src/interfaces/ecpg/preproc/keywords.c
M src/tools/msvc/Mkvcbuild.pm

Disable abbreviated keys for string-sorting in non-C locales.

commit   : 3df9c374e279db37b00cd9c86219471d0cdaa97c    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 23 Mar 2016 15:58:34 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 23 Mar 2016 15:58:34 -0400    

Click here for diff

Unfortunately, every version of glibc thus far tested has bugs whereby  
strcoll() ordering does not match strxfrm() ordering as required by  
the standard.  This can result in, for example, corrupted indexes.  
Disabling abbreviated keys in these cases slows down non-C-collation  
string sorting considerably, but there seems to be no practical  
alternative.  Users who are confident that their libc implementations  
are solid in this regard can re-enable the optimization by compiling  
with TRUST_STRXFRM.  
  
Users who have built indexes using PostgreSQL 9.5 or PostgreSQL 9.5.1  
should REINDEX if there is a possibility that they may have been  
affected by this problem.  
  
Report by Marc-Olaf Jaschke.  Investigation mostly by Tom Lane, with  
help from Peter Geoghegan, Noah Misch, Stephen Frost, and me.  Patch  
by me, reviewed by Peter Geoghegan and Tom Lane.  

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

postgres_fdw: Fix crash when pushing down multiple joins.

commit   : 3151f16e1874db82ed85a005dac15368903ca9fb    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 23 Mar 2016 12:28:01 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 23 Mar 2016 12:28:01 -0400    

Click here for diff

A join clause might mention multiple relations on either side, so it  
need not be the case that a given joinrel's constituent relations are  
all on one side of the join clause or all on the other.  
  
Report by Rajkumar Raghuwanshi.  Analysis and fix by Michael Paquier  
and 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

Partition the freelist for shared dynahash tables.

commit   : 44ca4022f3f9297bab5cbffdd97973dbba1879ed    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 23 Mar 2016 10:56:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 23 Mar 2016 10:56:23 -0400    

Click here for diff

Without this, contention on the freelist can become a pretty serious  
problem on large servers.  
  
Aleksander Alekseev, reviewed by Anastasia Lubennikova, Dilip Kumar,  
and me.  

M src/backend/utils/hash/dynahash.c

Code review for error reports in jsonb_set().

commit   : ea4b8bd6188ecb17ba37d93f57b8b020a964e66c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Mar 2016 11:00:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Mar 2016 11:00:39 -0400    

Click here for diff

User-facing (even tested by regression tests) error conditions were thrown  
with elog(), hence had wrong SQLSTATE and were untranslatable.  And the  
error message texts weren't up to project style, either.  

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

Fix unsafe use of strtol() on a non-null-terminated Text datum.

commit   : 384dfbde19330541f7fb487f9352949aa06c812e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Mar 2016 10:43:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Mar 2016 10:43:13 -0400    

Click here for diff

jsonb_set() could produce wrong answers or incorrect error reports, or in  
the worst case even crash, when trying to convert a path-array element into  
an integer for use as an array subscript.  Per report from Vitaly Burovoy.  
Back-patch to 9.5 where the faulty code was introduced (in commit  
c6947010ceb42143).  
  
Michael Paquier  

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

Change comment to describe correct lock level used

commit   : 8320c625d983f4cf4c8f453165502d7cf3aa7cf3    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 23 Mar 2016 11:32:34 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 23 Mar 2016 11:32:34 +0000    

Click here for diff

M src/backend/commands/trigger.c

Fix EvalPlanQual bug when query contains both locked and not-locked rels.

commit   : 71404af2a29ce4a3a5907cdc8b893ec2bc0285b4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 Mar 2016 17:56:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 Mar 2016 17:56:06 -0400    

Click here for diff

In commit afb9249d06f47d7a, we (probably I) made ExecLockRows assign  
null test tuples to all relations of the query while setting up to do an  
EvalPlanQual recheck for a newly-updated locked row.  This was sheerest  
brain fade: we should only set test tuples for relations that are lockable  
by the LockRows node, and in particular empty test tuples are only sensible  
for inheritance child relations that weren't the source of the current  
tuple from their inheritance tree.  Setting a null test tuple for an  
unrelated table causes it to return NULLs when it should not, as exhibited  
in bug #14034 from Bronislav Houdek.  To add insult to injury, doing it the  
wrong way required two loops where one would suffice; so the corrected code  
is even a bit shorter and faster.  
  
Add a regression test case based on his example, and back-patch to 9.5  
where the bug was introduced.  

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

Improve docs of pg_trgm changes

commit   : f6bd0da63bf40bc324eec6fd47f3d3d301f44dab    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 22 Mar 2016 17:08:10 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 22 Mar 2016 17:08:10 +0300    

Click here for diff

Artur Zakirov, per gripe from Jeff Janes  

M doc/src/sgml/pgtrgm.sgml

Fix typo in docs.

commit   : 112a2d0615bab27630829e486c8b0cd2fdd6980b    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 22 Mar 2016 22:04:30 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 22 Mar 2016 22:04:30 +0900    

Click here for diff

Jeff Janes  

M doc/src/sgml/monitoring.sgml

Allow the delay in psql's \watch command to be a fractional second.

commit   : b283096534b9c514a92a70c98c033015b6792ba7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2016 18:34:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2016 18:34:18 -0400    

Click here for diff

Instead of just "2" seconds, allow eg. "2.5" seconds.  Per request  
from Alvaro Herrera.  No docs change since the docs didn't say you  
couldn't do this already.  

M src/bin/psql/command.c

Improve header output from psql's \watch command.

commit   : dea2b5960a9460c02896ed361d35e92bce02801a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2016 18:18:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2016 18:18:13 -0400    

Click here for diff

Include the \pset title string if there is one, and shorten the prefab  
part of the header to be "timestamp (every Ns)".  Per suggestion by  
David Johnston.  
  
Michael Paquier and Tom Lane  

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

Clean up some Coverity complaints about commit 0bf3ae88af330496.

commit   : 92b7902deb3155f6975f33e8b6c8be4d9d066172    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2016 11:59:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2016 11:59:49 -0400    

Click here for diff

The two get_tle_by_resno() calls introduced by this commit lacked any  
check for a NULL return, unlike any other calls of that function anywhere  
in our tree.  Coverity quite properly complained about it.  Also fix a  
misindented line in process_query_params(), which Coverity also complained  
about on the grounds that the bad indentation suggested possible programmer  
misinterpretation.  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c

Make max_parallel_degree PGC_USERSET.

commit   : ae507d9222989f2fd8455cf32d4dcb337ccf32bb    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 21 Mar 2016 10:54:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 21 Mar 2016 10:54:36 -0400    

Click here for diff

It was intended to be this way all along, just like other planner  
GUCs such as work_mem.  But I goofed.  

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

Support parallel aggregation.

commit   : e06a38965b3bcdaa881e7e06892d4d8ab6c2c980    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 21 Mar 2016 09:20:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 21 Mar 2016 09:20:53 -0400    

Click here for diff

Parallel workers can now partially aggregate the data and pass the  
transition values back to the leader, which can combine the partial  
results to produce the final answer.  
  
David Rowley, based on earlier work by Haribabu Kommi.  Reviewed by  
Álvaro Herrera, Tomas Vondra, Amit Kapila, James Sewell, and me.  

M src/backend/executor/execQual.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/path/allpaths.c
M src/backend/optimizer/path/costsize.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/optimizer/util/tlist.c
M src/backend/parser/parse_func.c
M src/include/catalog/catversion.h
M src/include/nodes/primnodes.h
M src/include/nodes/relation.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/tlist.h

Properly declare FeBeWaitSet.

commit   : 7fa0064092e135415a558dc3c4d7393d14ab6d8e    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Mar 2016 12:58:18 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Mar 2016 12:58:18 +0100    

Click here for diff

Surprising that this worked on a number of systems. Reported by  
buildfarm member longfin.  

M src/backend/libpq/pqcomm.c
M src/include/libpq/libpq.h

Introduce WaitEventSet API.

commit   : 98a64d0bd713cb89e61bef6432befc4b7b5da59e    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Mar 2016 09:56:39 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Mar 2016 09:56:39 +0100    

Click here for diff

Commit ac1d794 ("Make idle backends exit if the postmaster dies.")  
introduced a regression on, at least, large linux systems. Constantly  
adding the same postmaster_alive_fds to the OSs internal datastructures  
for implementing poll/select can cause significant contention; leading  
to a performance regression of nearly 3x in one example.  
  
This can be avoided by using e.g. linux' epoll, which avoids having to  
add/remove file descriptors to the wait datastructures at a high rate.  
Unfortunately the current latch interface makes it hard to allocate any  
persistent per-backend resources.  
  
Replace, with a backward compatibility layer, WaitLatchOrSocket with a  
new WaitEventSet API. Users can allocate such a Set across multiple  
calls, and add more than one file-descriptor to wait on. The latter has  
been added because there's upcoming postgres features where that will be  
helpful.  
  
In addition to the previously existing poll(2), select(2),  
WaitForMultipleObjects() implementations also provide an epoll_wait(2)  
based implementation to address the aforementioned performance  
problem. Epoll is only available on linux, but that is the most likely  
OS for machines large enough (four sockets) to reproduce the problem.  
  
To actually address the aforementioned regression, create and use a  
long-lived WaitEventSet for FE/BE communication.  There are additional  
places that would benefit from a long-lived set, but that's a task for  
another day.  
  
Thanks to Amit Kapila, who helped make the windows code I blindly wrote  
actually work.  
  
Reported-By: Dmitry Vasilyev Discussion:  
CAB-SwXZh44_2ybvS5Z67p_CDz=XFn4hNAD=CnMEF+QqkXwFrGg@mail.gmail.com  
[email protected]  

M configure
M configure.in
M src/backend/libpq/be-secure.c
M src/backend/libpq/pqcomm.c
M src/backend/storage/ipc/latch.c
M src/backend/utils/init/miscinit.c
M src/include/libpq/libpq.h
M src/include/pg_config.h.in
M src/include/storage/latch.h
M src/tools/pgindent/typedefs.list

Combine win32 and unix latch implementations.

commit   : 72e2d21c1249b674496f97cd6009c0bda62f6b4d    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Mar 2016 09:56:39 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Mar 2016 09:56:39 +0100    

Click here for diff

Previously latches for windows and unix had been implemented in  
different files. A later patch introduce an expanded wait  
infrastructure, keeping the implementation separate would introduce too  
much duplication.  
  
This basically just moves the functions, without too much change. The  
reason to keep this separate is that it allows blame to continue working  
a little less badly; and to make review a tiny bit easier.  
  
Discussion: [email protected]  

M configure
M configure.in
M src/backend/Makefile
M src/backend/port/.gitignore
M src/backend/port/Makefile
D src/backend/port/win32_latch.c
M src/backend/storage/ipc/Makefile
R074 src/backend/port/unix_latch.c src/backend/storage/ipc/latch.c
M src/include/storage/latch.h
M src/tools/msvc/Mkvcbuild.pm

Second attempt at fixing MSVC build for 68ab8e8ba4a471d9.

commit   : 326d73c86fda407a810675c3b5a48e0a0cc992f5    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Mar 2016 10:49:45 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Mar 2016 10:49:45 +0100    

Click here for diff

After the previous fix in 6f1f34c9 msvc ended up looking for psqlscan.c  
in the wrong directory.  
  
David's fix just forces the path to be adjusted. That's not a  
particularly pretty fix, but it hopefully will make the buildfarm green  
again.  
  
Author: David Rowley  
Discussion: CAKJS1f_9CCi_t+LEgV5GWoCj3wjavcMoDc5qfcf_A0UwpQoPoA@mail.gmail.com  

M src/tools/msvc/Mkvcbuild.pm

Use %option bison-bridge in psql/pgbench lexers.

commit   : b6afae71aaf6d2df76d0a0a77c8b630220a01ec1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Mar 2016 21:59:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Mar 2016 21:59:03 -0400    

Click here for diff

The point of this change is to use %pure-parser in pgbench's exprparse.y.  
The immediate reason is that it turns out very ancient versions of bison  
have a bug with the combination of a reentrant lexer and non-reentrant  
parser.  We could consider dropping support for such ancient bisons; but  
considering that we might well need exprparse.y to be reentrant some day,  
it seems better to make it so right now than to move the portability  
goalposts.  (AFAICT there's no particular performance consequence to this  
change, either, so there's no good reason not to do it.)  
  
Now, %pure-parser assumes that the called lexer is built with %option  
bison-bridge.  Because we're assuming bitwise compatibility of yyscan_t  
(yyguts_t) data structures among all the psql/pgbench lexers, that  
requirement propagates back to psql's lexers as well.  But it's just a  
few lines of change on that side too; and if psqlscan.l is to set the  
baseline for a possibly-large family of lexers, it should err on the  
side of including not omitting useful features.  

M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.h
M src/bin/psql/psqlscan.l
M src/bin/psql/psqlscanslash.l

Best-guess attempt at fixing MSVC build for 68ab8e8ba4a471d9.

commit   : 6f1f34c92b11593ec62ff3e12781eb96dc911821    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Mar 2016 17:51:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Mar 2016 17:51:54 -0400    

Click here for diff

pgbench now needs to use src/bin/psql/psqlscan.l, but it's not very clear  
how to fit that into the MSVC build system.  If this doesn't work I'm going  
to need some help from somebody who actually understands those scripts ...  

M src/tools/msvc/Mkvcbuild.pm

SQL commands in pgbench scripts are now ended by semicolons, not newlines.

commit   : 68ab8e8ba4a471d91b69f2f89782ba10a0fbef0c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Mar 2016 12:58:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Mar 2016 12:58:44 -0400    

Click here for diff

To allow multiline SQL commands in scripts, adopt the same rules psql uses  
to decide what is the end of a SQL command, to wit, an unquoted semicolon  
not encased in parentheses.  Do this by importing the same flex lexer that  
psql uses, since coping with stuff like dollar-quoted literals is hard to  
get right without going the full nine yards.  
  
This makes use of the infrastructure added in commit 0ea9efbe9ec1bf07 to  
support independently-written flex lexers scanning the same PsqlScanState  
input-buffer data structure.  Since that infrastructure isn't very  
friendly to ad-hoc parsing code such as strtok(), improve exprscan.l  
so that it can parse either whitespace-separated words or expression  
tokens, on demand, and rewrite pgbench.c's backslash-command parsing  
code to always use the lexer to fetch tokens.  
  
It's still the case that pgbench backslash commands extend to the end  
of the line, no more and no less.  That could be changed in a fairly  
localized way now, and there was some interest in doing so, but it  
seems like material for a separate patch.  
  
In passing, make some marginal cleanups in syntax error reporting,  
const-ify a few data structures that could use it, and run some of  
this code through pgindent.  
  
I can't tell whether the MSVC build scripts need to be taught explicitly  
about the changes here or not, but the buildfarm will soon tell us.  
  
Kyotaro Horiguchi and Tom Lane  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/Makefile
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h

Remove dependency on psed for MSVC builds.

commit   : 5d0320105699c253fe19b8b42ae1bffb67785b02    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 19 Mar 2016 18:36:35 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 19 Mar 2016 18:36:35 -0400    

Click here for diff

Modern Perl has removed psed from its core distribution, so it might not  
be readily available on some build platforms. We therefore replace its  
use with a Perl script generated by s2p, which is equivalent to the sed  
script. The latter is retained for non-MSVC builds to avoid creating a  
new hard dependency on Perl for non-Windows tarball builds.  
  
Backpatch to all live branches.  
  
Michael Paquier and me.  

A src/backend/utils/Gen_dummy_probes.pl
M src/tools/msvc/Solution.pm

Fix phony .PHONY.

commit   : d5351fcb03fc8e20651d5863b88b397a8be68d74    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 17:19:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 17:19:37 -0400    

Click here for diff

A couple makefiles had misspelled the magic .PHONY target as PHONY.  

M contrib/test_decoding/Makefile
M src/test/modules/brin/Makefile

Make pgbench's expression lexer reentrant.

commit   : 429ee5a822db0e8faf669d77c810f1eeaaff1ab4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 16:35:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 16:35:41 -0400    

Click here for diff

This is a necessary preliminary step for making it play with psqlscan.l  
given the way I set up the lexer input-buffer sharing mechanism in commit  
0ea9efbe9ec1bf07.  
  
I've not tried to make it *actually* reentrant; there's still some static  
variables laying about.  But flex thinks it's reentrant, and that's what  
counts.  
  
In support of that, fix exprparse.y to pass through the yyscan_t from the  
caller.  Also do some minor code beautification, like not casting away  
const.  

M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h

pgbench: Silence new compiler warnings

commit   : 1038bc91ca98865bd60bf63db46fc331f3099998    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 19 Mar 2016 16:14:37 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 19 Mar 2016 16:14:37 -0300    

Click here for diff

The original coding in 7bafffea647 and previous wasn't all that great  
anyway.  
  
Reported by Jeff Janes and Tom Lane  

M src/bin/pgbench/pgbench.c

Typo fix.

commit   : 78e7c4439917b01afd645a2ec657008ba6c33d37    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 14:36:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 14:36:52 -0400    

Click here for diff

M src/interfaces/ecpg/preproc/pgc.l

Sync backend/parser/scan.l with bin/psql/psqlscan.l.

commit   : 21c8ee79464a180ab0257abdfceae89274a46632    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 14:36:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 14:36:22 -0400    

Click here for diff

Make some minor formatting adjustments to make it easier to diff these  
files and see that they indeed implement the same flex rules (at least  
to the extent that we want them to be the same).  
  
(Someday it'd be nice to make ecpg's pgc.l more easily diff'able too,  
but today is not that day.)  
  
Also run relevant parts of these files and psqlscanslash.l through  
pgindent.  
  
No actual behavioral changes here, just obsessive neatnik-ism.  

M src/backend/parser/scan.l
M src/bin/psql/psqlscan.l
M src/bin/psql/psqlscanslash.l

Build backend/parser/scan.l and interfaces/ecpg/preproc/pgc.l standalone.

commit   : 72b1e3a21f0540ffa5c1f8f474b6c52097a368bb    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 12:07:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 12:07:16 -0400    

Click here for diff

Now that we know about the %top{} trick, we can revert to building flex  
lexers as separate .o files.  This is worth doing for a couple of reasons  
besides sheer cleanliness.  We can narrow the scope of the -Wno-error flag  
that's forced on scan.c.  Also, since these grammar and lexer files are  
so large, splitting them into separate build targets should have some  
advantages in build speed, particularly in parallel or ccache'd builds.  
  
We have quite a few other .l files that could be changed likewise, but the  
above arguments don't apply to them, so the benefit of fixing them seems  
pretty minimal.  Leave the rest for some other day.  

M src/backend/parser/Makefile
M src/backend/parser/gram.y
M src/backend/parser/scan.l
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/pgc.l

pgbench: Allow changing weights for scripts

commit   : 7bafffea647e21864cb857ab5b6fe266f2d0976a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 19 Mar 2016 12:32:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 19 Mar 2016 12:32:42 -0300    

Click here for diff

Previously, all scripts had the same probability of being chosen when  
multiple of them were specified via -b, -f, -N, -S.  With this commit,  
-b and -f now search for an "@" in the script name and use the integer  
found after it as the drawing probability for that script.  
  
(One disadvantage is that if you have script whose names contain @, you  
are now forced to specify "@1" at the end; otherwise the name's @ is  
confused with a weight separator.  We don't expect many pgbench script  
with @ in their names in the wild, so this shouldn't be too serious a  
problem.)  
  
While at it, rework the interface between addScript, process_file,  
process_builtin, and findBuiltin.  It had gotten a bit out of hand with  
recent commits.  
  
Author: Fabien Coelho  
Reviewed-By: Andres Freund, Robert Haas, Álvaro Herrera, Michaël Paquier  
Discussion: http://www.postgresql.org/message-id/alpine.DEB.2.10.1603160721240.1666@sto  

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

With ancient gcc, skip pg_attribute_printf() on function pointer.

commit   : b46d9beb658af7eb4e2a08dfa34206a117c9654f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 10:59:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 10:59:20 -0400    

Click here for diff

Buildfarm results show that the ability to attach pg_attribute_printf  
decoration to a function pointer appeared somewhere between gcc 2.95.3  
and gcc 4.0.1.  Guess that it was there in 4.0.  

M src/bin/psql/psqlscan.h

Allow SSL server key file to have group read access if owned by root

commit   : 9a83564c58b7f6363141a8f1d0c87c89a5ebab5d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 19 Mar 2016 11:03:22 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 19 Mar 2016 11:03:22 +0100    

Click here for diff

We used to require the server key file to have permissions 0600 or less  
for best security.  But some systems (such as Debian) have certificate  
and key files managed by the operating system that can be shared with  
other services.  In those cases, the "postgres" user is made a member of  
a special group that has access to those files, and the server key file  
has permissions 0640.  To accommodate that kind of setup, also allow the  
key file to have permissions 0640 but only if owned by root.  
  
From: Christoph Berg <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  

M doc/src/sgml/runtime.sgml
M src/backend/libpq/be-secure-openssl.c

Fix stupid omission in c4901a1e.

commit   : 6eb2be15b5d24b98d334a9dd637f0edb37e2eb7e    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2016 22:35:43 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2016 22:35:43 -0700    

Click here for diff

Reported-By: Jeff Janes  
Discussion: CAMkU=1zGxREwoyaCrp_CHadEB+dPgpVyKBysCJ+6xP9gCOvAuw@mail.gmail.com  

M src/backend/port/unix_latch.c

Fix missed update in _readForeignScan().

commit   : 07aed46a6b3994508e5674301c85ebf5807905ea    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 01:20:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 01:20:34 -0400    

Click here for diff

Blatant fail in 0bf3ae88af330496517722e391e7c975e6bad219.  
Caught by buildfarm member mandrill.  

M src/backend/nodes/readfuncs.c

Use yylex_init not yylex_init_extra().

commit   : ff0a7e6167f475672d82d1cd7cd0d5e735154c4d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 01:02:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 01:02:18 -0400    

Click here for diff

Older versions of flex don't have the latter.  Per buildfarm.  

M src/bin/psql/psqlscan.l

Suppress FLEX_NO_BACKUP check for psqlscanslash.l.

commit   : a3e39f83632935911bc159154a33e89495f4a676    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 00:43:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 00:43:46 -0400    

Click here for diff

The existing infrastructure for FLEX_NO_BACKUP doesn't work reliably  
when two lexers are built in parallel in the same directory.  We can  
probably fix that, but as a short-term workaround, just don't make  
the check for psqlscanslash.l.  
  
Per buildfarm.  

M src/bin/psql/Makefile

Split psql's lexer into two separate .l files for SQL and backslash cases.

commit   : 0ea9efbe9ec1bf07cc6ae070bdd54700af08e44d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 00:24:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Mar 2016 00:24:55 -0400    

Click here for diff

This gets us to a point where psqlscan.l can be used by other frontend  
programs for the same purpose psql uses it for, ie to detect when it's  
collected a complete SQL command from input that is divided across  
line boundaries.  Moreover, other programs can supply their own lexers  
for backslash commands of their own choosing.  A follow-on patch will  
use this in pgbench.  
  
The end result here is roughly the same as in Kyotaro Horiguchi's  
0001-Make-SQL-parser-part-of-psqlscan-independent-from-ps.patch, although  
the details of the method for switching between lexers are quite different.  
Basically, in this patch we share the entire PsqlScanState, YY_BUFFER_STATE  
stack, *and* yyscan_t between different lexers.  The only thing we need  
to do to switch to a different lexer is to make sure the start_state is  
valid for the new lexer.  This works because flex doesn't keep any other  
persistent state that depends on the specific lexing tables generated for  
a particular .l file.  (We are assuming that both lexers are built with  
the same flex version, or at least versions that are compatible with  
respect to the contents of yyscan_t; but that doesn't seem likely to  
be a big problem in practice, considering how slowly flex changes.)  
  
Aside from being more efficient than Horiguchi-san's original solution,  
this avoids possible corner-case changes in semantics: the original code  
was capable of popping the input buffer stack while still staying in  
backslash-related parsing states.  I'm not sure that that equates to any  
useful user-visible behaviors, but I'm not sure it doesn't either, so  
I'm loath to assume that we only need to consider the topmost buffer when  
parsing a backslash command.  
  
I've attempted to update the MSVC build scripts for the added .l file,  
but will rely on the buildfarm to see if I missed anything.  
  
Kyotaro Horiguchi and Tom Lane  

M src/bin/psql/.gitignore
M src/bin/psql/Makefile
M src/bin/psql/command.c
M src/bin/psql/nls.mk
M src/bin/psql/psqlscan.h
M src/bin/psql/psqlscan.l
A src/bin/psql/psqlscan_int.h
A src/bin/psql/psqlscanslash.h
A src/bin/psql/psqlscanslash.l
M src/bin/psql/variables.c
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/clean.bat

Convert psql's flex lexer to be re-entrant, and make it compile standalone.

commit   : 27199058d98ef7ff2f468af44654bc35bb70fe4a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Mar 2016 21:21:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Mar 2016 21:21:52 -0400    

Click here for diff

Change psqlscan.l to specify '%option reentrant', adjust internal APIs  
to match, and get rid of its internal static variables.  While this is  
good cleanup in an abstract sense, the reason to do it right now is that  
it seems the only practical way to support use of separate flex lexers  
with common PsqlScanState infrastructure.  If we build two non-reentrant  
lexers then we are going to have problems with dangling buffer pointers  
in whichever lexer isn't active when we transition from one buffer to  
another, as well as curious side-effects if we try to share any code  
between the files.  (Horiguchi-san had a different solution to that in his  
pending patch, but I find it ugly and probably broken for corner cases.)  
  
Depending on which version of flex you're using, this may result in getting  
a "warning: unused variable 'yyg'" warning from psqlscan, similar to the  
one you'd have seen for a long time in backend/parser/scan.l.  I put a  
local -Wno-error into CFLAGS for the file, for the convenience of those  
who compile with -Werror.  
  
Also, stop compiling psqlscan as part of mainloop.c, and make it a  
standalone build target instead.  This is a lot cleaner than before, though  
it doesn't really change much in practice as of this commit.  (I'm not sure  
whether the MSVC build scripts will need some help with this part, but the  
buildfarm will soon tell us.)  

M src/bin/psql/Makefile
M src/bin/psql/mainloop.c
M src/bin/psql/psqlscan.l

Merge wal_level "archive" and "hot_standby" into new name "replica"

commit   : b555ed8102672cfedb06559952b8341756386d69    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:01:54 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:01:54 -0500    

Click here for diff

The distinction between "archive" and "hot_standby" existed only because  
at the time "hot_standby" was added, there was some uncertainty about  
stability.  This is now a long time ago.  We would like to move forward  
with simplifying the replication configuration, but this distinction is  
in the way, because a primary server cannot tell (without asking a  
standby or predicting the future) which one of these would be the  
appropriate level.  
  
Pick a new name for the combined setting to make it clearer that it  
covers all (non-logical) backup and replication uses.  The old values  
are still accepted but are converted internally.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: David Steele <[email protected]>  

M doc/src/sgml/backup.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/ref/alter_system.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/slot.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_controldata/pg_controldata.c
M src/include/access/xlog.h
M src/include/catalog/pg_control.h
M src/test/perl/PostgresNode.pm

Decouple psqlscan.l from surrounding program.

commit   : 4e1d2a170836028370675922ea9a690648d3c18d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Mar 2016 15:05:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Mar 2016 15:05:49 -0400    

Click here for diff

Remove assorted external references from psqlscan.l in preparation for  
making it usable by other frontend programs.  This mostly involves  
getting rid of direct calls to psql_error() and GetVariable() in favor  
of introducing a callback-functions struct to encapsulate variable  
fetching and error printing.  In addition, pass the current encoding  
and standard-strings status as additional parameters to psql_scan_setup  
instead of looking directly at "pset" or calling additional functions.  
  
I did not bother to change some references to psql_error that are in  
functions that will soon migrate to a psql-specific backslash-command  
lexer.  Other than that, this version of psqlscan.l is capable of  
compiling standalone.  It still depends on assorted src/common functions  
as well as some encoding-related libpq functions, but we expect that  
all programs using it will be happy with those dependencies.  
  
Kyotaro Horiguchi, somewhat editorialized on by me  

M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/mainloop.c
M src/bin/psql/mainloop.h
M src/bin/psql/psqlscan.h
M src/bin/psql/psqlscan.l
M src/bin/psql/startup.c

Use INT64_FORMAT instead of %ld for int64.

commit   : 08a6d36dcbe4ebdcdf9d554e5b571748fe23001b    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Mar 2016 14:53:06 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Mar 2016 14:53:06 -0400    

Click here for diff

Commit 0011c0091e886b874e485a46ff2c94222ffbf550 introduced this  
mistake.  
  
Patch by me.  Reported by Andres Freund, who also reviewed the  
patch.  

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

Only clear latch self-pipe/event if there is a pending notification.

commit   : c4901a1e03a7730e4471fd1143f1caf79695493d    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2016 11:43:59 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2016 11:43:59 -0700    

Click here for diff

This avoids a good number of, individually quite fast, system calls in  
scenarios with many quick queries. Besides the aesthetic benefit of  
seing fewer superflous system calls with strace, it also improves  
performance by ~2% measured by pgbench -M prepared -c 96 -j 8 -S (scale  
100).  
  
Without having benchmarked it, this patch also adjust the windows code,  
as that makes it easier to unify the unix/windows codepaths in a later  
patch. There's little reason to diverge in behaviour between the  
platforms.  
  
Discussion: CA+TgmoYc1Zm+Szoc_Qbzi92z2c1vRHZmjhfPn5uC=w8bXv6Avg@mail.gmail.com  
Reviewed-By: Robert Haas  

M src/backend/port/unix_latch.c
M src/backend/port/win32_latch.c

Make it easier to choose the used waiting primitive in unix_latch.c.

commit   : c17966201c7de2a4c437bed6d83c6a7f2e7108f4    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2016 11:43:59 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2016 11:43:59 -0700    

Click here for diff

This allows for easier testing of the different primitives; in  
preparation for adding a new primitive.  
  
Discussion: [email protected]  
Reviewed-By: Robert Haas  

M src/backend/port/unix_latch.c

Error out if waiting on socket readiness without a specified socket.

commit   : 6bc4d95fcc2a432fc202cba03d5393be096f0422    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2016 11:43:59 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2016 11:43:59 -0700    

Click here for diff

Previously we just ignored such an attempt, but that seems to serve no  
purpose but making things harder to debug.  
  
Discussion: [email protected]  
    [email protected]  
Reviewed-By: Robert Haas  

M src/backend/port/unix_latch.c
M src/backend/port/win32_latch.c

Remove unused, and dangerous, TestLatch() macro.

commit   : fad0f9d8c9f6a8e99156b8f01cba54be39f31761    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2016 11:43:59 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2016 11:43:59 -0700    

Click here for diff

The macro has not seen any in-tree use since latches had been introduced  
in 2746e5f, in 2010.  

M src/include/storage/latch.h

Directly modify foreign tables.

commit   : 0bf3ae88af330496517722e391e7c975e6bad219    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Mar 2016 13:48:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Mar 2016 13:48:58 -0400    

Click here for diff

postgres_fdw can now sent an UPDATE or DELETE statement directly to  
the foreign server in simple cases, rather than sending a SELECT FOR  
UPDATE statement and then updating or deleting rows one-by-one.  
  
Etsuro Fujita, reviewed by Rushabh Lathia, Shigeru Hanada, Kyotaro  
Horiguchi, Albe Laurenz, Thom Brown, 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/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/postgres-fdw.sgml
M src/backend/commands/explain.c
M src/backend/executor/execMain.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeModifyTable.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/plancat.c
M src/include/foreign/fdwapi.h
M src/include/nodes/execnodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/optimizer/plancat.h

Clean up some misplaced #includes.

commit   : 3422fecccadb021b7b4cdbc73b2c29f66f031761    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Mar 2016 13:43:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Mar 2016 13:43:13 -0400    

Click here for diff

Random .h files have no business including postgres-fe.h (or postgres.h).  
If that wasn't the first #include done by the calling .c file, it's the  
.c file that's broken.  Noted while prepping Kyotaro Horiguchi's psql  
lexer refactoring patch.  

M src/bin/psql/common.h
M src/bin/psql/create_help.pl
M src/bin/psql/mainloop.h

Fix a typo

commit   : 61d2ebdbf9155d80f83281d8c5729c8f8f0949bc    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 18 Mar 2016 18:49:24 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 18 Mar 2016 18:49:24 +0300    

Click here for diff

Erik Rijkers  

M doc/src/sgml/func.sgml

Introduce parse_ident()

commit   : 3187d6de0e5a9e805b27c48437897e8c39071d45    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 18 Mar 2016 18:16:14 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 18 Mar 2016 18:16:14 +0300    

Click here for diff

SQL-layer function to split qualified identifier into array parts.  
  
Author: Pavel Stehule with minor editorization by me and Jim Nasby  

M doc/src/sgml/func.sgml
M src/backend/catalog/system_views.sql
M src/backend/parser/scansup.c
M src/backend/utils/adt/misc.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/parser/scansup.h
M src/include/utils/builtins.h
M src/test/regress/expected/name.out
M src/test/regress/sql/name.sql

Push scan/join target list beneath Gather when possible.

commit   : 992b5ba30dcafdc222341505b072a6b009b248a7    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Mar 2016 09:46:40 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Mar 2016 09:46:40 -0400    

Click here for diff

This means that, for example, "SELECT expensive_func(a) FROM bigtab  
WHERE something" can compute expensive_func(a) in the workers rather  
than the leader if it happens to be parallel-safe, which figures to be  
a big win in some practical cases.  
  
Currently, we can only do this if the entire target list is  
parallel-safe.  If we worked harder, we might be able to evaluate  
parallel-safe targets in the worker and any parallel-restricted  
targets in the leader, but that would be more complicated, and there  
aren't that many parallel-restricted functions that people are likely  
to use in queries anyway.  I think.  So just do the simple thing for  
the moment.  
  
Robert Haas, Amit Kapila, and Tom Lane  

M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c

Various minor corrections of and improvements to comments.

commit   : 2d8a1e22b109680204cb015a30e5a733a233ed64    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Mar 2016 09:38:59 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Mar 2016 09:38:59 -0400    

Click here for diff

Aleksander Alekseev  

M contrib/pg_trgm/trgm_gin.c
M contrib/pg_trgm/trgm_op.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/misc/guc.c
M src/backend/utils/sort/tuplesort.c

pg_trgm's set_limit() now uses SetConfigOption()

commit   : aa698d753566f68bdd54881d30b1a515b0327b0e    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 18 Mar 2016 12:26:27 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 18 Mar 2016 12:26:27 +0300    

Click here for diff

Deprecated set_limit() is modified to use SetConfigOption() to set  
similarity_threshold which is actually an instance of  
pg_trgm.similarity_threshold GUC variable. Previous coding directly sets  
similarity_threshold what could cause an inconsistency between states of  
actual variable and GUC representation.  
  
Per gripe from Tom Lane  

M contrib/pg_trgm/trgm_op.c

docs: Fix typo'd brin_summarize_new_values

commit   : 696684d878747a1a5cfae01887404629c40c09dd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 17 Mar 2016 20:17:04 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 17 Mar 2016 20:17:04 -0300    

Click here for diff

I wrote "brin_summarize_new_pages" instead, in docs as well as in the  
commit message of commit ac443d1034d9.  
  
Bug: #14030  
Reported-By: Chris Pacejo  

M doc/src/sgml/brin.sgml

Remove useless double calls of make_parsestate().

commit   : bd0ab28912d7502b237b8aeb95d052abe4ff6bc6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Mar 2016 16:46:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Mar 2016 16:46:23 -0400    

Click here for diff

Aleksander Alekseev  

M src/backend/commands/policy.c

Update tuplesort.c comments for memory mangement improvements.

commit   : c27033ff7c17b5100d02c454a0eebb95ec7b91cc    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 17 Mar 2016 16:11:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 17 Mar 2016 16:11:14 -0400    

Click here for diff

I'm committing these changes separately so that it's clear what is  
Peter's original work versus what I changed.  This is a followup to  
commit 0011c0091e886b874e485a46ff2c94222ffbf550, and these changes  
are all by me.  

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

Improve memory management for external sorts.

commit   : 0011c0091e886b874e485a46ff2c94222ffbf550    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 17 Mar 2016 16:05:05 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 17 Mar 2016 16:05:05 -0400    

Click here for diff

Introduce a new memory context which stores tuple data, and reset it  
at the end of each merge pass; this helps avoid memory fragmentation  
and, consequently, overallocation.  Also, for the final merge patch,  
eliminate memory context chunk header overhead entirely by allocating  
all of the memory used for buffering tuples during the merge in a  
single chunk.  Since this modestly increases the number of tuples we  
can store, grow the memtuples array a bit so that we're less likely to  
run short of slots there.  
  
Peter Geoghegan.  Review and testing of patches in this series by  
Jeff Janes, Greg Stark, Mithun Cy, and me.  

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

Fix assorted breakage in to_char()'s OF format option.

commit   : 55c3a04d60ccea9e999088fb847ceeb9fd4dd927    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Mar 2016 15:50:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Mar 2016 15:50:33 -0400    

Click here for diff

In HEAD, fix incorrect field width for hours part of OF when tm_gmtoff is  
negative.  This was introduced by commit 2d87eedc1d4468d3 as a result of  
falsely applying a pattern that's correct when + signs are omitted, which  
is not the case for OF.  
  
In 9.4, fix missing abs() call that allowed a sign to be attached to the  
minutes part of OF.  This was fixed in 9.5 by 9b43d73b3f9bef27, but for  
inscrutable reasons not back-patched.  
  
In all three versions, ensure that the sign of tm_gmtoff is correctly  
reported even when the GMT offset is less than 1 hour.  
  
Add regression tests, which evidently we desperately need here.  
  
Thomas Munro and Tom Lane, per report from David Fetter  

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

Improve support of Hunspell

commit   : f4ceed6ceba31a72ed7a726fef05d211641f283c    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 17 Mar 2016 17:23:38 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 17 Mar 2016 17:23:38 +0300    

Click here for diff

- allow to use non-ascii characters as affix flag. Non-numeric affix flags now  
  are stored as string instead of numeric value of character.  
- allow to use 0 as affix flag in numeric encoded affixes  
  
That adds support for arabian, hungarian, turkish and  
brazilian portuguese languages.  
  
Author: Artur Zakirov with heavy editorization by me  

M src/backend/tsearch/spell.c
M src/include/tsearch/dicts/spell.h

Fix typos.

commit   : 0218e8b3fa7ec72af441ac6f80927bff0d497334    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 17 Mar 2016 07:26:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 17 Mar 2016 07:26:20 -0400    

Click here for diff

Jim Nasby  

M src/backend/optimizer/README

Add syslog_split_messages parameter

commit   : fc201dfd95059fd2fef9862a2fd09cfab42c9bf7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Mar 2016 22:48:53 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Mar 2016 22:48:53 -0400    

Click here for diff

Reviewed-by: Andreas Karlsson <[email protected]>  

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

Add syslog_sequence_numbers parameter

commit   : f4c454e9ba5262c5614c7637983c83b8c327e231    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 26 Feb 2016 22:34:30 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 26 Feb 2016 22:34:30 -0500    

Click here for diff

Reviewed-by: Andreas Karlsson <[email protected]>  

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

Fix "pg_bench -C -M prepared".

commit   : 47211af17a2dbee38b53b2ea6de81499dbb2c7f5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Mar 2016 23:18:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Mar 2016 23:18:07 -0400    

Click here for diff

This didn't work because when we dropped and re-established a database  
connection, we did not bother to reset session-specific state such as  
the statements-are-prepared flags.  
  
The st->prepared[] array certainly needs to be flushed, and I cleared a  
couple of other fields as well that couldn't possibly retain meaningful  
state for a new connection.  
  
In passing, fix some bogus comments and strange field order choices.  
  
Per report from Robins Tharakan.  

M src/bin/pgbench/pgbench.c

Fix j2day() to behave sanely for negative Julian dates.

commit   : 5db51464311eb7fe4e90030c6a514ff61e9f1c00    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Mar 2016 20:57:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Mar 2016 20:57:45 -0400    

Click here for diff

Somebody had apparently once figured that casting to unsigned int would  
produce the right output for negative inputs, but that would only be  
true if 2^32 were a multiple of 7, which of course it ain't.  We need  
to use a signed division and then correct the sign of the remainder.  
  
AFAICT, the only case where this would arise currently is when doing  
ISO-week calculations for dates in 4714BC, where we'd compute a  
negative Julian date representing 4714-01-04BC and then do some  
arithmetic with it.  Since we don't even really document support for  
such dates, this is not of much consequence.  But we may as well  
get it right.  
  
Per report from Vitaly Burovoy.  

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

Be more careful about out-of-range dates and timestamps.

commit   : a70e13a39eccf5fc944c66e0029004b6abcb3cae    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Mar 2016 19:09:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Mar 2016 19:09:04 -0400    

Click here for diff

Tighten the semantics of boundary-case timestamptz so that we allow  
timestamps >= '4714-11-24 00:00+00 BC' and < 'ENDYEAR-01-01 00:00+00 AD'  
exactly, no more and no less, but it is allowed to enter timestamps  
within that range using non-GMT timezone offsets (which could make the  
nominal date 4714-11-23 BC or ENDYEAR-01-01 AD).  This eliminates  
dump/reload failure conditions for timestamps near the endpoints.  
To do this, separate checking of the inputs for date2j() from the  
final range check, and allow the Julian date code to handle a range  
slightly wider than the nominal range of the datatypes.  
  
Also add a bunch of checks to detect out-of-range dates and timestamps  
that formerly could be returned by operations such as date-plus-integer.  
All C-level functions that return date, timestamp, or timestamptz should  
now be proof against returning a value that doesn't pass IS_VALID_DATE()  
or IS_VALID_TIMESTAMP().  
  
Vitaly Burovoy, reviewed by Anastasia Lubennikova, and substantially  
whacked around by me  

M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/timestamp.c
M src/include/datatype/timestamp.h
M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/test/regress/expected/date.out
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/date.sql
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql

Another comment update.

commit   : f2b74b01d4a18241bd7560e74d527f3ba42d4738    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 16 Mar 2016 14:28:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 16 Mar 2016 14:28:25 -0400    

Click here for diff

I thought this was in my last commit, but I goofed.  

M src/backend/postmaster/pgstat.c

Fix problems in commit c16dc1aca5e01e6acaadfcf38f5fc964a381dc62.

commit   : bc55cc0b6a4af048f46c7e46c9e9c1f24b7ee9b8    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 16 Mar 2016 13:54:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 16 Mar 2016 13:54:04 -0400    

Click here for diff

Vinayak Pokale provided a patch for a copy-and-paste error in a  
comment.  I noticed that I'd use the word "automatically" nearby where  
I meant to talk about things being "atomic".  Rahila Syed spotted a  
misplaced counter update.  Fix all that stuff.  

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

Add files forgotten in f576b17cd6ba653bdace1f0da9a3b57f4984e460

commit   : e4b523e5b52a84010a34fc0796904ce39116e56c    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 16 Mar 2016 19:23:41 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 16 Mar 2016 19:23:41 +0300    

Click here for diff

A contrib/pg_trgm/data/trgm2.data
A contrib/pg_trgm/expected/pg_word_trgm.out
A contrib/pg_trgm/sql/pg_word_trgm.sql

Add word_similarity to pg_trgm contrib module.

commit   : f576b17cd6ba653bdace1f0da9a3b57f4984e460    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 16 Mar 2016 18:59:21 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 16 Mar 2016 18:59:21 +0300    

Click here for diff

Patch introduces a concept of similarity over string and just a word from  
another string.  
  
Version of extension is not changed because 1.2 was already introduced in 9.6  
release cycle, so, there wasn't a public version.  
  
Author: Alexander Korotkov, Artur Zakirov  

M contrib/pg_trgm/Makefile
M contrib/pg_trgm/expected/pg_trgm.out
M contrib/pg_trgm/pg_trgm–1.1–1.2.sql
M contrib/pg_trgm/pg_trgm–1.2.sql
M contrib/pg_trgm/sql/pg_trgm.sql
M contrib/pg_trgm/trgm.h
M contrib/pg_trgm/trgm_gin.c
M contrib/pg_trgm/trgm_gist.c
M contrib/pg_trgm/trgm_op.c
M doc/src/sgml/pgtrgm.sgml

Fix typo.

commit   : 1c4f001b79878deb9475e5b32ff4ef87773c9f23    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 16 Mar 2016 11:38:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 16 Mar 2016 11:38:30 -0400    

Click here for diff

Amit Langote  

M doc/src/sgml/monitoring.sgml

Add idle_in_transaction_session_timeout.

commit   : c6dda1f48e573cc60fe25d8d470a05bfabed0252    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 16 Mar 2016 11:30:45 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 16 Mar 2016 11:30:45 -0400    

Click here for diff

Vik Fearing, reviewed by Stéphane Schildknecht and me, and revised  
slightly by me.  

M doc/src/sgml/config.sgml
M doc/src/sgml/mvcc.sgml
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/postgres.c
M src/backend/utils/errcodes.txt
M src/backend/utils/init/globals.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/miscadmin.h
M src/include/storage/proc.h
M src/include/utils/timeout.h

GUC variable pg_trgm.similarity_threshold insead of set_limit()

commit   : 5871b88487cfd07966e2ce08609a4d6d5ee9718e    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 16 Mar 2016 17:44:58 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 16 Mar 2016 17:44:58 +0300    

Click here for diff

Use GUC variable pg_trgm.similarity_threshold insead of  
set_limit()/show_limit() which was introduced when defining GUC varuables  
by modules was absent.  
  
Author: Artur Zakirov  

M contrib/pg_trgm/pg_trgm–1.2.sql
M contrib/pg_trgm/trgm.h
M contrib/pg_trgm/trgm_gin.c
M contrib/pg_trgm/trgm_gist.c
M contrib/pg_trgm/trgm_op.c
M doc/src/sgml/pgtrgm.sgml

UCS_to_EUC_JIS_2004.pl: Turn off "test" mode by default

commit   : f9e5ed61ed1e27390051e8eb10bd9ec4cb40d7b2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    

Click here for diff

It produces debugging output files that are of no further use, so we  
don't need that by default.  

M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl

Make spacing and punctuation consistent

commit   : 9dbcb500cad06f2dd1c699e8dbcfbe23145e61fa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    

Click here for diff

M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl

fix typo in comment

commit   : ce91b9209f221f9555d340b40e02aaf8cdc777e4    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 16 Mar 2016 17:18:14 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 16 Mar 2016 17:18:14 +0300    

Click here for diff

M contrib/unaccent/generate_unaccent_rules.py

Improve script generating unaccent rules

commit   : 9a206d063c410df7cd5da01b169b23bff413fef5    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 16 Mar 2016 16:47:03 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 16 Mar 2016 16:47:03 +0300    

Click here for diff

Script now use the standard Unicode transliterator Latin-ASCII.  
  
Author: Leonard Benedetti  

M contrib/unaccent/generate_unaccent_rules.py
M contrib/unaccent/unaccent.rules

Fix typos.

commit   : 3aff33aa687e47d52f453892498b30ac98a296af    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2016 18:06:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2016 18:06:11 -0400    

Click here for diff

Oskari Saarenmaa  

M contrib/pgcrypto/sha1.h
M contrib/sepgsql/label.c
M doc/src/sgml/sources.sgml
M src/backend/access/transam/twophase.c
M src/backend/libpq/auth.c
M src/backend/optimizer/util/relnode.c
M src/backend/parser/parse_target.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/misc/guc.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_upgrade/option.c
M src/bin/pgbench/pgbench.c
M src/include/storage/shm_toc.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/type.c
M src/test/regress/expected/inherit.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/replica_identity.sql

Avoid incorrectly indicating exclusion constraint wait

commit   : fd658dbb300456b393536802d1145a9cea7b25d6    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 15 Mar 2016 18:04:39 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 15 Mar 2016 18:04:39 -0400    

Click here for diff

INSERT ... ON CONFLICT's precheck may have to wait on the outcome of  
another insertion, which may or may not itself be a speculative  
insertion.  This wait is not necessarily associated with an exclusion  
constraint, but was always reported that way in log messages if the wait  
happened to involve a tuple that had no speculative token.  
  
Initially discovered through use of ON CONFLICT DO NOTHING, where  
spurious references to exclusion constraints in log messages were more  
likely.  
  
Patch by Peter Geoghegan.  
Reviewed by Julien Rouhaud.  
  
Back-patch to 9.5 where INSERT ... ON CONFLICT was added.  

M src/backend/executor/execIndexing.c

Fix typos in comments

commit   : 5bcc413f80de4e0bc8f0df15d7d0ac2e8272dec5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 15 Mar 2016 17:57:17 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 15 Mar 2016 17:57:17 -0300    

Click here for diff

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

postgres_fdw: make_tuple_from_result_row should set cur_attno for ctid.

commit   : 4a46a99d8936328ab00e54bf8a2900832c4687e7    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2016 16:51:56 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2016 16:51:56 -0400    

Click here for diff

There's no reason for this function to do this for every other  
attribute number and omit it for CTID, especially since  
conversion_error_callback has code to handle that case.  This seems  
to be an oversight in commit e690b9515072fd7767fdeca5c54166f6a77733bc.  
  
Etsuro Fujita  

M contrib/postgres_fdw/postgres_fdw.c

Fix typos.

commit   : 2a90cb69e18e0c0637f3f93702e7b2f7808ff1b2    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2016 16:28:17 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2016 16:28:17 -0400    

Click here for diff

Thomas Reiss  

M doc/src/sgml/monitoring.sgml

Add simple VACUUM progress reporting.

commit   : c16dc1aca5e01e6acaadfcf38f5fc964a381dc62    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2016 13:31:18 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2016 13:31:18 -0400    

Click here for diff

There's a lot more that could be done here yet - in particular, this  
reports only very coarse-grained information about the index vacuuming  
phase - but even as it stands, the new pg_stat_progress_vacuum can  
tell you quite a bit about what a long-running vacuum is actually  
doing.  
  
Amit Langote and Robert Haas, based on earlier work by Vinayak Pokale  
and Rahila Syed.  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/commands/vacuumlazy.c
M src/backend/postmaster/pgstat.c
M src/include/catalog/catversion.h
A src/include/commands/progress.h
M src/include/pgstat.h
M src/test/regress/expected/rules.out

Cope if platform declares mbstowcs_l(), but not locale_t, in <xlocale.h>.

commit   : 0e9b89986b7ced6daffdf14638a25a35c45423ff    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Mar 2016 13:19:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Mar 2016 13:19:57 -0400    

Click here for diff

Previously, we included <xlocale.h> only if necessary to get the definition  
of type locale_t.  According to notes in PGAC_TYPE_LOCALE_T, this is  
important because on some versions of glibc that file supplies an  
incompatible declaration of locale_t.  (This info may be obsolete, because  
on my RHEL6 box that seems to be the *only* definition of locale_t; but  
there may still be glibc's in the wild for which it's a live concern.)  
  
It turns out though that on FreeBSD and maybe other BSDen, you can get  
locale_t from stdlib.h or locale.h but mbstowcs_l() and friends only from  
<xlocale.h>.  This was leaving us compiling calls to mbstowcs_l() and  
friends with no visible prototype, which causes a warning and could  
possibly cause actual trouble, since it's not declared to return int.  
  
Hence, adjust the configure checks so that we'll include <xlocale.h>  
either if it's necessary to get type locale_t or if it's necessary to  
get a declaration of mbstowcs_l().  
  
Report and patch by Aleksander Alekseev, somewhat whacked around by me.  
Back-patch to all supported branches, since we have been using  
mbstowcs_l() since 9.1.  

M config/c-library.m4
M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/utils/pg_locale.h

Add a GetForeignUpperPaths callback function for FDWs.

commit   : 101fd9349eddb7e9ed84a239145d5230a9bc7336    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 20:04:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 20:04:44 -0400    

Click here for diff

This is basically like the just-added create_upper_paths_hook, but  
control is funneled only to the FDW responsible for all the baserels  
of the current query; so providing such a callback is much less likely  
to add useless overhead than using the hook function is.  
  
The documentation is a bit sketchy.  We'll likely want to improve it,  
and/or adjust the call conventions, when we get some experience with  
actually using this callback.  Hopefully somebody will find time to  
experiment with it before 9.6 feature freeze.  

M doc/src/sgml/fdwhandler.sgml
M src/backend/optimizer/README
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/include/foreign/fdwapi.h

Add missing include for self-containment

commit   : be6de4c1215a8ad5607b1fcc7e9e6da1de780877    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 14 Mar 2016 19:56:33 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 14 Mar 2016 19:56:33 -0400    

Click here for diff

M src/include/common/controldata_utils.h

Fix EXPLAIN ANALYZE SELECT INTO not to choose a parallel plan.

commit   : 270b7daf5cb1e955f8771ec819eb810057d1779b    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 14 Mar 2016 19:48:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 14 Mar 2016 19:48:46 -0400    

Click here for diff

We don't support any parallel write operations at present, so choosing  
a parallel plan causes us to error out.  Also, add a new regression  
test that uses EXPLAIN ANALYZE SELECT INTO; if we'd had this previously,  
force_parallel_mode testing would have caught this issue.  
  
Mithun Cy and Robert Haas  

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

Provide a planner hook at a suitable place for creating upper-rel Paths.

commit   : 5864d6a4b62ada2ad60a8c456b4ee62972a9c10d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 19:23:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 19:23:29 -0400    

Click here for diff

In the initial revision of the upper-planner pathification work, the only  
available way for an FDW or custom-scan provider to inject Paths  
representing post-scan-join processing was to insert them during scan-level  
GetForeignPaths or similar processing.  While that's not impossible, it'd  
require quite a lot of duplicative processing to look forward and see if  
the extension would be capable of implementing the whole query.  To improve  
matters for custom-scan providers, provide a hook function at the point  
where the core code is about to start filling in upperrel Paths.  At this  
point Paths are available for the whole scan/join tree, which should reduce  
the amount of redundant effort considerably.  
  
(An alternative design that was suggested was to provide a separate hook  
for each post-scan-join processing step, but that seems messy and not  
clearly more useful.)  
  
Following our time-honored tradition, there's no documentation for this  
hook outside the source code.  
  
As-is, this hook is only meant for custom scan providers, which we can't  
assume very much about.  A followon patch will implement an FDW callback  
to let FDWs do the same thing in a somewhat more structured fashion.  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepjointree.c
M src/include/nodes/relation.h
M src/include/optimizer/planner.h

Allow callers of create_foreignscan_path to specify nondefault PathTarget.

commit   : 28048cbaa285b8ac46940e4b39f985d9885fc698    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 17:31:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 17:31:28 -0400    

Click here for diff

Although the default choice of rel->reltarget should typically be  
sufficient for scan or join paths, it's not at all sufficient for the  
purposes PathTargets were invented for; in particular not for  
upper-relation Paths.  So break API compatibility by adding a PathTarget  
argument to create_foreignscan_path().  To ease updating of existing  
code, accept a NULL value of the argument as selecting rel->reltarget.  

M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/optimizer/util/pathnode.c
M src/include/optimizer/pathnode.h

Rethink representation of PathTargets.

commit   : 307c78852f516042cebacaed411a0391bfeb2129    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 16:59:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 16:59:59 -0400    

Click here for diff

In commit 19a541143a09c067 I did not make PathTarget a subtype of Node,  
and embedded a RelOptInfo's reltarget directly into it rather than having  
a separately-allocated Node.  In hindsight that was misguided  
micro-optimization, enabled by the fact that at that point we didn't have  
any Paths with custom PathTargets.  Now that PathTarget processing has  
been fleshed out some more, it's easier to see that it's better to have  
PathTarget as an indepedent Node type, even if it does cost us one more  
palloc to create a RelOptInfo.  So change it while we still can.  
  
This commit just changes the representation, without doing anything more  
interesting than that.  

M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/fdwhandler.sgml
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/tlist.c
M src/include/nodes/nodes.h
M src/include/nodes/relation.h

Update PL/Perl's comment about hv_store().

commit   : 07341a2980a37ccbb3a51af2bd2f3c87953d8ea4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 14:45:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 14:45:45 -0400    

Click here for diff

Negative klen is documented since Perl 5.16, and 5.6 is no longer  
supported so no need to comment about it.  
  
Dagfinn Ilmari Mannsåker  

M src/pl/plperl/plperl.c

Improve conversions from uint64 to Perl types.

commit   : f3f3aae4b7841f4dc51129691a7404a03eb55449    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 14:38:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 14:38:36 -0400    

Click here for diff

Perl's integers are pointer-sized, so can hold more than INT_MAX on LP64  
platforms, and come in both signed (IV) and unsigned (UV).  Floating  
point values (NV) may also be larger than double.  
  
Since Perl 5.19.4 array indices are SSize_t instead of I32, so allow up  
to SSize_t_max on those versions.  The limit is not imposed just by  
av_extend's argument type, but all the array handling code, so remove  
the speculative comment.  
  
Dagfinn Ilmari Mannsåker  

M src/pl/plperl/plperl.c
M src/pl/plperl/plperl.h

Update more comments for 96198d94cb7adc664bda341842dc8db671d8be72.

commit   : 6be84eeb8d5a72014b1b6e44d0646f69531a1ccf    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 14 Mar 2016 14:27:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 14 Mar 2016 14:27:11 -0400    

Click here for diff

Etsuro Fujita, reviewed (though not completely endorsed) by Ashutosh  
Bapat, and slightly expanded by me.  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/optimizer/path/joinpath.c
M src/include/nodes/relation.h

Use repalloc_huge() to enlarge a SPITupleTable's tuple pointer array.

commit   : 74a379b984d4df91acec2436a16c51caee3526af    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 14:22:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 14:22:16 -0400    

Click here for diff

Commit 23a27b039d94ba35 widened the rows-stored counters to uint64, but  
that's academic unless we allow the tuple pointer array to exceed 1GB.  
  
(It might be a good idea to provide some other limit on how much storage  
a SPITupleTable can eat.  On the other hand, there are plenty of other  
ways to drive a backend into swap hell.)  
  
Dagfinn Ilmari Mannsåker  

M src/backend/executor/spi.c

Improve check for overly-long extensible node name.

commit   : 3adf9ced17dfa84faa209127b4499e5a5b995806    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 14 Mar 2016 13:48:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 14 Mar 2016 13:48:35 -0400    

Click here for diff

The old code is bad for two reasons.  First, it has an off-by-one  
error.  Second, it won't help if you aren't running with assertions  
enabled.  Per discussion, we want a check here in that case too.  
  
Author: KaiGai Kohei, adjusted by me.  
Reviewed-by: Petr Jelinek  
Discussion: [email protected]  

M src/backend/nodes/extensible.c

pg_stat_get_progress_info() should be marked STRICT.

commit   : 2da75499879032d8d2f233ca42cc2efe48fd76ef    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 12:51:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 12:51:55 -0400    

Click here for diff

I didn't bother with a catversion bump.  
  
Report and patch by Thomas Munro  

M src/include/catalog/pg_proc.h

Teach the configure script to validate its --with-pgport argument.

commit   : bf53d5c208a3bdce243a38666fc50f5418c78c3b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 10:41:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Mar 2016 10:41:29 -0400    

Click here for diff

Previously, configure would take any string, including an empty string,  
leading to obscure compile failures in guc.c.  It seems worth expending  
a few lines of code to ensure that the argument is a decimal number  
between 1 and 65535.  
  
Report and patch by Jim Nasby; reviews by Alex Shulgin, Peter Eisentraut,  
Ivan Kartyshov  

M configure
M configure.in

Mop-up for setting minimum Tcl version to 8.4.

commit   : 9da70efcbe09954b1006f878d39885a4acf1c534    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Mar 2016 17:14:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Mar 2016 17:14:49 -0400    

Click here for diff

Commit e2609323e set the minimum Tcl version we support to 8.4, but  
I forgot to adjust the documentation to say the same.  Some nosing  
around for other consequences found that the configure script could  
be simplified slightly as well.  

M config/tcl.m4
M configure
M doc/src/sgml/installation.sgml

Fix memory leak in repeated GIN index searches.

commit   : ab4ff2889d0bccc32467e681546aabdb87de4958    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Mar 2016 16:44:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Mar 2016 16:44:10 -0400    

Click here for diff

Commit d88976cfa1302e8d removed this code from ginFreeScanKeys():  
-		if (entry->list)  
-			pfree(entry->list);  
evidently in the belief that that ItemPointer array is allocated in the  
keyCtx and so would be reclaimed by the following MemoryContextReset.  
Unfortunately, it isn't and it won't.  It'd likely be a good idea for  
that to become so, but as a simple and back-patchable fix in the  
meantime, restore this code to ginFreeScanKeys().  
  
Also, add a similar pfree to where startScanEntry() is about to zero out  
entry->list.  I am not sure if there are any code paths where this  
change prevents a leak today, but it seems like cheap future-proofing.  
  
In passing, make the initial allocation of so->entries[] use palloc  
not palloc0.  The code doesn't depend on unused entries being zero;  
if it did, the array-enlargement code in ginFillScanEntry() would be  
wrong.  So using palloc0 initially can only serve to confuse readers  
about what the invariant is.  
  
Per report from Felipe de Jesús Molina Bravo, via Jaime Casanova in  
<CAJGNTeMR1ndMU2Thpr8GPDUfiHTV7idELJRFusA5UXUGY1y-eA@mail.gmail.com>  

M src/backend/access/gin/ginget.c
M src/backend/access/gin/ginscan.c

Fix whitespace and remove obsolete gitattributes entry

commit   : 96adb14d931e442e0a96f418d483fc896506146f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 13 Mar 2016 16:03:13 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 13 Mar 2016 16:03:13 -0400    

Click here for diff

M .gitattributes
M src/backend/tsearch/dicts/hunspell_sample.affix
M src/backend/tsearch/dicts/hunspell_sample_long.affix
M src/backend/tsearch/dicts/hunspell_sample_num.affix
M src/backend/tsearch/spell.c
M src/test/regress/sql/tstypes.sql

Rename auto_explain.sample_ratio to sample_rate

commit   : 7a8d8748362d4d8505e320c3eaab4a2c2463e3a6    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 13 Mar 2016 13:18:03 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 13 Mar 2016 13:18:03 +0100    

Click here for diff

Per suggestion from Tomas Vondra  
  
Author: Julien Rouhaud  

M contrib/auto_explain/auto_explain.c
M doc/src/sgml/auto-explain.sgml

Fix order of MemSet arguments

commit   : a1aa8b7ea0558620106e25c27d0a70ee4ac9d6a8    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 13 Mar 2016 13:11:06 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 13 Mar 2016 13:11:06 +0100    

Click here for diff

Noted by Tomas Vondra  

M src/bin/pg_basebackup/pg_basebackup.c

Report memory context stats upon out-of-memory in repalloc[_huge].

commit   : 4b980167cb5a489346c5e53afb86280a7d59ebc7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Mar 2016 00:21:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Mar 2016 00:21:07 -0500    

Click here for diff

This longstanding functionality evidently got lost in commit  
3d6d1b585524aab6.  Noted while studying an OOM report from Jaime  
Casanova.  Backpatch to 9.5 where the bug was introduced.  

M src/backend/utils/mmgr/mcxt.c

Fix Windows portability issue in 23a27b039d94ba35.

commit   : ab737f6ba9fc0a26d32a95b115d5cd0e24a63191    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 12 Mar 2016 22:34:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 12 Mar 2016 22:34:47 -0500    

Click here for diff

_strtoui64() is available in MSVC builds, but apparently not with  
other Windows toolchains.  Thanks to Petr Jelinek for the diagnosis.  

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

Get rid of scribbling on a const variable in psql's print.c.

commit   : fc7a9dfddb073a55a226778acd6a9b3f5ea2e626    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 12 Mar 2016 18:16:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 12 Mar 2016 18:16:24 -0500    

Click here for diff

Commit a2dabf0e1dda93c8 had the bright idea that it could modify a "const"  
global variable if it merely casted away const from a pointer.  This does  
not work on platforms where the compiler puts "const" variables into  
read-only storage.  Depressingly, we evidently have no such platforms in  
our buildfarm ... an oversight I have now remedied.  (The one platform  
that is known to catch this is recent OS X with -fno-common.)  
  
Per report from Chris Ruprecht.  Back-patch to 9.5 where the bogus  
code was introduced.  

M src/bin/psql/print.c
M src/bin/psql/print.h

Widen query numbers-of-tuples-processed counters to uint64.

commit   : 23a27b039d94ba359286694831eafe03cd970eef    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 12 Mar 2016 16:05:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 12 Mar 2016 16:05:10 -0500    

Click here for diff

This patch widens SPI_processed, EState's es_processed field, PortalData's  
portalPos field, FuncCallContext's call_cntr and max_calls fields,  
ExecutorRun's count argument, PortalRunFetch's result, and the max number  
of rows in a SPITupleTable to uint64, and deals with (I hope) all the  
ensuing fallout.  Some of these values were declared uint32 before, and  
others "long".  
  
I also removed PortalData's posOverflow field, since that logic seems  
pretty useless given that portalPos is now always 64 bits.  
  
The user-visible results are that command tags for SELECT etc will  
correctly report tuple counts larger than 4G, as will plpgsql's GET  
GET DIAGNOSTICS ... ROW_COUNT command.  Queries processing more tuples  
than that are still not exactly the norm, but they're becoming more  
common.  
  
Most values associated with FETCH/MOVE distances, such as PortalRun's count  
argument and the count argument of most SPI functions that have one, remain  
declared as "long".  It's not clear whether it would be worth promoting  
those to int64; but it would definitely be a large dollop of additional  
API churn on top of this, and it would only help 32-bit platforms which  
seem relatively less likely to see any benefit.  
  
Andreas Scherbaum, reviewed by Christian Ullrich, additional hacking by me  

M contrib/auto_explain/auto_explain.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/spi/refint.c
M contrib/tablefunc/tablefunc.c
M contrib/xml2/xpath.c
M doc/src/sgml/spi.sgml
M src/backend/commands/createas.c
M src/backend/commands/portalcmds.c
M src/backend/executor/execMain.c
M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/backend/tcop/pquery.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/tsquery_rewrite.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/xml.c
M src/include/executor/executor.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.h
M src/include/funcapi.h
M src/include/nodes/execnodes.h
M src/include/postgres.h
M src/include/tcop/pquery.h
M src/include/utils/builtins.h
M src/include/utils/portal.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_spi.c
M src/pl/tcl/pltcl.c
M src/test/regress/regress.c

Include portability/mem.h into fd.c for MAP_FAILED.

commit   : e01157500f26342bf4f067a4eb1e45ab9a3cd410    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 12 Mar 2016 12:16:48 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 12 Mar 2016 12:16:48 -0800    

Click here for diff

Buildfarm members gaur and pademelon are old enough not to know about  
MAP_FAILED; which is used in 428b1d6. Include portability/mem.h to fix;  
as already done in a bunch of other places.  

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

Re-export a few of createplan.c's make_xxx() functions.

commit   : 570be1f73f385abb557bda15b718d7aac616cc15    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 12 Mar 2016 12:12:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 12 Mar 2016 12:12:59 -0500    

Click here for diff

CitusDB is using these and don't wish to redesign their code right now.  
I am not on board with this being a good idea, or a good precedent,  
but I lack the energy to fight about it.  

M src/backend/optimizer/plan/createplan.c
M src/include/optimizer/planmain.h

pg_upgrade: Convert old visibility map format to new format.

commit   : 7087166a88fe0c04fc6636d0d6d6bea1737fc1fb    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 11 Mar 2016 12:28:22 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 11 Mar 2016 12:28:22 -0500    

Click here for diff

Commit a892234f830e832110f63fc0a2afce2fb21d1584 added a second bit per  
page to the visibility map, but pg_upgrade has been unaware of it up  
until now.  Therefore, a pg_upgrade from an earlier major release of  
PostgreSQL to any commit preceding this one and following the one  
mentioned above would result in invalid visibility map contents on the  
new cluster, very possibly leading to data corruption.  This plugs  
that hole.  
  
Masahiko Sawada, reviewed by Jeff Janes, Bruce Momjian, Simon Riggs,  
Michael Paquier, Andres Freund, me, and others.  

M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c

When appropriate, postpone SELECT output expressions till after ORDER BY.

commit   : 9118d03a8cca3d97327c56bf89a72e328e454e63    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Mar 2016 12:27:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Mar 2016 12:27:41 -0500    

Click here for diff

It is frequently useful for volatile, set-returning, or expensive functions  
in a SELECT's targetlist to be postponed till after ORDER BY and LIMIT are  
done.  Otherwise, the functions might be executed for every row of the  
table despite the presence of LIMIT, and/or be executed in an unexpected  
order.  For example, in  
	SELECT x, nextval('seq') FROM tab ORDER BY x LIMIT 10;  
it's probably desirable that the nextval() values are ordered the same  
as x, and that nextval() is not run more than 10 times.  
  
In the past, Postgres was inconsistent in this area: you would get the  
desirable behavior if the ordering were performed via an indexscan, but  
not if it had to be done by an explicit sort step.  Getting the desired  
behavior reliably required contortions like  
	SELECT x, nextval('seq')  
	  FROM (SELECT x FROM tab ORDER BY x) ss LIMIT 10;  
  
This patch conditionally postpones evaluation of pure-output target  
expressions (that is, those that are not used as DISTINCT, ORDER BY, or  
GROUP BY columns) so that they effectively occur after sorting, even if an  
explicit sort step is necessary.  Volatile expressions and set-returning  
expressions are always postponed, so as to provide consistent semantics.  
Expensive expressions (costing more than 10 times typical operator cost,  
which by default would include any user-defined function) are postponed  
if there is a LIMIT or if there are expressions that must be postponed.  
  
We could be more aggressive and postpone any nontrivial expression, but  
there are costs associated with doing so: it requires an extra Result plan  
node which adds some overhead, and postponement changes the volume of data  
going through the sort step, perhaps for the worse.  Since we tend not to  
have very good estimates of the output width of nontrivial expressions,  
it's hard to have much confidence in our ability to predict whether  
postponement would increase or decrease the cost of the sort; therefore  
this patch doesn't attempt to make decisions conditionally on that.  
Between these factors and a general desire not to change query behavior  
when there's not a demonstrable benefit, it seems best to be conservative  
about applying postponement.  We might tweak the decision rules in the  
future, though.  
  
Konstantin Knizhnik, heavily rewritten by me  

M doc/src/sgml/ref/select.sgml
M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/limit.out
M src/test/regress/sql/limit.sql

Fix Windows build broken in 6943a946c7e5eb72d53c0ce71f08a81a133503bd

commit   : b1fdc727c37b23da947b4b0d440f723f31beb84d    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 11 Mar 2016 20:10:20 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 11 Mar 2016 20:10:20 +0300    

Click here for diff

Also it fixes dynamic array allocation disallowed by ANSI-C.  
  
Author: Stas Kelvich  

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

Fix merge affixes for numeric ones

commit   : 8829af47ef63d3c484f2e1f97a85a7a76b1baba6    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 11 Mar 2016 19:47:50 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 11 Mar 2016 19:47:50 +0300    

Click here for diff

Some dictionaries have duplicated base words with different affix set, we  
just merge that sets into one set. But previously merging of sets of affixes  
was actually a concatenation of strings but it's wrong for numeric  
representation of affixes because such representation uses comma to  
separate affixes.  
  
Author: Artur Zakirov  

M src/backend/tsearch/spell.c

Bump catalog version missed in 6943a946c7e5eb72d53c0ce71f08a81a133503bd

commit   : a9eb6c83efd258bb7a658fefa0074e0e65efd673    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 11 Mar 2016 19:31:04 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 11 Mar 2016 19:31:04 +0300    

Click here for diff

M src/include/catalog/catversion.h

Tsvector editing functions

commit   : 6943a946c7e5eb72d53c0ce71f08a81a133503bd    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 11 Mar 2016 19:22:36 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 11 Mar 2016 19:22:36 +0300    

Click here for diff

Adds several tsvector editting function: convert tsvector to/from text array,  
set weight for given lexemes, delete lexeme(s), unnest, filter lexemes  
with given weights  
  
Author: Stas Kelvich with some editorization by me  
Reviewers: Tomas Vondram, Teodor Sigaev  

M doc/src/sgml/func.sgml
M doc/src/sgml/textsearch.sgml
M src/backend/utils/adt/tsvector_op.c
M src/include/catalog/pg_proc.h
M src/include/tsearch/ts_type.h
M src/test/regress/expected/tstypes.out
M src/test/regress/sql/tstypes.sql

Minor additional refactoring of planner.c's PathTarget handling.

commit   : 49635d7b3e86c0088eadd80db1563a210bc89efd    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Mar 2016 10:24:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Mar 2016 10:24:33 -0500    

Click here for diff

Teach make_group_input_target() and make_window_input_target() to work  
entirely with the PathTarget representation of tlists, rather than  
constructing a tlist and immediately deconstructing it into PathTarget  
format.  In itself this only saves a few palloc's; the bigger picture is  
that it opens the door for sharing cost_qual_eval work across all of  
planner.c's constructions of PathTargets.  I'll come back to that later.  
  
In support of this, flesh out tlist.c's infrastructure for PathTargets  
a bit more.  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/tlist.c
M src/include/optimizer/tlist.h

Allow setting sample ratio for auto_explain

commit   : 92f03fe76fe6be683a8b7497579158b8a82b2c25    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 11 Mar 2016 15:08:34 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 11 Mar 2016 15:08:34 +0100    

Click here for diff

New configuration parameter auto_explain.sample_ratio makes it  
possible to log just a fraction of the queries meeting the configured  
threshold, to reduce the amount of logging.  
  
Author: Craig Ringer and Julien Rouhaud  
Review: Petr Jelinek  

M contrib/auto_explain/auto_explain.c
M doc/src/sgml/auto-explain.sgml

psql: Don't automatically use expanded format when there's 1 column.

commit   : 69ab7b9d6c9b9e1d782ffad6e440a3615c63f621    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 11 Mar 2016 08:04:01 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 11 Mar 2016 08:04:01 -0500    

Click here for diff

Andreas Karlsson and Robert Haas  

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

Fix a typo, and remove unnecessary pgstat_report_wait_end().

commit   : 481c76abf4f5dc99af28a799741c324732a299c6    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 11 Mar 2016 07:32:59 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 11 Mar 2016 07:32:59 -0500    

Click here for diff

Per Amit Kapila.  

M src/backend/access/transam/xact.c
M src/backend/storage/lmgr/lwlock.c

Refactor receivelog.c parameters

commit   : 38c83c9b7569378d864d8915e291716b8bec15f2    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 11 Mar 2016 11:08:01 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 11 Mar 2016 11:08:01 +0100    

Click here for diff

Much cruft had accumulated over time with a large number of parameters  
passed down between functions very deep. With this refactoring, instead  
introduce a StreamCtl structure that holds the parameters, and pass around  
a pointer to this structure instead. This makes it much easier to add or  
remove fields that are needed deeper down in the implementation without  
having to modify every function header in the file.  
  
Patch by me after much nagging from Andres  
Reviewed by Craig Ringer and Daniel Gustafsson  

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

Allow emit_log_hook to see original message text

commit   : 73e7e49da3b23a15cd84f003e11ad7d55ad80da7    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 11 Mar 2016 09:53:06 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 11 Mar 2016 09:53:06 +0000    

Click here for diff

emit_log_hook could only see the translated text, making it harder to identify  
which message was being sent. Pass original text to allow the exact message to  
be identified, whichever language is used for logging.  
  
Discussion: [email protected]  
Author: Kyotaro Horiguchi  

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

Simplify GetLockNameFromTagType.

commit   : a414d96ad2b001cddf10e3dedb0bde96d0af6a0b    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 10 Mar 2016 21:37:22 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 10 Mar 2016 21:37:22 -0500    

Click here for diff

The old code is wrong, because it returns a pointer to an automatic  
variable.  And it's also more clever than we really need to be  
considering that the case it's worrying about should never happen.  

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

Blindly try to fix dtrace enabled builds, broken in 9cd00c45.

commit   : c94f0c29cecc7944a14aa645c8a97a7250bf146b    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 10 Mar 2016 17:49:43 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 10 Mar 2016 17:49:43 -0800    

Click here for diff

Reported-By: Peter Eisentraut  
Discussion: [email protected]  

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

Checkpoint sorting and balancing.

commit   : 9cd00c457e6a1ebb984167ac556a9961812a683c    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 19 Feb 2016 12:17:51 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 19 Feb 2016 12:17:51 -0800    

Click here for diff

Up to now checkpoints were written in the order they're in the  
BufferDescriptors. That's nearly random in a lot of cases, which  
performs badly on rotating media, but even on SSDs it causes slowdowns.  
  
To avoid that, sort checkpoints before writing them out. We currently  
sort by tablespace, relfilenode, fork and block number.  
  
One of the major reasons that previously wasn't done, was fear of  
imbalance between tablespaces. To address that balance writes between  
tablespaces.  
  
The other prime concern was that the relatively large allocation to sort  
the buffers in might fail, preventing checkpoints from happening. Thus  
pre-allocate the required memory in shared memory, at server startup.  
  
This particularly makes it more efficient to have checkpoint flushing  
enabled, because that'll often result in a lot of writes that can be  
coalesced into one flush.  
  
Discussion: alpine.DEB.2.10.1506011320000.28433@sto  
Author: Fabien Coelho and Andres Freund  

M src/backend/storage/buffer/README
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/include/storage/buf_internals.h
M src/tools/pgindent/typedefs.list

Allow to trigger kernel writeback after a configurable number of writes.

commit   : 428b1d6b29ca599c5700d4bc4f4ce4c5880369bf    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 19 Feb 2016 12:13:05 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 19 Feb 2016 12:13:05 -0800    

Click here for diff

Currently writes to the main data files of postgres all go through the  
OS page cache. This means that some operating systems can end up  
collecting a large number of dirty buffers in their respective page  
caches.  When these dirty buffers are flushed to storage rapidly, be it  
because of fsync(), timeouts, or dirty ratios, latency for other reads  
and writes can increase massively.  This is the primary reason for  
regular massive stalls observed in real world scenarios and artificial  
benchmarks; on rotating disks stalls on the order of hundreds of seconds  
have been observed.  
  
On linux it is possible to control this by reducing the global dirty  
limits significantly, reducing the above problem. But global  
configuration is rather problematic because it'll affect other  
applications; also PostgreSQL itself doesn't always generally want this  
behavior, e.g. for temporary files it's undesirable.  
  
Several operating systems allow some control over the kernel page  
cache. Linux has sync_file_range(2), several posix systems have msync(2)  
and posix_fadvise(2). sync_file_range(2) is preferable because it  
requires no special setup, whereas msync() requires the to-be-flushed  
range to be mmap'ed. For the purpose of flushing dirty data  
posix_fadvise(2) is the worst alternative, as flushing dirty data is  
just a side-effect of POSIX_FADV_DONTNEED, which also removes the pages  
from the page cache.  Thus the feature is enabled by default only on  
linux, but can be enabled on all systems that have any of the above  
APIs.  
  
While desirable and likely possible this patch does not contain an  
implementation for windows.  
  
With the infrastructure added, writes made via checkpointer, bgwriter  
and normal user backends can be flushed after a configurable number of  
writes. Each of these sources of writes controlled by a separate GUC,  
checkpointer_flush_after, bgwriter_flush_after and backend_flush_after  
respectively; they're separate because the number of flushes that are  
good are separate, and because the performance considerations of  
controlled flushing for each of these are different.  
  
A later patch will add checkpoint sorting - after that flushes from the  
ckeckpoint will almost always be desirable. Bgwriter flushes are most of  
the time going to be random, which are slow on lots of storage hardware.  
Flushing in backends works well if the storage and bgwriter can keep up,  
but if not it can have negative consequences.  This patch is likely to  
have negative performance consequences without checkpoint sorting, but  
unfortunately so has sorting without flush control.  
  
Discussion: alpine.DEB.2.10.1506011320000.28433@sto  
Author: Fabien Coelho and Andres Freund  

M doc/src/sgml/config.sgml
M doc/src/sgml/wal.sgml
M src/backend/postmaster/bgwriter.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/misc/guc.c
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h
M src/include/storage/fd.h
M src/include/storage/smgr.h
M src/tools/pgindent/typedefs.list

Give pull_var_clause() reject/recurse/return behavior for WindowFuncs too.

commit   : c82c92b111b7b636e80f8a432de10c62011b35b6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Mar 2016 16:23:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Mar 2016 16:23:40 -0500    

Click here for diff

All along, this function should have treated WindowFuncs in a manner  
similar to Aggrefs, ie with an option whether or not to recurse into them.  
By not considering the case, it was always recursing, which is OK for most  
callers (although I suspect that the case in prepare_sort_from_pathkeys  
might represent a bug).  But now we need return-without-recursing behavior  
as well.  There are also more than a few callers that should never see a  
WindowFunc, and now we'll get some error checking on that.  

M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/var.c
M src/backend/utils/adt/selfuncs.c
M src/include/optimizer/var.h

Don't vacuum all-frozen pages.

commit   : fd31cd265138019dcccc9b5fe53043670898bc9f    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 10 Mar 2016 16:12:10 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 10 Mar 2016 16:12:10 -0500    

Click here for diff

Commit a892234f830e832110f63fc0a2afce2fb21d1584 gave us enough  
infrastructure to avoid vacuuming pages where every tuple on the  
page is already frozen.  So, replace the notion of a scan_all or  
whole-table vacuum with the less onerous notion of an "aggressive"  
vacuum, which will pages that are all-visible, but still skip those  
that are all-frozen.  
  
This should greatly reduce the cost of anti-wraparound vacuuming  
on large clusters where the majority of data is never touched  
between one cycle and the next, because we'll no longer have to  
read all of those pages only to find out that we don't need to  
do anything with them.  
  
Patch by me, reviewed by Masahiko Sawada.  

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

Refactor pull_var_clause's API to make it less tedious to extend.

commit   : 364a9f47ab363250f62dd2c381c4da435283725a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Mar 2016 15:52:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Mar 2016 15:52:58 -0500    

Click here for diff

In commit 1d97c19a0f748e94 and later c1d9579dd8bf3c92, we extended  
pull_var_clause's API by adding enum-type arguments.  That's sort of a pain  
to maintain, though, because it means every time we add a new behavior we  
must touch every last one of the call sites, even if there's a reasonable  
default behavior that most of them could use.  Let's switch over to using a  
bitmask of flags, instead; that seems more maintainable and might save a  
nanosecond or two as well.  This commit changes no behavior in itself,  
though I'm going to follow it up with one that does add a new behavior.  
  
In passing, remove flatten_tlist(), which has not been used since 9.1  
and would otherwise need the same API changes.  
  
Removing these enums means that optimizer/tlist.h no longer needs to  
depend on optimizer/var.h.  Changing that caused a number of C files to  
need addition of #include "optimizer/var.h" (probably we can thank old  
runs of pgrminclude for that); but on balance it seems like a good change  
anyway.  

M contrib/postgres_fdw/deparse.c
M src/backend/catalog/heap.c
M src/backend/commands/trigger.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/utils/adt/selfuncs.c
M src/include/optimizer/tlist.h
M src/include/optimizer/var.h

Rework wait for AccessExclusiveLocks on Hot Standby

commit   : 37c54863cf71a4a1126d21db8eb68974bef34374    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 10 Mar 2016 19:26:24 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 10 Mar 2016 19:26:24 +0000    

Click here for diff

Earlier version committed in 9.0 caused spurious waits in some cases.  
New infrastructure for lock waits in 9.3 used to correct and improve this.  
  
Jeff Janes based upon a proposal by Simon Riggs, who also reviewed  
Additional review comments from Amit Kapila  

M src/backend/postmaster/startup.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/standby.h
M src/include/utils/timeout.h

Provide much better wait information in pg_stat_activity.

commit   : 53be0b1add7064ca5db3cd884302dfc3268d884e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 10 Mar 2016 12:44:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 10 Mar 2016 12:44:09 -0500    

Click here for diff

When a process is waiting for a heavyweight lock, we will now indicate  
the type of heavyweight lock for which it is waiting.  Also, you can  
now see when a process is waiting for a lightweight lock - in which  
case we will indicate the individual lock name or the tranche, as  
appropriate - or for a buffer pin.  
  
Amit Kapila, Ildus Kurbangaliev, reviewed by me.  Lots of helpful  
discussion and suggestions by many others, including Alexander  
Korotkov, Vladimir Borodin, and many others.  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xact.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/system_views.sql
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/walsender.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/pgstat.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/lwlock.h
M src/include/storage/proc.h
M src/test/regress/expected/rules.out

Document BRIN a bit more thoroughly

commit   : a3a8309d450f7c4d1b743e84ba54ef5f7877d7be    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 10 Mar 2016 13:15:08 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 10 Mar 2016 13:15:08 -0300    

Click here for diff

The chapter "Interfacing Extensions To Indexes" and CREATE OPERATOR  
CLASS reference page were missed when BRIN was added.  We document  
all our other index access methods there, so make sure BRIN complies.  
  
Author: Álvaro Herrera  
Reported-By: Julien Rouhaud, Tom Lane  
Reviewed-By: Emre Hasegeli  
Discussion: https://www.postgresql.org/message-id/56CF604E.9000303%40dalibo.com  
Backpatch: 9.5, where BRIN was introduced  

M doc/src/sgml/ref/create_opclass.sgml
M doc/src/sgml/xindex.sgml

Avoid crash on old Windows with AVX2-capable CPU for VS2013 builds

commit   : 9d90388247e093cd9b3ead79954df2ac18bfeb66    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 10 Mar 2016 13:48:58 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 10 Mar 2016 13:48:58 +0100    

Click here for diff

The Visual Studio 2013 CRT generates invalid code when it makes a 64-bit  
build that is later used on a CPU that supports AVX2 instructions using a  
version of Windows before 7SP1/2008R2SP1.  
  
Detect this combination, and in those cases turn off the generation of  
FMA3, per recommendation from the Visual Studio team.  
  
The bug is actually in the CRT shipping with Visual Studio 2013, but  
Microsoft have stated they're only fixing it in newer major versions.  
The fix is therefor conditioned specifically on being built with this  
version of Visual Studio, and not previous or later versions.  
  
Author: Christian Ullrich  

M src/backend/main/main.c

Reduce size of two phase file header

commit   : e0694cf9c74455fb87beb0f4d66b4c8f5f53715e    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 10 Mar 2016 12:51:46 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 10 Mar 2016 12:51:46 +0000    

Click here for diff

Previously 2PC header was fixed at 200 bytes, which in most cases wasted  
WAL space for a workload using 2PC heavily.  
  
Pavan Deolasee, reviewed by Petr Jelinek  

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

Reduce lock level for altering fillfactor

commit   : fcb4bfddb6ff46e4495b923987ed6a89bd256174    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 10 Mar 2016 12:07:33 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 10 Mar 2016 12:07:33 +0000    

Click here for diff

Fabrízio de Royes Mello and Simon Riggs  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/access/common/reloptions.c
M src/test/regress/expected/alter_table.out

Code review for b6fb6471f6afaf649e52f38269fd8c5c60647669.

commit   : 090b287fc59e7a44da8c3e0823eecdc8ea4522f2    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 10 Mar 2016 06:07:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 10 Mar 2016 06:07:57 -0500    

Click here for diff

Reports by Tomas Vondra, Vinayak Pokale, and Aleksander Alekseev.  
Patch by Amit Langote.  

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

Remove a couple of useless pstrdup() calls.

commit   : cc402116ca156babcd3ef941317f462a96277e3a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Mar 2016 23:29:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Mar 2016 23:29:05 -0500    

Click here for diff

There's no point in pstrdup'ing the result of TextDatumGetCString,  
since that's necessarily already a freshly-palloc'd C string.  
  
These particular calls are unlikely to be of any consequence  
performance-wise, but still they're a bad precedent that can confuse  
future patch authors.  
  
Noted by Chapman Flack.  

M src/backend/foreign/foreign.c

Avoid unlikely data-loss scenarios due to rename() without fsync.

commit   : 1d4a0ab19a7e45aa8b94d7f720d1d9cefb81ec40    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 9 Mar 2016 18:53:53 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 9 Mar 2016 18:53:53 -0800    

Click here for diff

Renaming a file using rename(2) is not guaranteed to be durable in face  
of crashes. Use the previously added durable_rename()/durable_link_or_rename()  
in various places where we previously just renamed files.  
  
Most of the changed call sites are arguably not critical, but it seems  
better to err on the side of too much durability.  The most prominent  
known case where the previously missing fsyncs could cause data loss is  
crashes at the end of a checkpoint. After the actual checkpoint has been  
performed, old WAL files are recycled. When they're filled, their  
contents are fdatasynced, but we did not fsync the containing  
directory. An OS/hardware crash in an unfortunate moment could then end  
up leaving that file with its old name, but new content; WAL replay  
would thus not replay it.  
  
Reported-By: Tomas Vondra  
Author: Michael Paquier, Tomas Vondra, Andres Freund  
Discussion: [email protected]  
Backpatch: All supported branches  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/postmaster/pgarch.c
M src/backend/replication/logical/origin.c
M src/backend/utils/misc/guc.c

commit   : 606e0f9841b820d826f837bf741a3e5e9cc62fa1    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 9 Mar 2016 18:53:53 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 9 Mar 2016 18:53:53 -0800    

Click here for diff

Renaming a file using rename(2) is not guaranteed to be durable in face  
of crashes; especially on filesystems like xfs and ext4 when mounted  
with data=writeback. To be certain that a rename() atomically replaces  
the previous file contents in the face of crashes and different  
filesystems, one has to fsync the old filename, rename the file, fsync  
the new filename, fsync the containing directory.  This sequence is not  
generally adhered to currently; which exposes us to data loss risks. To  
avoid having to repeat this arduous sequence, introduce  
durable_rename(), which wraps all that.  
  
Also add durable_link_or_rename(). Several places use link() (with a  
fallback to rename()) to rename a file, trying to avoid replacing the  
target file out of paranoia. Some of those rename sequences need to be  
durable as well. There seems little reason extend several copies of the  
same logic, so centralize the link() callers.  
  
This commit does not yet make use of the new functions; they're used in  
a followup commit.  
  
Author: Michael Paquier, Andres Freund  
Discussion: [email protected]  
Backpatch: All supported branches  

M src/backend/replication/logical/origin.c
M src/backend/replication/slot.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/reinit.c
M src/include/storage/fd.h

doc: Reorganize pg_resetxlog reference page

commit   : e19e4cf0be2892d3c894d6e37b905024f5977ab2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 18:48:34 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 18:48:34 -0500    

Click here for diff

The pg_resetxlog reference page didn't have a proper options list, only  
running text listing the options and some explanations of them.  This  
might have worked when there were only a few options, but the list has  
grown over the releases, and now it's hard to find an option and its  
associated explanation.  So write out the options list as on other  
reference pages.  

M doc/src/sgml/ref/pg_resetxlog.sgml

PostgresNode: add backup_fs_hot and backup_fs_cold

commit   : 28f6df3c36769eedce5c73d2f5bab9892d5cd76e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 9 Mar 2016 19:54:03 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 9 Mar 2016 19:54:03 -0300    

Click here for diff

These simple methods rely on RecursiveCopy to create a filesystem-level  
backup of a server.  They aren't currently used anywhere yet,but will be  
useful for future tests.  
  
Author: Craig Ringer  
Reviewed-By: Michael Paquier, Salvador Fandino, Álvaro Herrera  
Commitfest-URL: https://commitfest.postgresql.org/9/569/  

M src/test/perl/PostgresNode.pm

Add filter capability to RecursiveCopy::copypath

commit   : a31aaec40643e0074f30b1683953cb0b3ea27036    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 9 Mar 2016 18:00:31 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 9 Mar 2016 18:00:31 -0300    

Click here for diff

This allows skipping copying certain files and subdirectories in tests.  
This is useful in some circumstances such as copying a data directory;  
future tests want this feature.  
  
Also POD-ify the module.  
  
Authors: Craig Ringer, Pallavi Sontakke  
Reviewed-By: Álvaro Herrera  

M src/test/perl/RecursiveCopy.pm

Fix incorrect handling of NULL index entries in indexed ROW() comparisons.

commit   : a298a1e06fb0574c898a07761f9f86c2a323919e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Mar 2016 14:51:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Mar 2016 14:51:01 -0500    

Click here for diff

An index search using a row comparison such as ROW(a, b) > ROW('x', 'y')  
would stop upon reaching a NULL entry in the "b" column, ignoring the  
fact that there might be non-NULL "b" values associated with later values  
of "a".  This happens because _bt_mark_scankey_required() marks the  
subsidiary scankey for "b" as required, which is just wrong: it's for  
a column after the one with the first inequality key (namely "a"), and  
thus can't be considered a required match.  
  
This bit of brain fade dates back to the very beginnings of our support  
for indexed ROW() comparisons, in 2006.  Kind of astonishing that no one  
came across it before Glen Takahashi, in bug #14010.  
  
Back-patch to all supported versions.  
  
Note: the given test case doesn't actually fail in unpatched 9.1, evidently  
because the fix for bug #6278 (i.e., stopping at nulls in either scan  
direction) is required to make it fail.  I'm sure I could devise a case  
that fails in 9.1 as well, perhaps with something involving making a cursor  
back up; but it doesn't seem worth the trouble.  

M src/backend/access/nbtree/nbtutils.c
M src/test/regress/expected/rowtypes.out
M src/test/regress/sql/rowtypes.sql

Re-pgindent vacuumlazy.c.

commit   : be060cbcd42737693f6fd425db4c139121181cce    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 9 Mar 2016 13:50:31 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 9 Mar 2016 13:50:31 -0500    

Click here for diff

M src/backend/commands/vacuumlazy.c

pgbench: When -T is used, don't wait for transactions beyond end of run.

commit   : accf7616ff2854640523d5e42ffa5420cc5a3b51    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 9 Mar 2016 13:09:12 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 9 Mar 2016 13:09:12 -0500    

Click here for diff

At low rates, this can lead to pgbench taking significantly longer to  
terminate than the user might expect.  Repair.  
  
Fabien Coelho, reviewed by Aleksander Alekseev, Álvaro Herrera, and me.  

M src/bin/pgbench/pgbench.c

pgcrypto: support changing S2K iteration count

commit   : 188f359d39ed65b5f3ddc1f397140fb9d153e61a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 9 Mar 2016 14:31:07 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 9 Mar 2016 14:31:07 -0300    

Click here for diff

pgcrypto already supports key-stretching during symmetric encryption,  
including the salted-and-iterated method; but the number of iterations  
was not configurable.  This commit implements a new s2k-count parameter  
to pgp_sym_encrypt() which permits selecting a larger number of  
iterations.  
  
Author: Jeff Janes  

M contrib/pgcrypto/expected/pgp-encrypt.out
M contrib/pgcrypto/pgp-decrypt.c
M contrib/pgcrypto/pgp-encrypt.c
M contrib/pgcrypto/pgp-pgsql.c
M contrib/pgcrypto/pgp-s2k.c
M contrib/pgcrypto/pgp.c
M contrib/pgcrypto/pgp.h
M contrib/pgcrypto/sql/pgp-encrypt.sql
M doc/src/sgml/pgcrypto.sgml

Add a generic command progress reporting facility.

commit   : b6fb6471f6afaf649e52f38269fd8c5c60647669    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 9 Mar 2016 12:08:58 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 9 Mar 2016 12:08:58 -0500    

Click here for diff

Using this facility, any utility command can report the target relation  
upon which it is operating, if there is one, and up to 10 64-bit  
counters; the intent of this is that users should be able to figure out  
what a utility command is doing without having to resort to ugly hacks  
like attaching strace to a backend.  
  
As a demonstration, this adds very crude reporting to lazy vacuum; we  
just report the target relation and nothing else.  A forthcoming patch  
will make VACUUM report a bunch of additional data that will make this  
much more interesting.  But this gets the basic framework in place.  
  
Vinayak Pokale, Rahila Syed, Amit Langote, Robert Haas, reviewed by  
Kyotaro Horiguchi, Jim Nasby, Thom Brown, Masahiko Sawada, Fujii Masao,  
and Masanori Oyama.  

M src/backend/access/transam/xact.c
M src/backend/commands/vacuumlazy.c
M src/backend/postmaster/pgstat.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/pgstat.h

Fix incorrect tlist generation in create_gather_plan().

commit   : 8776c15c85322612b9bf79daf50f74be71c12e05    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Mar 2016 10:56:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Mar 2016 10:56:36 -0500    

Click here for diff

This function is written as though Gather doesn't project; but it does.  
Even if it did not project, though, we must use build_path_tlist to ensure  
that the output columns receive correct sortgroupref labeling.  
  
Per report from Amit Kapila.  

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

postgres_fdw: Consider foreign joining and foreign sorting together.

commit   : aa09cd242fa7e3a694a31f8aed521e80d1e626a4    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 9 Mar 2016 10:51:49 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 9 Mar 2016 10:51:49 -0500    

Click here for diff

Commit ccd8f97922944566d26c7d90eb67ab7848ee9905 gave us the ability to  
request that the remote side sort the data, and, later, commit  
e4106b2528727c4b48639c0e12bf2f70a766b910 gave us the ability to  
request that the remote side perform the join for us rather than doing  
it locally.  But we could not do both things at the same time: a  
remote SQL query that had an ORDER BY clause would never be a join.  
This commit adds that capability.  
  
Ashutosh Bapat, reviewed by me.  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql

Fix copy-and-pasteo in comment.

commit   : d31f20e2b5a246f276c73134b610ac7a2f34e274    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Mar 2016 10:29:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Mar 2016 10:29:14 -0500    

Click here for diff

Wensheng Zhang  

M src/backend/parser/gram.y

Improve handling of pathtargets in planner.c.

commit   : 51c0f63e4d76a86b44e87876a6addcfffb01ec28    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Mar 2016 01:12:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Mar 2016 01:12:16 -0500    

Click here for diff

Refactor so that the internal APIs in planner.c deal in PathTargets not  
targetlists, and establish a more regular structure for deriving the  
targets needed for successive steps.  
  
There is more that could be done here; calculating the eval costs of each  
successive target independently is both inefficient and wrong in detail,  
since we won't actually recompute values available from the input node's  
tlist.  But it's no worse than what happened before the pathification  
rewrite.  In any case this seems like a good starting point for considering  
how to handle Konstantin Knizhnik's function-evaluation-postponement patch.  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/tlist.c
M src/include/optimizer/tlist.h

Add valgrind suppressions for python code.

commit   : 2f1f4439306d2793492e49366d5911e48aa2c4b1    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 8 Mar 2016 17:34:09 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 8 Mar 2016 17:34:09 -0800    

Click here for diff

Python's allocator does some low-level tricks for efficiency;  
unfortunately they trigger valgrind errors. Those tricks can be disabled  
making instrumentation easier; but few people testing postgres will have  
such a build of python. So add broad suppressions of the resulting  
errors.  
  
See also https://svn.python.org/projects/python/trunk/Misc/README.valgrind  
  
This possibly will suppress valid errors, but without it it's basically  
impossible to use valgrind with plpython code.  
  
Author: Andres Freund  
Backpatch: 9.4, where we started to maintain valgrind suppressions  

M src/tools/valgrind.supp

commit   : 5e43bee8307f1f6f87894c9a4bd9f9045f45c064    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 8 Mar 2016 19:21:28 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 8 Mar 2016 19:21:28 -0800    

Click here for diff

Author: Andres Freund  
Backpatch: 9.4, where we started to maintain valgrind suppressions  

M src/tools/valgrind.supp

Improve handling of group-column indexes in GroupingSetsPath.

commit   : 9e8b99420fe5f80495ada8dc50aeb7b954b33093    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Mar 2016 22:32:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Mar 2016 22:32:03 -0500    

Click here for diff

Instead of having planner.c compute a groupColIdx array and store it in  
GroupingSetsPaths, make create_groupingsets_plan() find the grouping  
columns by searching in the child plan node's tlist.  Although that's  
probably a bit slower for create_groupingsets_plan(), it's more like  
the way every other plan node type does this, and it provides positive  
confirmation that we know which child output columns we're supposed to be  
grouping on.  (Indeed, looking at this now, I'm not at all sure that it  
wasn't broken before, because create_groupingsets_plan() isn't demanding  
an exact tlist match from its child node.)  Also, this allows substantial  
simplification in planner.c, because it no longer needs to compute the  
groupColIdx array at all; no other cases were using it.  
  
I'd intended to put off this refactoring until later (like 9.7), but  
in view of the likely bug fix and the need to rationalize planner.c's  
tlist handling so we can do something sane with Konstantin Knizhnik's  
function-evaluation-postponement patch, I think it can't wait.  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/tlist.c
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/tlist.h

Handle invalid libpq sockets in more places

commit   : a40814d7aacbda9266c703cc011d3506668899de    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 8 Mar 2016 21:10:33 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 8 Mar 2016 21:10:33 -0500    

Click here for diff

Also, make error messages consistent.  
  
From: Michael Paquier <[email protected]>  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pgbench/pgbench.c
M src/bin/scripts/vacuumdb.c
M src/interfaces/libpq/fe-misc.c
M src/test/isolation/isolationtester.c

Suppress GCC 6 warning about self-comparison

commit   : a2fd62dd53fb606dee69e0f4eb12289c87f5c8b1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 19 Feb 2016 23:07:46 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 19 Feb 2016 23:07:46 -0500    

Click here for diff

Reviewed-by: Thomas Munro <[email protected]>  

M src/port/path.c

psql: Fix some strange code in SQL help creation

commit   : 92d4294d4bbddf94cec0dce729ade7bb2aada1b7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 19 Feb 2016 23:07:46 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 19 Feb 2016 23:07:46 -0500    

Click here for diff

Struct QL_HELP used to be defined as static in the sql_help.h header  
file, which is included in sql_help.c and help.c, thus creating two  
separate instances of the struct.  This causes a warning from GCC 6,  
because the struct is not used in sql_help.c.  
  
Instead, declare the struct as extern in the header file and define it  
in sql_help.c.  This also allows making a bunch of functions static  
because they are no longer needed outside of sql_help.c.  
  
Reviewed-by: Thomas Munro <[email protected]>  

M src/bin/psql/create_help.pl

ecpg: Fix typo

commit   : 0d0644dce82a87ef4b670fb60709ef1fd6a3030c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 19 Feb 2016 23:07:46 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 19 Feb 2016 23:07:46 -0500    

Click here for diff

GCC 6 points out the redundant conditions, which were apparently typos.  
  
Reviewed-by: Thomas Munro <[email protected]>  

M src/interfaces/ecpg/test/compat_informix/describe.pgc
M src/interfaces/ecpg/test/expected/compat_informix-describe.c
M src/interfaces/ecpg/test/expected/sql-describe.c
M src/interfaces/ecpg/test/sql/describe.pgc

ltree: Zero padding bytes when allocating memory for externally visible data.

commit   : 7a1d4a2448c34ed4669d67ae4f24c594545f10b5    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 8 Mar 2016 14:59:29 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 8 Mar 2016 14:59:29 -0800    

Click here for diff

ltree/ltree_gist/ltxtquery's headers stores data at MAXALIGN alignment,  
requiring some padding bytes. So far we left these uninitialized. Zero  
those by using palloc0.  
  
Author: Andres Freund  
Reported-By: Andres Freund / valgrind / buildarm animal skink  
Backpatch: 9.1-  

M contrib/ltree/_ltree_gist.c
M contrib/ltree/_ltree_op.c
M contrib/ltree/ltree_gist.c
M contrib/ltree/ltree_op.c
M contrib/ltree/ltxtquery_io.c

Fix minor thinko in pathification code.

commit   : 61fd218930db53079e5f001dd4ea2fd53afd1b95    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Mar 2016 16:50:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Mar 2016 16:50:32 -0500    

Click here for diff

I passed the wrong "root" struct to create_pathtarget in build_minmax_path.  
Since the subroot is a clone of the outer root, this would not cause any  
serious problems, but it would waste some cycles because  
set_pathtarget_cost_width would not have access to Var width estimates  
set up while running query_planner on the subroot.  

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

plperl: Correctly handle empty arrays in plperl_ref_from_pg_array.

commit   : e66197fa2efa8ae0cab1eed6b2257ab4e2134b1e    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 8 Mar 2016 13:33:24 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 8 Mar 2016 13:33:24 -0800    

Click here for diff

plperl_ref_from_pg_array() didn't consider the case that postgrs arrays  
can have 0 dimensions (when they're empty) and accessed the first  
dimension without a check. Fix that by special casing the empty array  
case.  
  
Author: Alex Hunsaker  
Reported-By: Andres Freund / valgrind / buildfarm animal skink  
Discussion: [email protected]  
Backpatch: 9.1-  

M src/pl/plperl/plperl.c

Finish refactoring make_foo() functions in createplan.c.

commit   : 8c314b9853c2fbb85c041d4761426f25a9d63972    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Mar 2016 16:28:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Mar 2016 16:28:27 -0500    

Click here for diff

This patch removes some redundant cost calculations that I left for later  
cleanup in commit 3fc6e2d7f5b652b4.  There's now a uniform policy that the  
make_foo() convenience functions don't do any cost calculations.  Most of  
their callers copy costs from the source Path node, and for those that  
don't, the calculation in the make_foo() function wasn't necessarily right  
anyhow.  (make_result() was particularly a mess, as it was serving multiple  
callers using cost calcs designed for only the first one or two that had  
ever existed.)  Aside from saving a few cycles, this ensures that what  
EXPLAIN prints matches the costs we used for planning purposes.  It does  
not change any planner decisions, since the decisions are already made.  

M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/include/optimizer/pathnode.h

Comment update for fdw_recheck_quals.

commit   : 7400559a3fe959bdc6822114ef6aa966c42899f9    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 14:40:55 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 14:40:55 -0500    

Click here for diff

Commit 5fc4c26db5120bd90348b6ee3101fcddfdf54800 could've done a better  
job updating these comments.  
  
Etsuro Fujita  

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

Update GetForeignPlan documentation.

commit   : dff7ad3c61473a65ff8f166b1eefd099e68595bb    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 14:30:12 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 14:30:12 -0500    

Click here for diff

Commit 385f337c9f39b21dca96ca4770552a10a6d5af24 added a new argument  
to the FDW GetForeignPlan method, but failed to update the documentation  
to match.  
  
Etsuro Fujita  

M doc/src/sgml/fdwhandler.sgml

Fix reversed argument to bms_is_subset.

commit   : d29b153f180ba374e5e0e1f3e49762aba4a548d7    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 13:59:11 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 13:59:11 -0500    

Click here for diff

Ashutosh Bapat  

M contrib/postgres_fdw/postgres_fdw.c

Add new flags argument for xl_heap_visible to heap2_desc.

commit   : 734f86d50dccc91fb68a99339a22a1bcb87f9cea    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 13:28:22 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 13:28:22 -0500    

Click here for diff

Masahiko Sawada  

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

Fix typo.

commit   : 272baaa538f7a3186ac0c03764a8af9c0f5c00ac    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 13:28:00 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 13:28:00 -0500    

Click here for diff

Masahiko Sawada  

M doc/src/sgml/pgvisibility.sgml

Fix parallel query on standby servers.

commit   : dcfecaae9e35afe4fb11304267f547141842447d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 10:27:03 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 10:27:03 -0500    

Click here for diff

Without this fix, it inevitably bombs out with "ERROR:  failed to  
initialize transaction_read_only to 0".  Repair.  
  
Ashutosh Sharma; comments adjusted by me.  

M src/backend/commands/variable.c

Add some functions to fd.c for the convenience of extensions.

commit   : 070140ee48e8524493f882a278b5ced255b34b65    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 10:09:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 10:09:50 -0500    

Click here for diff

For example, if you want to perform an ioctl() on a file descriptor  
opened through the fd.c routines, there's no way to do that without  
being able to get at the underlying fd.  
  
KaiGai Kohei  

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

Department of second thoughts: remove PD_ALL_FROZEN.

commit   : 77a1d1e79892a20ed15a67be42b96949b8546bf6    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 08:46:48 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 08:46:48 -0500    

Click here for diff

Commit a892234f830e832110f63fc0a2afce2fb21d1584 added a second bit per  
page to the visibility map, which still seems like a good idea, but it  
also added a second page-level bit alongside PD_ALL_VISIBLE to track  
whether the visibility map bit was set.  That no longer seems like a  
clever plan, because we don't really need that bit for anything.  We  
always clear both bits when the page is modified anyway.  
  
Patch by me, reviewed by Kyotaro Horiguchi and Masahiko Sawada.  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/visibilitymap.c
M src/backend/commands/vacuumlazy.c
M src/include/storage/bufpage.h

Add pg_visibility contrib module.

commit   : ba0a198fb133eb3426bffdc2e369cce1bafe1612    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 08:38:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 08:38:50 -0500    

Click here for diff

This lets you examine the visibility map as well as page-level  
visibility information.  I initially wrote it as a debugging aid,  
but was encouraged to polish it for commit.  
  
Patch by me, reviewed by Masahiko Sawada.  
  
Discussion: [email protected]  

M contrib/Makefile
A contrib/pg_visibility/Makefile
A contrib/pg_visibility/pg_visibility–1.0.sql
A contrib/pg_visibility/pg_visibility.c
A contrib/pg_visibility/pg_visibility.control
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
A doc/src/sgml/pgvisibility.sgml
M doc/src/sgml/storage.sgml

pg_upgrade: Remove converter plugin facility.

commit   : 6f56b41ac0cd7092b91834da02e70514d28b8edb    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 08:13:02 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2016 08:13:02 -0500    

Click here for diff

We've not found a use for this so far, and the current need, which  
is to convert the visibility map to a new format, does not suit the  
existing design anyway.  So just rip it out.  
  
Author: Masahiko Sawada, slightly revised by me.  
Discussion: [email protected]  

M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/file.c
D src/bin/pg_upgrade/page.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c

Fix minor typo in logical-decoding docs.

commit   : a93aec4e0f061ad43034d5324b8407a824e54395    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Mar 2016 21:52:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Mar 2016 21:52:30 -0500    

Click here for diff

David Rowley  

M doc/src/sgml/logicaldecoding.sgml

Spell "parallel" correctly.

commit   : cf8e7b16a5f3e63fe692d042fefc0c9f09a23ebc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Mar 2016 21:48:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Mar 2016 21:48:17 -0500    

Click here for diff

Per David Rowley.  

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

Fix uninstall target in tsearch Makefile

commit   : 1c2db8c305745edb8800e8b146d5c295eb82a4fd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Mar 2016 20:36:59 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Mar 2016 20:36:59 -0500    

Click here for diff

Artur Zakirov  

M src/backend/tsearch/Makefile

Make get_controlfile() error logging consistent with src/common

commit   : 7b077af5000cb94b8547b62ee45697cf6bf806ef    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 7 Mar 2016 15:14:20 -0800    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 7 Mar 2016 15:14:20 -0800    

Click here for diff

As originally committed, get_controlfile() used a non-standard approach  
to error logging. Make it consistent with the majority of error logging  
done in src/common.  
  
Applies to master only.  

M src/common/controldata_utils.c

Further improvements to c8f621c43.

commit   : b63bea5fd3bba4d7a61c3beaba51a06f24b38da6    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 7 Mar 2016 14:24:03 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 7 Mar 2016 14:24:03 -0800    

Click here for diff

Coverity and inspection for the issue addressed in fd45d16f found some  
questionable code.  
  
Specifically coverity noticed that the wrong length was added in  
ReorderBufferSerializeChange() - without immediate negative consequences  
as the variable isn't used afterwards.  During code-review and testing I  
noticed that a bit of space was wasted when allocating tuple bufs in  
several places.  Thirdly, the debug memset()s in  
ReorderBufferGetTupleBuf() reduce the error checking valgrind can do.  
  
Backpatch: 9.4, like c8f621c43.  

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

Make the upper part of the planner work by generating and comparing Paths.

commit   : 3fc6e2d7f5b652b417fa6937c34de2438d60fa9f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Mar 2016 15:58:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Mar 2016 15:58:22 -0500    

Click here for diff

I've been saying we needed to do this for more than five years, and here it  
finally is.  This patch removes the ever-growing tangle of spaghetti logic  
that grouping_planner() used to use to try to identify the best plan for  
post-scan/join query steps.  Now, there is (nearly) independent  
consideration of each execution step, and entirely separate construction of  
Paths to represent each of the possible ways to do that step.  We choose  
the best Path or set of Paths using the same add_path() logic that's been  
used inside query_planner() for years.  
  
In addition, this patch removes the old restriction that subquery_planner()  
could return only a single Plan.  It now returns a RelOptInfo containing a  
set of Paths, just as query_planner() does, and the parent query level can  
use each of those Paths as the basis of a SubqueryScanPath at its level.  
This allows finding some optimizations that we missed before, wherein a  
subquery was capable of returning presorted data and thereby avoiding a  
sort in the parent level, making the overall cost cheaper even though  
delivering sorted output was not the cheapest plan for the subquery in  
isolation.  (A couple of regression test outputs change in consequence of  
that.  However, there is very little change in visible planner behavior  
overall, because the point of this patch is not to get immediate planning  
benefits but to create the infrastructure for future improvements.)  
  
There is a great deal left to do here.  This patch unblocks a lot of  
planner work that was basically impractical in the old code structure,  
such as allowing FDWs to implement remote aggregation, or rewriting  
plan_set_operations() to allow consideration of multiple implementation  
orders for set operations.  (The latter will likely require a full  
rewrite of plan_set_operations(); what I've done here is only to fix it  
to return Paths not Plans.)  I have also left unfinished some localized  
refactoring in createplan.c and planner.c, because it was not necessary  
to get this patch to a working state.  
  
Thanks to Robert Haas, David Rowley, and Amit Kapila for review.  

M doc/src/sgml/fdwhandler.sgml
M src/backend/executor/execAmi.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/README
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/tlist.c
M src/include/nodes/nodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/optimizer/prep.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/join.out

Fix backwards test for Windows service-ness in pg_ctl.

commit   : b642e50aea1b966f3b78c49e806b4a2c5497a861    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Mar 2016 10:40:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Mar 2016 10:40:44 -0500    

Click here for diff

A thinko in a96761391 caused pg_ctl to get it exactly backwards when  
deciding whether to report problems to the Windows eventlog or to stderr.  
Per bug #14001 from Manuel Mathar, who also identified the fix.  
Like the previous patch, back-patch to all supported branches.  

M src/bin/pg_ctl/pg_ctl.c

Re-fix broken definition for function name in pgbench's exprscan.l.

commit   : 94f1adccd36df3ad75d2c257c9ae1ca448f3e4ac    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Mar 2016 21:45:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Mar 2016 21:45:34 -0500    

Click here for diff

Wups, my first try wasn't quite right either.  Too focused on fixing  
the existing bug, not enough on not introducing new ones.  

M src/bin/pgbench/exprscan.l

Fix broken definition for function name in pgbench's exprscan.l.

commit   : 3899caf772c8dec5c79e553c91f8fc248ca686c9    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Mar 2016 21:04:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Mar 2016 21:04:25 -0500    

Click here for diff

As written, this would accept e.g. 123e9 as a function name.  Aside  
from being mildly astonishing, that would come back to haunt us if  
we ever try to add float constants to the expression syntax.  Insist  
that function names start with letters (or at least non-digits).  
  
In passing reset yyline as well as yycol when starting a new expression.  
This variable is useless since it's used nowhere, but if we're going  
to have it we should have it act sanely.  

M src/bin/pgbench/exprscan.l

Fix wrong allocation size in c8f621c43.

commit   : fd45d16f6212df15821684b231a44448389fb002    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 6 Mar 2016 16:27:20 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 6 Mar 2016 16:27:20 -0800    

Click here for diff

In c8f621c43 I forgot to account for MAXALIGN when allocating a new  
tuplebuf in ReorderBufferGetTupleBuf(). That happens to currently not  
cause active problems on a number of platforms because the affected  
pointer is already aligned, but others, like ppc and hppa, trigger this  
in the regression test, due to a debug memset clearing memory.  
  
Fix that.  
  
Backpatch: 9.4, like the previous commit.  

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

Fix not-terribly-safe coding in NIImportOOAffixes() and NIImportAffixes().

commit   : b3e05097e58051a7816ed734074fd76345687e0c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Mar 2016 19:20:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Mar 2016 19:20:55 -0500    

Click here for diff

There were two places in spell.c that supposed that they could search  
for a location in a string produced by lowerstr() and then transpose  
the offset into the original string.  But this fails completely if  
lowerstr() transforms any characters into characters of different byte  
length, as can happen in Turkish UTF8 for instance.  
  
We'd added some comments about this coding in commit 51e78ab4ff328296,  
but failed to realize that it was not merely confusing but wrong.  
  
Coverity complained about this code years ago, but in such an opaque  
fashion that nobody understood what it was on about.  I'm not entirely  
sure that this issue *is* what it's on about, actually, but perhaps  
this patch will shut it up -- and in any case the problem is clear.  
  
Back-patch to all supported branches.  

M src/backend/tsearch/spell.c

Fix unportable usage of <ctype.h> functions.

commit   : cb0ca0c9953aa0614e7b143bd2440a7582a27233    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Mar 2016 18:23:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Mar 2016 18:23:53 -0500    

Click here for diff

isdigit(), isspace(), etc are likely to give surprising results if passed a  
signed char.  We should always cast the argument to unsigned char to avoid  
that.  Error in commit d78a7d9c7fa3e9cd, found by buildfarm member gaur.  

M src/backend/tsearch/spell.c

Fix typos

commit   : 2b46259b46b3d34e6858afbf3d28c30cef12652b    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 6 Mar 2016 12:25:47 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 6 Mar 2016 12:25:47 +0100    

Click here for diff

Author: Guillaume Lelarge  

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

logical decoding: Fix handling of large old tuples with replica identity full.

commit   : c8f621c43a599b35dc004ee09627bf4688cbbb84    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 5 Mar 2016 18:02:20 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 5 Mar 2016 18:02:20 -0800    

Click here for diff

When decoding the old version of an UPDATE or DELETE change, and if that  
tuple was bigger than MaxHeapTupleSize, we either Assert'ed out, or  
failed in more subtle ways in non-assert builds.  Normally individual  
tuples aren't bigger than MaxHeapTupleSize, with big datums toasted.  
But that's not the case for the old version of a tuple for logical  
decoding; the replica identity is logged as one piece. With the default  
replica identity btree limits that to small tuples, but that's not the  
case for FULL.  
  
Change the tuple buffer infrastructure to separate allocate over-large  
tuples, instead of always going through the slab cache.  
  
This unfortunately requires changing the ReorderBufferTupleBuf  
definition, we need to store the allocated size someplace. To avoid  
requiring output plugins to recompile, don't store HeapTupleHeaderData  
directly after HeapTupleData, but point to it via t_data; that leaves  
rooms for the allocated size.  As there's no reason for an output plugin  
to look at ReorderBufferTupleBuf->t_data.header, remove the field. It  
was just a minor convenience having it directly accessible.  
  
Reported-By: Adam Dratwiński  
Discussion: CAKg6ypLd7773AOX4DiOGRwQk1TVOQKhNwjYiVjJnpq8Wo+i62Q@mail.gmail.com  

M contrib/test_decoding/expected/toast.out
M contrib/test_decoding/sql/toast.sql
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/include/replication/reorderbuffer.h

logical decoding: old/newtuple in spooled UPDATE changes was switched around.

commit   : 0bda14d54cf24dedcd2011559a53cc62702e421b    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 5 Mar 2016 18:02:20 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 5 Mar 2016 18:02:20 -0800    

Click here for diff

Somehow I managed to flip the order of restoring old & new tuples when  
de-spooling a change in a large transaction from disk. This happens to  
only take effect when a change is spooled to disk which has old/new  
versions of the tuple. That only is the case for UPDATEs where he  
primary key changed or where replica identity is changed to FULL.  
  
The tests didn't catch this because either spooled updates, or updates  
that changed primary keys, were tested; not both at the same time.  
  
Found while adding tests for the following commit.  
  
Backpatch: 9.4, where logical decoding was added  

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

logical decoding: Tell reorderbuffer about all xids.

commit   : d9e903f3cbbd00c7ba7d4974e6852c3d2cbf4447    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 5 Mar 2016 18:02:20 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 5 Mar 2016 18:02:20 -0800    

Click here for diff

Logical decoding's reorderbuffer keeps transactions in an LSN ordered  
list for efficiency. To make that's efficiently possible upper-level  
xids are forced to be logged before nested subtransaction xids.  That  
only works though if these records are all looked at: Unfortunately we  
didn't do so for e.g. row level locks, which are otherwise uninteresting  
for logical decoding.  
  
This could lead to errors like:  
"ERROR: subxact logged without previous toplevel record".  
  
It's not sufficient to just look at row locking records, the xid could  
appear first due to a lot of other types of records (which will trigger  
the transaction to be marked logged with MarkCurrentTransactionIdLoggedIfAny).  
So invent infrastructure to tell reorderbuffer about xids seen, when  
they'd otherwise not pass through reorderbuffer.c.  
  
Reported-By: Jarred Ward  
Bug: #13844  
Discussion: [email protected]  
Backpatch: 9.4, where logical decoding was added  

M contrib/test_decoding/Makefile
A contrib/test_decoding/expected/xact.out
A contrib/test_decoding/sql/xact.sql
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/include/replication/reorderbuffer.h

Expose control file data via SQL accessible functions.

commit   : dc7d70ea05deca9dfc6a25043d406b57cc8f6c30    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 5 Mar 2016 11:10:19 -0800    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 5 Mar 2016 11:10:19 -0800    

Click here for diff

Add four new SQL accessible functions: pg_control_system(),  
pg_control_checkpoint(), pg_control_recovery(), and pg_control_init()  
which expose a subset of the control file data.  
  
Along the way move the code to read and validate the control file to  
src/common, where it can be shared by the new backend functions  
and the original pg_controldata frontend program.  
  
Patch by me, significant input, testing, and review by Michael Paquier.  

M doc/src/sgml/func.sgml
M src/backend/utils/misc/Makefile
A src/backend/utils/misc/pg_controldata.c
M src/bin/pg_controldata/pg_controldata.c
M src/common/Makefile
A src/common/controldata_utils.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
A src/include/common/controldata_utils.h
M src/include/utils/builtins.h
M src/tools/msvc/Mkvcbuild.pm

Ignore recovery_min_apply_delay until recovery has reached consistent state

commit   : d34794f7d5566effd342dd0ebaca3de3b48656f0    
  
author   : Fujii Masao <[email protected]>    
date     : Sun, 6 Mar 2016 02:29:04 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sun, 6 Mar 2016 02:29:04 +0900    

Click here for diff

Previously recovery_min_apply_delay was applied even before recovery  
had reached consistency. This could cause us to wait a long time  
unexpectedly for read-only connections to be allowed. It's problematic  
because the standby was useless during that wait time.  
  
This patch changes recovery_min_apply_delay so that it's applied once  
the database has reached the consistent state. That is, even if the delay  
is set, the standby tries to replay WAL records as fast as possible until  
it has reached consistency.  
  
Author: Michael Paquier  
Reviewed-By: Julien Rouhaud  
Reported-By: Greg Clough  
Backpatch: 9.4, where recovery_min_apply_delay was added  
Bug: #13770  
Discussion: http://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/recovery-config.sgml
M src/backend/access/transam/xlog.c

Make stats regression test robust in the face of parallel query.

commit   : 60690a6fe8351995b1eeb9a53f2b634c3bce3a3d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Mar 2016 16:20:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Mar 2016 16:20:44 -0500    

Click here for diff

Historically, the wait_for_stats() function in this test has simply checked  
for a report of an indexscan on tenk2, corresponding to the last command  
issued before we expect stats updates to appear.  However, with parallel  
query that indexscan could be done by a parallel worker that will emit  
its stats counters to the collector before the session's main backend does  
(a full second before, in fact, thanks to the "pg_sleep(1.0)" added by  
commit 957d08c81f9cc277).  That leaves a sizable window in which an  
autovacuum-triggered write of the stats files would present a state in  
which the indexscan on tenk2 appears to have been done, but none of the  
write updates performed by the test have been.  This is evidently the  
explanation for intermittent failures seen by me and on buildfarm member  
mandrill.  
  
To fix, we should check separately for both the tenk2 seqscan and indexscan  
counts, since those might be reported by different processes that could be  
delayed arbitrarily on an overloaded test machine.  And we need to check  
for at least one update-related count.  If we ever allow parallel workers  
to do writes, this will get even more complicated ... but in view of all  
the other hard problems that will entail, I don't feel a need to solve this  
one today.  
  
Per research by Rahila Syed and myself; part of this patch is Rahila's.  

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

Fix typo in comment.

commit   : 708020eb7b08395626707fef0010547bf5764409    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 15:46:30 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 15:46:30 -0500    

Click here for diff

Thomas Munro  

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

Minor improvements to transaction manager README.

commit   : 6fcde8a5c80e46e9e92f50f62093cba5899312fd    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 14:12:28 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 14:12:28 -0500    

Click here for diff

A simple SELECT is handled by PortalRunSelect, not ProcessQuery.  Also,  
the previous indentation was unclear: change it so that a deeper level  
of indentation indicates that the outer function calls the inner one.  
  
Stas Kelvich  

M src/backend/access/transam/README

Fix SerializeSnapshot not to overrun the allocated space.

commit   : 17b124d30317eb194dc8b2fa86b1ebc5b09ac8f3    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 13:47:05 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 13:47:05 -0500    

Click here for diff

Rushabh Lathia  

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

Fix Windows build broken by d78a7d9c7fa3e9cd494b906f065fe7b7fe9fb9a5

commit   : 0e7557dc8d5b2008b0b096cd730d16c8562690fc    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 4 Mar 2016 21:36:49 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 4 Mar 2016 21:36:49 +0300    

Click here for diff

M src/tools/msvc/Install.pm

Minor optimizations based on ParallelContext having nworkers_launched.

commit   : df4685fb0cad1c75970b6e8d0aacca4d03545e04    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 12:59:10 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 12:59:10 -0500    

Click here for diff

Originally, we didn't have nworkers_launched, so code that used parallel  
contexts had to be preprared for the possibility that not all of the  
workers requested actually got launched.  But now we can count on knowing  
the number of workers that were successfully launched, which can shave  
off a few cycles and simplify some code slightly.  
  
Amit Kapila, reviewed by Haribabu Kommi, per a suggestion from Peter  
Geoghegan.  

M src/backend/access/transam/parallel.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeGather.c

Fix InitializeSessionUserId not to deference NULL rolename pointer.

commit   : 546cd0d7664ee0f120ef3b267d4303190bdfdb94    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 12:05:15 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 12:05:15 -0500    

Click here for diff

Dmitriy Sarafannikov, reviewed by Michael Paquier and Haribabu Kommi,  
with a minor fix by me.  

M src/backend/utils/init/miscinit.c

Improve support of Hunspell in ispell dictionary.

commit   : d78a7d9c7fa3e9cd494b906f065fe7b7fe9fb9a5    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 4 Mar 2016 20:08:10 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 4 Mar 2016 20:08:10 +0300    

Click here for diff

Now it's possible to load recent version of Hunspell for several languages.  
To handle these dictionaries Hunspell patch adds support for:  
* FLAG long - sets the double extended ASCII character flag type  
* FLAG num - sets the decimal number flag type (from 1 to 65535)  
* AF parameter - alias for flag's set  
  
Also it moves test dictionaries into separate directory.  
  
Author: Artur Zakirov with editorization by me  

M doc/src/sgml/textsearch.sgml
M src/backend/tsearch/Makefile
R100 src/backend/tsearch/hunspell_sample.affix src/backend/tsearch/dicts/hunspell_sample.affix
A src/backend/tsearch/dicts/hunspell_sample_long.affix
A src/backend/tsearch/dicts/hunspell_sample_long.dict
A src/backend/tsearch/dicts/hunspell_sample_num.affix
A src/backend/tsearch/dicts/hunspell_sample_num.dict
R100 src/backend/tsearch/ispell_sample.affix src/backend/tsearch/dicts/ispell_sample.affix
R100 src/backend/tsearch/ispell_sample.dict src/backend/tsearch/dicts/ispell_sample.dict
R100 src/backend/tsearch/synonym_sample.syn src/backend/tsearch/dicts/synonym_sample.syn
R100 src/backend/tsearch/thesaurus_sample.ths src/backend/tsearch/dicts/thesaurus_sample.ths
M src/backend/tsearch/spell.c
M src/include/tsearch/dicts/spell.h
M src/test/regress/expected/tsdicts.out
M src/test/regress/sql/tsdicts.sql

Fix query-based tab completion for multibyte characters.

commit   : 9445db925e78c2c4fb12067ad5618e2aecabe109    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 11:53:20 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 11:53:20 -0500    

Click here for diff

The existing code confuses the byte length of the string (which is  
relevant when passing it to pg_strncasecmp) with the character length  
of the string (which is relevant when it is used with the SQL substring  
function).  Separate those two concepts.  
  
Report and patch by Kyotaro Horiguchi, reviewed by Thomas Munro and  
reviewed and further revised by me.  

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

Fix the way GetExistingLocalJoinPath is documented.

commit   : 33b5eab7ab82a355629257f1b11fd9fcf4ff6f28    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 11:41:23 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 11:41:23 -0500    

Click here for diff

The old approach made it look like it was an FDW callback, which it  
is not.  
  
Per a gripe from Stephen Frost.  Patch by me, reviewed by Ashutosh  
Bapat.  

M doc/src/sgml/fdwhandler.sgml

postgres_fdw: When sending ORDER BY, always include NULLS FIRST/LAST.

commit   : 3bea3f88d5fc3517042ba83d2906979256da2442    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 11:35:46 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 4 Mar 2016 11:35:46 -0500    

Click here for diff

Previously, we included NULLS FIRST when appropriate but relied on the  
default behavior to be NULLS LAST.  This is, however, not true for a  
sort in descending order and seems like a fragile assumption anyway.  
  
Report by Rajkumar Raghuwanshi.  Patch by Ashutosh Bapat.  Review  
comments from Michael Paquier and Tom Lane.  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql

Add 'tap_tests' flag in config_default.pl

commit   : 52fe6f4e02f89f6230994988af9abc23b332b83e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 4 Mar 2016 12:59:47 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 4 Mar 2016 12:59:47 -0300    

Click here for diff

This makes the flag more visible for testers using the default file as a  
template, increasing the likelyhood that the test suite will be run.  
Also have the flag be displayed in the fake "configure" output, if set.  
  
This patch is two new lines only, but perltidy decides to shift things  
around which makes it appear a bit bigger.  
  
Author: Michaël Paquier  
Reviewed-by: Craig Ringer  
Discussion: https://www.postgresql.org/message-id/CAB7nPqRet6UAP2APhZAZw%3DVhJ6w-Q-gGLdZkrOqFgd2vc9-ZDw%40mail.gmail.com  

M src/tools/msvc/Solution.pm
M src/tools/msvc/config_default.pl

Add prerequisite for KOI8-U.TXT

commit   : 1fa2a6b1d4023e7c5890d095364dea0e0bf24a59    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    

Click here for diff

This was missed when the encoding was added.  

M src/backend/utils/mb/Unicode/Makefile

Make some adjustments in variable assignments

commit   : b497abc6022f7ac13e8a59d9b3a14f8ba6d39791    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    

Click here for diff

These variables aren't really used for anything interesting, but it  
seems the existing grouping was somewhat nonsensical.  

M src/backend/utils/mb/Unicode/Makefile

commit   : 7a4a813c993ed767e2c2952f7a89a75ce6e56b6b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    

Click here for diff

This was apparently forgotten in commit  
75c6519ff68dbb97f73b13e9976fb8075bbde7b8.  

M src/backend/utils/mb/Unicode/Makefile

Force synchronous_commit=on in test_decoding's concurrent_ddl_dml.spec.

commit   : 1986c3c440151b056877b446e7d9c2861906aa26    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 3 Mar 2016 17:09:08 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 3 Mar 2016 17:09:08 -0800    

Click here for diff

Otherwise running installcheck-force on a server with  
synchronous_commit=off will result in the tests failing. All the other  
tests already do so...  
  
Backpatch: 9.4, where logical decoding was added  

M contrib/test_decoding/specs/concurrent_ddl_dml.spec

pgbench: accept unambiguous builtin prefixes for -b

commit   : d561f1caecbbeca2f7adab39a29432923d15b8ef    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 3 Mar 2016 19:37:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 3 Mar 2016 19:37:13 -0300    

Click here for diff

This makes it easier to use "-b se" instead of typing the full "-b  
select-only".  
  
Author: Fabien Coelho  
Reviewed-by: Michaël Paquier  

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

Rework PostgresNode's psql method

commit   : 2c83f435a3deca745c666e9778229d64cb2dfc79    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 3 Mar 2016 17:58:30 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 3 Mar 2016 17:58:30 -0300    

Click here for diff

This makes the psql() method much more capable: it captures both stdout  
and stderr; it now returns the psql exit code rather than stdout; a  
timeout can now be specified, as can ON_ERROR_STOP behavior; it gained a  
new "on_error_die" (defaulting to off) parameter to raise an exception  
if there's any problem.  Finally, additional parameters to psql can be  
passed if there's need for further tweaking.  
  
For convenience, a new safe_psql() method retains much of the old  
behavior of psql(), except that it uses on_error_die on, so that  
problems like syntax errors in SQL commands can be detected more easily.  
  
Many existing TAP test files now use safe_psql, which is what is really  
wanted.  A couple of ->psql() calls are now added in the commit_ts  
tests, which verify that the right thing is happening on certain errors.  
Some ->command_fails() calls in recovery tests that were verifying that  
psql failed also became ->psql() calls now.  
  
Author: Craig Ringer. Some tweaks by Álvaro Herrera  
Reviewed-By: Michaël Paquier  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pgbench/t/001_pgbench.pl
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/030_createlang.pl
M src/bin/scripts/t/050_dropdb.pl
M src/bin/scripts/t/070_dropuser.pl
M src/bin/scripts/t/090_reindexdb.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/perl/PostgresNode.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

perltidy PostgresNode and SimpleTee

commit   : 7d9a4301c08148509136c296866196f6b19ee2c2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 3 Mar 2016 13:20:46 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 3 Mar 2016 13:20:46 -0300    

Click here for diff

Also, mention in README that Perl files should be perltidy'ed.  This  
isn't really the best place (since we have Perl files elsewhere in the  
tree) and this is already in pgindent's README, but this subdir is  
likely to get hacked a whole lot more than the other Perl files, so it  
seems okay to spend two lines on this.  
  
Author: Craig Ringer  

M src/test/perl/PostgresNode.pm
M src/test/perl/README
M src/test/perl/SimpleTee.pm

Fix mistakes in recovery tests

commit   : 5bec1ad4648e71711357caa0ae0030f5ccb911d7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 3 Mar 2016 12:49:02 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 3 Mar 2016 12:49:02 -0300    

Click here for diff

One test was relying on method remove_tree that isn't implemented in the  
oldest Perl we support; fix it by using the older rmtree instead.  
  
Another test had a typo in a SQL command, which isn't noticed because  
the PostgresNode->psql() method doesn't check that queries return  
correctly.  That's undesirable and will also be fixed later on, but for  
now let's make the test actually work.  
  
Author: Craig Ringer  

M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/004_timeline_switch.pl

Revert buggy optimization of index scans

commit   : c7111d11b188bd631a63c98e9aab8532176007c3    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 3 Mar 2016 09:53:43 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 3 Mar 2016 09:53:43 +0000    

Click here for diff

606c0123d627 attempted to reduce cost of index scans using > and <  
strategies, though got that completely wrong in a few complex cases.  
  
Revert whole patch until we find a safe optimization.  

M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/include/access/nbtree.h

Add prefix to pl/pgsql global variables and functions

commit   : 6c90996a4cbfe02639f2ba31d22f9159832de869    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 3 Mar 2016 10:45:59 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 3 Mar 2016 10:45:59 +0100    

Click here for diff

Rename pl/pgsql global variables to always have a plpgsql_ prefix,  
so they don't conflict with other shared libraries loaded.  

M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/plpgsql.h

logical decoding: fix decoding of a commit's commit time.

commit   : 7c17aac69dcae610b08c5965161151cd282f16bc    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 2 Mar 2016 23:42:21 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 2 Mar 2016 23:42:21 -0800    

Click here for diff

When adding replication origins in 5aa235042, I somehow managed to set  
the timestamp of decoded transactions to InvalidXLogRecptr when decoding  
one made without a replication origin. Fix that, and the wrong type of  
the new commit_time variable.  
  
This didn't trigger a regression test failure because we explicitly  
don't show commit timestamps in the regression tests, as they obviously  
are variable. Add a test that checks that a decoded commit's timestamp  
is within minutes of NOW() from before the commit.  
  
Reported-By: Weiping Qu  
Diagnosed-By: Artur Zakirov  
Discussion: [email protected],  
    [email protected]  
Backpatch: 9.5, where 5aa235042 originates.  

M contrib/test_decoding/Makefile
A contrib/test_decoding/expected/time.out
A contrib/test_decoding/sql/time.sql
M src/backend/replication/logical/decode.c

Fix json_to_record() bug with nested objects.

commit   : a9d199f6d3b998929cdb8e8aa61e5cd8db9b220f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2016 23:31:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2016 23:31:39 -0500    

Click here for diff

A thinko concerning nesting depth caused json_to_record() to produce bogus  
output if a field of its input object contained a sub-object with a field  
name matching one of the requested output column names.  Per bug #13996  
from Johann Visagie.  
  
I added a regression test case based on his example, plus parallel tests  
for json_to_recordset, jsonb_to_record, jsonb_to_recordset.  The latter  
three do not exhibit the same bug (which suggests that we may be missing  
some opportunities to share code...) but testing seems like a good idea  
in any case.  
  
Back-patch to 9.4 where these functions were introduced.  

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

Create stub functions to support pg_upgrade of old contrib/tsearch2.

commit   : eb43e851d6b3fa0c4516efcfdf29a183f7717a43    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2016 17:37:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2016 17:37:54 -0500    

Click here for diff

Commits 9ff60273e35cad6e and dbe2328959e12701 adjusted the declarations  
of some core functions referenced by contrib/tsearch2's install script,  
forgetting that in a pg_upgrade situation, we'll be trying to restore  
operator class definitions that reference the old signatures.  We've  
hit this problem before; solve it in the same way as before, namely by  
installing stub functions that have the expected signature and just  
invoke the correct function.  Per report from Jeff Janes.  
  
(Someday we ought to stop supporting contrib/tsearch2, but I'm not  
sure today is that day.)  

M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery_gist.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/tsearch/ts_utils.h

Prefix temp data dirs with the node name

commit   : cc6077d4d540d821548b704dc6e2f349da736f62    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 2 Mar 2016 17:02:36 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 2 Mar 2016 17:02:36 -0300    

Click here for diff

This makes it easier to relate the temporary data dirs to each node in  
a test script.  
  
Author: Kyotaro Horiguchi  
Reviewed-By: Craig Ringer, Alvaro Herrera  

M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm

Fix PL/Tcl's encoding conversion logic.

commit   : c8c7c93de8e116d802eddfd8821f8f77588aee00    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2016 13:30:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2016 13:30:14 -0500    

Click here for diff

PL/Tcl appears to contain logic to convert strings between the database  
encoding and UTF8, which is the only encoding modern Tcl will deal with.  
However, that code has been disabled since commit 034895125d648b86, which  
made it "#if defined(UNICODE_CONVERSION)" and neglected to provide any way  
for that symbol to become defined.  That might have been all right back  
in 2001, but these days we take a dim view of allowing strings with  
incorrect encoding into the database.  
  
Remove the conditional compilation, fix warnings about signed/unsigned char  
conversions, clean up assorted places that didn't bother with conversions.  
(Notably, there were lots of assumptions that database table and field  
names didn't need conversion...)  
  
Add a regression test based on plpython_unicode.  It's not terribly  
thorough, but better than no test at all.  

M src/pl/tcl/Makefile
A src/pl/tcl/expected/pltcl_unicode.out
M src/pl/tcl/pltcl.c
A src/pl/tcl/sql/pltcl_unicode.sql

Make PL/Tcl require Tcl 8.4 or later.

commit   : e2609323eb58ee273ac03a66343447e6a56154d5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2016 12:24:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2016 12:24:30 -0500    

Click here for diff

As of commit 287822068246a6ae30bb2c7191de727672ae6328, PL/Tcl will not  
compile against pre-8.0 Tcl, whereas it used to work (more or less anyway)  
with quite prehistoric versions.  As long as we're moving these goalposts,  
let's reinstall them at someplace that has some thought behind it.  This  
commit sets the minimum allowed Tcl version at 8.4, and rips out some bits  
of compatibility cruft that are in consequence no longer needed.  Reasons  
for requiring 8.4 include:  
  
* 8.4 was released in 2002; there seems little reason to believe that  
anyone would want to use older versions with Postgres 9.6+.  
  
* We have no buildfarm members testing anything older than 8.4, and  
thus no way to know if it's broken.  
  
* We need at least 8.1 to allow enforcement of database encoding  
security (8.1 standardized Tcl on using UTF8 internally, before that  
it was pretty unpredictable).  
  
* Some versions between 8.1 and 8.4 allowed the backend to become  
multithreaded, which is disastrous.  We need at least 8.4 to be able  
to disable the Tcl notifier subsystem to prevent that.  
  
A small side benefit is that we can make the code more readable by  
doing s/CONST84/const/g.  

M src/pl/tcl/pltcl.c

Convert PL/Tcl to use Tcl's "object" interfaces.

commit   : 287822068246a6ae30bb2c7191de727672ae6328    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2016 12:07:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2016 12:07:31 -0500    

Click here for diff

The original implementation of Tcl was all strings, but they improved  
performance significantly by introducing typed "objects" (integers,  
lists, code, etc).  It's past time we made use of that; that happened  
in Tcl 8.0 which was released in 1997.  
  
This patch also modernizes some of the error-reporting code, which may  
cause small changes in the spelling of complaints about bad calls to  
PL/Tcl-provided commands.  
  
Jim Nasby and Karl Lehenbauer, reviewed by Victor Wagner  

M src/pl/tcl/pltcl.c

Fix TAP tests for older Perls.

commit   : 3b8d7215533ed3128b1b9174eae830d70c0453d0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2016 01:06:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2016 01:06:31 -0500    

Click here for diff

Commit 7132810c (Retain tempdirs for failed tests) used Test::More's  
is_passing method, but that was added in Test::More 0.89_01 which is  
sometime later than Perl 5.10.1.  Popular platforms such as RHEL6 don't  
have that, nevermind some of our older dinosaurs.  Do it the hard way.  
  
Michael Paquier, based on research by Craig Ringer  

M src/test/perl/TestLib.pm

Change the format of the VM fork to add a second bit per page.

commit   : a892234f830e832110f63fc0a2afce2fb21d1584    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 1 Mar 2016 21:49:41 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 1 Mar 2016 21:49:41 -0500    

Click here for diff

The new bit indicates whether every tuple on the page is already frozen.  
It is cleared only when the all-visible bit is cleared, and it can be  
set only when we vacuum a page and find that every tuple on that page is  
both visible to every transaction and in no need of any future  
vacuuming.  
  
A future commit will use this new bit to optimize away full-table scans  
that would otherwise be triggered by XID wraparound considerations.  A  
page which is merely all-visible must still be scanned in that case, but  
a page which is all-frozen need not be.  This commit does not attempt  
that optimization, although that optimization is the goal here.  It  
seems better to get the basic infrastructure in place first.  
  
Per discussion, it's very desirable for pg_upgrade to automatically  
migrate existing VM forks from the old format to the new format.  That,  
too, will be handled in a follow-on patch.  
  
Masahiko Sawada, reviewed by Kyotaro Horiguchi, Fujii Masao, Amit  
Kapila, Simon Riggs, Andres Freund, and others, and substantially  
revised by me.  

M contrib/pgstattuple/pgstatapprox.c
M doc/src/sgml/storage.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/heap/visibilitymap.c
M src/backend/catalog/index.c
M src/backend/commands/analyze.c
M src/backend/commands/vacuumlazy.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/storage/ipc/standby.c
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/visibilitymap.h
M src/include/catalog/catversion.h
M src/include/storage/bufpage.h

Improve coverage of pltcl regression tests.

commit   : 68c521eb92c3515e3306f51a7fd3f32d16c97524    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Mar 2016 20:01:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Mar 2016 20:01:07 -0500    

Click here for diff

Test composite-type arguments and the argisnull and spi_lastoid Tcl  
commmands.  This stuff was not covered before, but needs to be exercised  
since the upcoming Tcl object-conversion patch changes these code paths  
(and broke at least one of them).  

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

Add more tests for commit_timestamp feature

commit   : 9def031bd2821f35b5f506260d922482648a8bb0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 1 Mar 2016 19:53:18 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 1 Mar 2016 19:53:18 -0300    

Click here for diff

These tests verify that 1) WAL replay preserves the stored value,  
2) a streaming standby server replays the value obtained from the  
master, and 3) the behavior is sensible in the face of repeated  
configuration changes.  
  
One annoyance is that tmp_check/ subdir from the TAP tests is clobbered  
when the pg_regress test runs in the same subdirectory.  This is  
bothersome but not too terrible a problem, since the pg_regress test is  
not run anyway if the TAP tests fail (unless "make -k" is used).  
  
I had these tests around since commit 69e7235c93e2; add them now that we  
have the recovery test framework in place.  

M src/test/modules/commit_ts/Makefile
A src/test/modules/commit_ts/t/001_base.pl
A src/test/modules/commit_ts/t/002_standby.pl
A src/test/modules/commit_ts/t/003_standby_2.pl

TAP tests: retain temp dirs on test failure

commit   : 88802e068017bee8cea7a5502a712794e761c7b5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 1 Mar 2016 19:50:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 1 Mar 2016 19:50:13 -0300    

Click here for diff

This makes it easier to study the reason for the failure.  
  
Author: Kyotaro Horiguchi  
Reviewed-By: Craig Ringer  

M src/test/perl/TestLib.pm

Fix incorrect comment.

commit   : 212bba93ce52e5605f8b7fc1ede2e7aef797c372    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 1 Mar 2016 13:31:44 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 1 Mar 2016 13:31:44 -0500    

Click here for diff

PQmblen and PQdsplen return information about characters, not words.  
  
Kyotaro Horiguchi  

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

Fix mistake in extensible node code.

commit   : aec64e8f45209b084fa33482de3831bc68b18913    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 1 Mar 2016 13:17:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 1 Mar 2016 13:17:09 -0500    

Click here for diff

I believe that I (rhaas) introduced this bug while editing the patch  
that became bcac23de73b89b001fbc628d84471a392e928d1c.  
  
Report and patch from KaiGai Kohei.  

M src/backend/nodes/extensible.c

Extend pgbench's expression syntax to support a few built-in functions.

commit   : 7e137f846df2431ce9c61202dcea21ee4a6d7822    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 1 Mar 2016 13:04:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 1 Mar 2016 13:04:09 -0500    

Click here for diff

Fabien Coelho, reviewed mostly by Michael Paquier and me, but also by  
Heikki Linnakangas, BeomYong Lee, Kyotaro Horiguchi, Oleksander  
Shulgin, and Álvaro Herrera.  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h

Add Unicode map generation scripts as rule prerequisites

commit   : bd6cf3f237c9aeb4dad1ac3ec2008c5768fe4c1b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    

Click here for diff

That way, the rules will trigger when the scripts change.  

M src/backend/utils/mb/Unicode/Makefile

Fix comments

commit   : cc074bf6c1a5305a5e23067c6d9a377840add303    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    

Click here for diff

Some of these comments were copied and pasted without updating them,  
some of them were duplicates.  

M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl

UCS_to_most.pl: Make executable, for consistency with other scripts

commit   : 9a3e06baa2e42a5018dcd6afda31255b4e772518    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Feb 2016 20:08:16 -0500    

Click here for diff

M src/backend/utils/mb/Unicode/UCS_to_most.pl

Suppress scary-looking log messages from async-notify isolation test.

commit   : 3d523564c53ab8f35edf4d20627f0a375a17624d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Feb 2016 19:29:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Feb 2016 19:29:19 -0500    

Click here for diff

I noticed that the async-notify test results in log messages like these:  
  
LOG:  could not send data to client: Broken pipe  
FATAL:  connection to client lost  
  
This is because it unceremoniously disconnects a client session that is  
about to have some NOTIFY messages delivered to it.  Such log messages  
during a regression test might well cause people to go looking for a  
problem that doesn't really exist (it did cause me to waste some time that  
way).  We can shut it up by adding an UNLISTEN command to session teardown.  
  
Patch HEAD only; this doesn't seem significant enough to back-patch.  

M src/test/isolation/specs/async-notify.spec

Improve error message for rejecting RETURNING clauses with dropped columns.

commit   : 8d8ff5f7db7d58240fac7d5f620308c91485b253    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Feb 2016 19:11:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Feb 2016 19:11:38 -0500    

Click here for diff

This error message was written with only ON SELECT rules in mind, but since  
then we also made RETURNING-clause targetlists go through the same logic.  
This means that you got a rather off-topic error message if you tried to  
add a rule with RETURNING to a table having dropped columns.  Ideally we'd  
just support that, but some preliminary investigation says that it might be  
a significant amount of work.  Seeing that Nicklas Avén's complaint is the  
first one we've gotten about this in the ten years or so that the code's  
been like that, I'm unwilling to put much time into it.  Instead, improve  
the error report by issuing a different message for RETURNING cases, and  
revise the associated comment based on this investigation.  
  
Discussion: [email protected]  

M src/backend/rewrite/rewriteDefine.c

Minor tweaks for new src/test/recovery

commit   : 5847397deca66fb4a4b3d2e0dcb3414dd5c4e180    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 29 Feb 2016 18:16:59 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 29 Feb 2016 18:16:59 -0300    

Click here for diff

Author: Michael Paquier  

M doc/src/sgml/install-windows.sgml
M src/test/README
M src/test/recovery/.gitignore
M src/test/recovery/Makefile
M src/test/recovery/README
M src/test/recovery/t/002_archiving.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/tools/msvc/clean.bat

Fix typos

commit   : 10b4852215a37915e55f034f919a6dc8bc72e988    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 29 Feb 2016 18:11:58 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 29 Feb 2016 18:11:58 -0300    

Click here for diff

Author: Amit Langote  

M src/backend/replication/syncrep.c

doc: document MANPATH as /usr/local/pgsql/share/man

commit   : 1c7c189fc1961f890bc06d6adb6bdfc739f5f927    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 29 Feb 2016 17:53:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 29 Feb 2016 17:53:55 -0300    

Click here for diff

The docs were advising to use /usr/local/pgsql/man instead, but that's  
wrong.  
  
Reported-By: Slawomir Sudnik  
Backpatch-To: 9.1  
Bug: #13894  

M doc/src/sgml/installation.sgml

Make new isolationtester test more stable

commit   : 54638f5708e59e5fd7c79b8315d8c6e810d7bc13    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 29 Feb 2016 16:28:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 29 Feb 2016 16:28:54 -0300    

Click here for diff

The original coding of the test was relying too much on the ordering in  
which backends are awakened once an advisory lock which they wait for is  
released.  Change the code so that each backend uses its own advisory  
lock instead, so that the output becomes stable.  Also add a few seconds  
of sleep between lock releases, so that the test isn't broken in  
overloaded buildfarm animals, as suggested by Tom Lane.  
  
Per buildfarm members spoonbill and guaibasaurus.  
  
Discussion: https://www.postgresql.org/message-id/19294.1456551587%40sss.pgh.pa.us  

M src/test/isolation/expected/tuplelock-update.out
M src/test/isolation/specs/tuplelock-update.spec

Remove useless unary plus.

commit   : c110678a47aac87c661785a70061e160cd17713d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Feb 2016 10:48:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Feb 2016 10:48:40 -0500    

Click here for diff

It's harmless, but might confuse readers.  Seems to have been introduced  
in 6bc8ef0b7f1f1df3.  Back-patch, just to avoid cosmetic cross-branch  
differences.  
  
Amit Langote  

M src/backend/utils/init/postinit.c

Fix build under OPTIMIZER_DEBUG.

commit   : 05893712cc9950b7c4c312aa9d3d444375bf15a2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Feb 2016 10:14:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Feb 2016 10:14:12 -0500    

Click here for diff

In commit 19a541143a09c067 I replaced RelOptInfo.width with  
RelOptInfo.reltarget.width, but I missed updating debug_print_rel()  
for that because it's not compiled by default.  
Reported by Salvador Fandino, patch by Michael Paquier.  

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

Fix incorrect varlevelsup in security_barrier_replace_vars().

commit   : 41fedc24626696fdf55d0c43131d91757dbe1c66    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 29 Feb 2016 12:28:06 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 29 Feb 2016 12:28:06 +0000    

Click here for diff

When converting an RTE with securityQuals into a security barrier  
subquery RTE, ensure that the Vars in the new subquery's targetlist  
all have varlevelsup = 0 so that they correctly refer to the  
underlying base relation being wrapped.  
  
The original code was creating new Vars by copying them from existing  
Vars referencing the base relation found elsewhere in the query, but  
failed to account for the fact that such Vars could come from sublink  
subqueries, and hence have varlevelsup > 0. In practice it looks like  
this could only happen with nested security barrier views, where the  
outer view has a WHERE clause containing a correlated subquery, due to  
the order in which the Vars are processed.  
  
Bug: #13988  
Reported-by: Adam Guthrie  
Backpatch-to: 9.4, where updatable SB views were introduced  

M src/backend/optimizer/prep/prepsecurity.c
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/updatable_views.sql

Avoid multiple free_struct_lconv() calls on same data.

commit   : 907e4dd2b104bdcb4af042065a92fcd73d5790ec    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 Feb 2016 23:39:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 Feb 2016 23:39:20 -0500    

Click here for diff

A failure partway through PGLC_localeconv() led to a situation where  
the next call would call free_struct_lconv() a second time, leading  
to free() on already-freed strings, typically leading to a core dump.  
Add a flag to remember whether we need to do that.  
  
Per report from Thom Brown.  His example case only provokes the failure  
as far back as 9.4, but nonetheless this code is obviously broken, so  
back-patch to all supported branches.  

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

Allow multiple --temp-config arguments to pg_regress

commit   : 26fdff1b8f76f3c47d4e19be7c4aef3cdcd3393c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 28 Feb 2016 09:38:43 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 28 Feb 2016 09:38:43 -0500    

Click here for diff

This means that if, for example, TEMP_CONFIG is set and a Makefile  
explicitly sets a temp-config file, both will now be used.  
  
Patch from John Gorman.  

M src/test/regress/pg_regress.c

Respect TEMP_CONFIG when pg_regress_check and friends are called

commit   : 87cc6b57a911bf439ff9e53f1eddba58e9749ffe    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 27 Feb 2016 12:28:21 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 27 Feb 2016 12:28:21 -0500    

Click here for diff

This reverts commit 9117985b6ba9beda4f280f596035649fc23b6233 in favor of  
a more general solution.  

M contrib/contrib-global.mk
M src/Makefile.global.in
M src/interfaces/ecpg/test/Makefile
M src/test/isolation/Makefile
M src/test/regress/GNUmakefile

Add isolationtester spec for old heapam.c bug

commit   : c9578135f769072e2597b88402f256a398279c91    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Feb 2016 17:11:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Feb 2016 17:11:15 -0300    

Click here for diff

In 0e5680f4737a, I fixed a bug in heapam that caused spurious deadlocks  
when multiple updates concurrently attempted to modify the old version  
of an updated tuple whose new version was key-share locked.  I proposed  
an isolationtester spec file that reproduced the bug, but back then  
isolationtester wasn't mature enough to be able to run it.  Now that  
38f8bdcac498 is in the tree, we can have this spec file too.  
  
Discussion: https://www.postgresql.org/message-id/20141212205254.GC1768%40alvh.no-ip.org  

A src/test/isolation/expected/tuplelock-update.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/tuplelock-update.spec

Apply last revision of recovery patch

commit   : 74d58425c70f9f7f1cb5d7f428ceaa1b56aa081d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Feb 2016 16:22:53 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Feb 2016 16:22:53 -0300    

Click here for diff

I applied the previous-to-last revision of Michaël's submitted patch  
instead of the last; these two tweaks pointed out by Craig were left out  
of the previous commit by accident.  

M src/test/perl/PostgresNode.pm
M src/test/recovery/t/001_stream_rep.pl

Add a test framework for recovery

commit   : 49148645f7f30f461b09618b5342b37425f33b22    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Feb 2016 16:13:30 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Feb 2016 16:13:30 -0300    

Click here for diff

This long-awaited framework is an expansion of the existing PostgresNode  
stuff to support additional features for recovery testing; the recovery  
tests included in this commit are a starting point that cover some of  
the recovery features we have.  More scripts are expected to be added  
later.  
  
Author: Michaël Paquier, a bit of help from Amir Rohan  
Reviewed by: Amir Rohan, Stas Kelvich, Kyotaro Horiguchi, Victor Wagner,  
Craig Ringer, Álvaro Herrera  
Discussion: http://www.postgresql.org/message-id/CAB7nPqTf7V6rswrFa=q_rrWeETUWagP=h8LX8XAov2Jcxw0DRg@mail.gmail.com  
Discussion: http://www.postgresql.org/message-id/trinity-b4a8035d-59af-4c42-a37e-258f0f28e44a-1443795007012@3capp-mailcom-lxa08  

M doc/src/sgml/install-windows.sgml
M src/test/Makefile
M src/test/perl/PostgresNode.pm
A src/test/recovery/.gitignore
A src/test/recovery/Makefile
A src/test/recovery/README
A src/test/recovery/t/001_stream_rep.pl
A src/test/recovery/t/002_archiving.pl
A src/test/recovery/t/003_recovery_targets.pl
A src/test/recovery/t/004_timeline_switch.pl
A src/test/recovery/t/005_replay_delay.pl
M src/tools/msvc/vcregress.pl

Move some code from RewindTest into PostgresNode

commit   : 89ac7004dadf4116d9b180bb5ff64b64bfce94b1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Feb 2016 13:24:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Feb 2016 13:24:22 -0300    

Click here for diff

Some code in the RewindTest test suite is more generally useful than  
just for that suite, so put it where other test suites can reach it.  
  
Some postgresql.conf parameters change their default values when a  
cluster is initialized with 'allows_streaming' than the previous  
behavior; most notably, autovacuum is no longer turned off.  
  
(Also, we no longer call pg_ctl promote with -w, but that flag doesn't  
actually do anything in promote so there's no behavior change.)  
  
Author: Michael Paquier  

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

On second thought, disable parallelism for prepared statements.

commit   : 7bea19d0a9d3e6975418ffe685fb510bd31ab434    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Feb 2016 16:33:37 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Feb 2016 16:33:37 +0530    

Click here for diff

CREATE TABLE .. AS EXECUTE can turn an apparently read-only query into  
a write operation, which parallel query can't handle.  It's a bit of a  
shame that requires us to avoid parallel query for queries prepared via  
PREPARE in all cases, but for right now it does.  

M src/backend/commands/prepare.c

Add new FDW API to test for parallel-safety.

commit   : 35746bc348b6bf1f690fe17f4f80cfb68e22f504    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Feb 2016 16:14:46 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Feb 2016 16:14:46 +0530    

Click here for diff

This is basically a bug fix; the old code assumes that a ForeignScan  
is always parallel-safe, but for postgres_fdw, for example, this is  
definitely false.  It should be true for file_fdw, though, since a  
worker can read a file from the filesystem just as well as any other  
backend process.  
  
Original patch by Thomas Munro.  Documentation, and changes to the  
comments, by me.  

M contrib/file_fdw/file_fdw.c
M doc/src/sgml/fdwhandler.sgml
M src/backend/optimizer/path/allpaths.c
M src/include/foreign/fdwapi.h

Respect TEMP_CONFIG when running contrib regression tests.

commit   : 9117985b6ba9beda4f280f596035649fc23b6233    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Feb 2016 12:38:21 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Feb 2016 12:38:21 +0530    

Click here for diff

Thomas Munro  

M contrib/contrib-global.mk

Add POD docs to PostgresNode

commit   : e64009303d4e2434abafbdafe4d571cc4f279d39    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 25 Feb 2016 21:31:52 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 25 Feb 2016 21:31:52 -0300    

Click here for diff

Also, the dump_info method got split into another method that returns  
the stuff as a string instead of just printing it to stdout.  
  
Add a new README in src/test/perl too.  
  
Author: Craig Ringer  
Reviewed by: Michaël Paquier  

M src/test/perl/PostgresNode.pm
A src/test/perl/README

Add README in src/test and src/test/modules

commit   : bda0b081984011ba5347bf3eecc95b71833de082    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 25 Feb 2016 21:08:32 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 25 Feb 2016 21:08:32 -0300    

Click here for diff

Author: Craig Ringer  
Reviewed by: Michaël Paquier  

A src/test/README
A src/test/modules/README

Fix typos

commit   : 343f709c0691abdc779bec91fa3587dda259808e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 25 Feb 2016 20:50:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 25 Feb 2016 20:50:20 -0300    

Click here for diff

Backpatch to: 9.4  

M src/include/replication/reorderbuffer.h

Enable parallelism for prepared statements and extended query protocol.

commit   : 57a6a72b6bc98f3003e87bc31de4b9c2c89fe019    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 25 Feb 2016 13:02:18 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 25 Feb 2016 13:02:18 +0530    

Click here for diff

Parallel query can't handle running a query only partially rather than  
to completion.  However, there seems to be no way to run a statement  
prepared via SQL PREPARE other than to completion, so we can enable it  
there without a problem.  
  
The situation is more complicated for the extend query protocol.  
libpq seems to provide no way to send an Execute message with a  
non-zero rowcount, but some other client might.  If that happens, and  
a parallel plan was chosen, we'll execute the parallel plan without  
using any workers, which may be somewhat inefficient but should still  
work.  Hopefully this won't be a problem; users can always set  
max_parallel_degree=0 to avoid choosing parallel plans in the first  
place.  
  
Amit Kapila, reviewed by me.  

M src/backend/commands/prepare.c
M src/backend/tcop/postgres.c

Clean the last few TAP suite tmp_check directories.

commit   : 25924ac47abde5330ca502e23796e9d37cd1ae68    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 24 Feb 2016 23:41:54 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 24 Feb 2016 23:41:54 -0500    

Click here for diff

Back-patch to 9.5, where the suites were introduced.  

M src/bin/pgbench/Makefile
M src/test/ssl/Makefile

MSVC: Clean tmp_check directory of pg_controldata test suite.

commit   : 41635887835d54715a2fd4745dbf0fdb99f57f4f    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 24 Feb 2016 23:41:33 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 24 Feb 2016 23:41:33 -0500    

Click here for diff

Back-patch to 9.4, where the suite was introduced.  

M src/tools/msvc/clean.bat

Create a function to reliably identify which sessions block which others.

commit   : 52f5d578d6c29bf254e93c69043b817d4047ca67    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 Feb 2016 14:31:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 22 Feb 2016 14:31:43 -0500    

Click here for diff

This patch introduces "pg_blocking_pids(int) returns int[]", which returns  
the PIDs of any sessions that are blocking the session with the given PID.  
Historically people have obtained such information using a self-join on  
the pg_locks view, but it's unreasonably tedious to do it that way with any  
modicum of correctness, and the addition of parallel queries has pretty  
much broken that approach altogether.  (Given some more columns in the view  
than there are today, you could imagine handling parallel-query cases with  
a 4-way join; but ugh.)  
  
The new function has the following behaviors that are painful or impossible  
to get right via pg_locks:  
  
1. Correctly understands which lock modes block which other ones.  
  
2. In soft-block situations (two processes both waiting for conflicting lock  
modes), only the one that's in front in the wait queue is reported to  
block the other.  
  
3. In parallel-query cases, reports all sessions blocking any member of  
the given PID's lock group, and reports a session by naming its leader  
process's PID, which will be the pg_backend_pid() value visible to  
clients.  
  
The motivation for doing this right now is mostly to fix the isolation  
tests.  Commit 38f8bdcac4982215beb9f65a19debecaf22fd470 lobotomized  
isolationtester's is-it-waiting query by removing its ability to recognize  
nonconflicting lock modes, as a crude workaround for the inability to  
handle soft-block situations properly.  But even without the lock mode  
tests, the old query was excessively slow, particularly in  
CLOBBER_CACHE_ALWAYS builds; some of our buildfarm animals fail the new  
deadlock-hard test because the deadlock timeout elapses before they can  
probe the waiting status of all eight sessions.  Replacing the pg_locks  
self-join with use of pg_blocking_pids() is not only much more correct, but  
a lot faster: I measure it at about 9X faster in a typical dev build with  
Asserts, and 3X faster in CLOBBER_CACHE_ALWAYS builds.  That should provide  
enough headroom for the slower CLOBBER_CACHE_ALWAYS animals to pass the  
test, without having to lengthen deadlock_timeout yet more and thus slow  
down the test for everyone else.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/lock.c
M src/backend/utils/adt/lockfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/storage/lock.h
M src/include/storage/procarray.h
M src/include/utils/builtins.h
M src/test/isolation/isolationtester.c

Remove redundant PGPROC.lockGroupLeaderIdentifier field.

commit   : 73bf8715aa7430bd003516bde448507fbe789c05    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 Feb 2016 11:20:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 22 Feb 2016 11:20:35 -0500    

Click here for diff

We don't really need this field, because it's either zero or redundant with  
PGPROC.pid.  The use of zero to mark "not a group leader" is not necessary  
since we can just as well test whether lockGroupLeader is NULL.  This does  
not save very much, either as to code or data, but the simplification seems  
worthwhile anyway.  

M src/backend/storage/lmgr/README
M src/backend/storage/lmgr/proc.c
M src/include/storage/proc.h

Fix wrong keysize in PrivateRefCountHash creation.

commit   : ea56b06cf77a6932a74f9d4ec6c950a333d1527d    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 21 Feb 2016 22:48:44 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 21 Feb 2016 22:48:44 -0800    

Click here for diff

In 4b4b680c3 I accidentally used sizeof(PrivateRefCountArray) instead of  
sizeof(PrivateRefCountEntry) when creating the refcount overflow  
hashtable. As the former is bigger than the latter, this luckily only  
resulted in a slightly increased memory usage when many buffers are  
pinned in a backend.  
  
Reported-By: Takashi Horikawa  
Discussion: [email protected]  
Backpatch: 9.5, where thew new ref count infrastructure was introduced  

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

Docs: make prose discussion match the ordering of Table 9-58.

commit   : 64a169d1313d6b99b48c2d270df121ef43c03269    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 21 Feb 2016 15:23:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 21 Feb 2016 15:23:17 -0500    

Click here for diff

The "Session Information Functions" table seems to be sorted mostly  
alphabetically (although it's not perfect), which would be all right  
if it didn't lead to some related functions being described in a  
pretty nonintuitive order.  Also, the prose discussions after the table  
were in an order that hardly matched the table at all.  Rearrange to  
make things a bit easier to follow.  

M doc/src/sgml/func.sgml

Cosmetic improvements in new config_info code.

commit   : c7a1c5a6b6aa4bbc2c9619edc94368fccc1c8c8e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 21 Feb 2016 11:38:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 21 Feb 2016 11:38:24 -0500    

Click here for diff

Coverity griped about use of unchecked strcpy() into a local variable.  
There's unlikely to be any actual bug there, since no caller would be  
passing a path longer than MAXPGPATH, but nonetheless use of strlcpy()  
seems preferable.  
  
While at it, get rid of unmaintainable separation between list of  
field names and list of field values in favor of initializing them  
in parallel.  And we might as well declare get_configdata()'s path  
argument as const char *, even though no current caller needs that.  

M src/common/config_info.c
M src/include/common/config_info.h

Fix two-argument jsonb_object when called with empty arrays

commit   : 94c745eb189e2122a3ff86c24443b11408ea2376    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 21 Feb 2016 10:30:49 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 21 Feb 2016 10:30:49 -0500    

Click here for diff

Some over-eager copy-and-pasting on my part resulted in a nonsense  
result being returned in this case. I have adopted the same pattern for  
handling this case as is used in the one argument form of the function,  
i.e. we just skip over the code that adds values to the object.  
  
Diagnosis and patch from Michael Paquier, although not quite his  
solution.  
  
Fixes bug #13936.  
  
Backpatch to 9.5 where jsonb_object was introduced.  

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

Fix incorrect decision about which lock to take.

commit   : 88aca5662d6a6362ce8c5aba08f469e92f44a1e7    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 21 Feb 2016 17:06:41 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 21 Feb 2016 17:06:41 +0530    

Click here for diff

Spotted by Tom Lane.  

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

Cosmetic improvements to group locking.

commit   : d91a4a6c85d360678310470854d5d932d1833aa8    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 21 Feb 2016 15:42:02 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 21 Feb 2016 15:42:02 +0530    

Click here for diff

Reflow text in lock manager README so that it fits within 80 columns.  
Correct some mistakes.  Expand the README to explain not only why group  
locking exists but also the data structures that support it.  Improve  
comments related to group locking several files.  Change the name of a  
macro argument for improved clarity.  
  
Most of these problems were reported by Tom Lane, but I found a few  
of them myself.  
  
Robert Haas and Tom Lane  

M src/backend/storage/lmgr/README
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/lock.h
M src/include/storage/proc.h

postgres_fdw: Avoid sharing list substructure.

commit   : dd077ef832e1ec7f5ba2a706152d22647a3b80f5    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 21 Feb 2016 14:17:50 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 21 Feb 2016 14:17:50 +0530    

Click here for diff

list_concat(list_concat(a, b), c) destructively changes both a and b;  
to avoid such perils, copy lists of remote_conds before incorporating  
them into larger lists via list_concat().  
  
Ashutosh Bapat, per a report from Etsuro Fujita  

M contrib/postgres_fdw/postgres_fdw.c

Fix wording in the Tutorial document.

commit   : 902fd1f4e2457f6f04a988920491fffb90028035    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Sun, 21 Feb 2016 09:04:59 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Sun, 21 Feb 2016 09:04:59 +0900    

Click here for diff

With suggentions from Tom Lane.  

M doc/src/sgml/start.sgml

Further fixing to make pg_size_bytes() portable.

commit   : 740d71842b8e0e798c80f4f841227b6de81b5f43    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 20 Feb 2016 15:49:26 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 20 Feb 2016 15:49:26 +0000    

Click here for diff

Not all compilers support "long long" and the "LL" integer literal  
suffix, so use a cast to int64 instead.  

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

Fix pg_size_bytes() to be more portable.

commit   : ad7cc1c554980145b226a066afe56d9c777ce7ae    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 20 Feb 2016 11:03:04 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 20 Feb 2016 11:03:04 +0000    

Click here for diff

Commit 53874c5228fe16589a4d01b3e1fab3678e0fd8e3 broke various 32-bit  
buildfarm machines because it incorrectly used an 'L' suffix for what  
needed to be a 64-bit literal. Thanks to Michael Paquier for helping  
to diagnose this.  

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

Add pg_size_bytes() to parse human-readable size strings.

commit   : 53874c5228fe16589a4d01b3e1fab3678e0fd8e3    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 20 Feb 2016 09:57:27 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 20 Feb 2016 09:57:27 +0000    

Click here for diff

This will parse strings in the format produced by pg_size_pretty() and  
return sizes in bytes. This allows queries to be written with clauses  
like "pg_total_relation_size(oid) > pg_size_bytes('10 GB')".  
  
Author: Pavel Stehule with various improvements by Vitaly Burovoy  
Discussion: http://www.postgresql.org/message-id/CAFj8pRD-tGoDKnxdYgECzA4On01_uRqPrwF-8LdkSE-6bDHp0w@mail.gmail.com  
Reviewed-by: Vitaly Burovoy, Oleksandr Shulgin, Kyotaro Horiguchi,  
    Michael Paquier and Robert Haas  

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

doc: Improve CSS style of option element

commit   : 091b6055e3e52338850370f17835e833ca66ac55    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 19 Feb 2016 23:00:22 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 19 Feb 2016 23:00:22 -0500    

Click here for diff

Prevent wrapping of the element content to avoid confusing line breaks  
between hyphens.  

M doc/src/sgml/stylesheet.css

Call xlc __isync() after, not before, associated compare-and-swap.

commit   : 5882ca66868e1f6fe287dfb41ebaab0bcb1784b2    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 19 Feb 2016 22:47:50 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 19 Feb 2016 22:47:50 -0500    

Click here for diff

Architecture reference material specifies this order, and s_lock.h  
inline assembly agrees.  The former order failed to provide mutual  
exclusion to lwlock.c and perhaps to other clients.  The two xlc  
buildfarm members, hornet and mandrill, have failed sixteen times with  
duplicate key errors involving pg_class_oid_index or pg_type_oid_index.  
Back-patch to 9.5, where commit b64d92f1a5602c55ee8b27a7ac474f03b7aee340  
introduced atomics.  
  
Reviewed by Andres Freund and Tom Lane.  

M src/bin/pgbench/.gitignore
M src/bin/pgbench/Makefile
A src/bin/pgbench/t/001_pgbench.pl
M src/include/port/atomics/generic-xlc.h
M src/tools/msvc/clean.bat

Correct StartupSUBTRANS for page wraparound

commit   : 481725c0ba731b77fb32cadb12013373e378011a    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 19 Feb 2016 08:31:12 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 19 Feb 2016 08:31:12 +0000    

Click here for diff

StartupSUBTRANS() incorrectly handled cases near the max pageid in the subtrans  
data structure, which in some cases could lead to errors in startup for Hot  
Standby.  
This patch wraps the pageids correctly, avoiding any such errors.  
Identified by exhaustive crash testing by Jeff Janes.  
  
Jeff Janes  

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

pg_dump: Fix inconsistent sscanf() conversions

commit   : a914a0414232e30943f7b2ffd997d74bd018a7b1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Feb 2016 20:12:38 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Feb 2016 20:12:38 -0500    

Click here for diff

It was using %u to read a string that was earlier produced by snprintf with %d  
into a signed integer variable.  This seems to work in practice but is  
incorrect.  
  
found by cppcheck  

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

Add an explicit representation of the output targetlist to Paths.

commit   : 19a541143a09c067ec8cac77ec6a64eb5b1b662b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Feb 2016 20:01:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Feb 2016 20:01:49 -0500    

Click here for diff

Up to now, there's been an assumption that all Paths for a given relation  
compute the same output column set (targetlist).  However, there are good  
reasons to remove that assumption.  For example, an indexscan on an  
expression index might be able to return the value of an expensive function  
"for free".  While we have the ability to generate such a plan today in  
simple cases, we don't have a way to model that it's cheaper than a plan  
that computes the function from scratch, nor a way to create such a plan  
in join cases (where the function computation would normally happen at  
the topmost join node).  Also, we need this so that we can have Paths  
representing post-scan/join steps, where the targetlist may well change  
from one step to the next.  Therefore, invent a "struct PathTarget"  
representing the columns we expect a plan step to emit.  It's convenient  
to include the output tuple width and tlist evaluation cost in this struct,  
and there will likely be additional fields in future.  
  
While Path nodes that actually do have custom outputs will need their own  
PathTargets, it will still be true that most Paths for a given relation  
will compute the same tlist.  To reduce the overhead added by this patch,  
keep a "default PathTarget" in RelOptInfo, and allow Paths that compute  
that column set to just point to their parent RelOptInfo's reltarget.  
(In the patch as committed, actually every Path is like that, since we  
do not yet have any cases of custom PathTargets.)  
  
I took this opportunity to provide some more-honest costing of  
PlaceHolderVar evaluation.  Up to now, the assumption that "scan/join  
reltargetlists have cost zero" was applied not only to Vars, where it's  
reasonable, but also PlaceHolderVars where it isn't.  Now, we add the eval  
cost of a PlaceHolderVar's expression to the first plan level where it can  
be computed, by including it in the PathTarget cost field and adding that  
to the cost estimates for Paths.  This isn't perfect yet but it's much  
better than before, and there is a way forward to improve it more.  This  
costing change affects the join order chosen for a couple of the regression  
tests, changing expected row ordering.  

M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/fdwhandler.sgml
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/relation.h
M src/include/optimizer/placeholder.h
M src/test/regress/expected/join.out

pg_upgrade: suppress creation of delete script

commit   : 3386f34cdcf162e895a8d998532796076057913d    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 18 Feb 2016 18:32:27 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 18 Feb 2016 18:32:27 -0500    

Click here for diff

Suppress creation of the pg_upgrade delete script when the new data  
directory is inside the old data directory.  
  
Reported-by: IRC  
  
Backpatch-through: 9.3, where delete script tests were added  

M src/bin/pg_upgrade/check.c

Fix multiple bugs in contrib/pgstattuple's pgstatindex() function.

commit   : 48e6c943e5f11f5d80cabdbcd98f79e3dbad1988    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Feb 2016 15:40:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Feb 2016 15:40:35 -0500    

Click here for diff

Dead or half-dead index leaf pages were incorrectly reported as live, as a  
consequence of a code rearrangement I made (during a moment of severe brain  
fade, evidently) in commit d287818eb514d431.  
  
The index metapage was not counted in index_size, causing that result to  
not agree with the actual index size on-disk.  
  
Index root pages were not counted in internal_pages, which is inconsistent  
compared to the case of a root that's also a leaf (one-page index), where  
the root would be counted in leaf_pages.  Aside from that inconsistency,  
this could lead to additional transient discrepancies between the reported  
page counts and index_size, since it's possible for pgstatindex's scan to  
see zero or multiple pages marked as BTP_ROOT, if the root moves due to  
a split during the scan.  With these fixes, index_size will always be  
exactly one page more than the sum of the displayed page counts.  
  
Also, the index_size result was incorrectly documented as being measured in  
pages; it's always been measured in bytes.  (While fixing that, I couldn't  
resist doing some small additional wordsmithing on the pgstattuple docs.)  
  
Including the metapage causes the reported index_size to not be zero for  
an empty index.  To preserve the desired property that the pgstattuple  
regression test results are platform-independent (ie, BLCKSZ configuration  
independent), scale the index_size result in the regression tests.  
  
The documentation issue was reported by Otsuka Kenji, and the inconsistent  
root page counting by Peter Geoghegan; the other problems noted by me.  
Back-patch to all supported branches, because this has been broken for  
a long time.  

M contrib/pgstattuple/expected/pgstattuple.out
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/sql/pgstattuple.sql
M doc/src/sgml/pgstattuple.sgml

Improve error message about active replication slot

commit   : 18777c38e9cc2e032b919a7f532971745b32aec0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 17 Feb 2016 21:22:13 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 17 Feb 2016 21:22:13 -0500    

Click here for diff

The old phrasing was awkward if a replication slot is activated and  
deactivated repeatedly.  

M src/backend/replication/slot.c

Revert inadvertant change in pg_config behavior

commit   : fc8a81e3e73e30ac083cc60837ecf98b33d5cc7e    
  
author   : Joe Conway <[email protected]>    
date     : Wed, 17 Feb 2016 10:00:34 -0800    
  
committer: Joe Conway <[email protected]>    
date     : Wed, 17 Feb 2016 10:00:34 -0800    

Click here for diff

In commit a5c43b88 the behavior of command line pg_config was  
inadvertantly changed to include the config name when specific  
configs are requested, similar to when none are requested and  
all are emitted. This breaks scripts that expect to use  
pg_config for e.g. PGXS. Revert the behavior to the previous.  

M src/bin/pg_config/pg_config.c

Add new system view, pg_config

commit   : a5c43b886942e96ec5c745041f2d6a50c3205147    
  
author   : Joe Conway <[email protected]>    
date     : Wed, 17 Feb 2016 09:12:06 -0800    
  
committer: Joe Conway <[email protected]>    
date     : Wed, 17 Feb 2016 09:12:06 -0800    

Click here for diff

Move and refactor the underlying code for the pg_config client  
application to src/common in support of sharing it with a new  
system information SRF called pg_config() which makes the same  
information available via SQL. Additionally wrap the SRF with a  
new system view, as called pg_config.  
  
Patch by me with extensive input and review by Michael Paquier  
and additional review by Alvaro Herrera.  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/misc/Makefile
A src/backend/utils/misc/pg_config.c
M src/bin/pg_config/Makefile
M src/bin/pg_config/pg_config.c
M src/common/Makefile
A src/common/config_info.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
A src/include/common/config_info.h
M src/include/port.h
M src/include/utils/builtins.h
M src/port/path.c
M src/test/regress/expected/rules.out
M src/tools/msvc/Mkvcbuild.pm

Reuse abbreviated keys in ordered [set] aggregates.

commit   : f1f5ec1efafe74ca45e24e0bf3371b1d6985c8ee    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 17 Feb 2016 15:40:00 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 17 Feb 2016 15:40:00 +0530    

Click here for diff

When processing ordered aggregates following a sort that could make use  
of the abbreviated key optimization, only call the equality operator to  
compare successive pairs of tuples when their abbreviated keys were not  
equal.  
  
Peter Geoghegan, reviewd by Andreas Karlsson and by me.  

M src/backend/catalog/index.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeSort.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/sort/tuplesort.c
M src/include/utils/tuplesort.h

Make plpython cope with funny characters in function names.

commit   : 66f503868b2ac1163aaf48a2f76d8be02af0bc81    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Feb 2016 21:08:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Feb 2016 21:08:15 -0500    

Click here for diff

A function name that's double-quoted in SQL can contain almost any  
characters, but we were using that name directly as part of the name  
generated for the Python-level function, and Python doesn't like  
anything that isn't pretty much a standard identifier.  To fix,  
replace anything that isn't an ASCII letter or digit with an underscore  
in the generated name.  This doesn't create any risk of duplicate Python  
function names because we were already appending the function OID to  
the generated name to ensure uniqueness.  Per bug #13960 from Jim Nasby.  
  
Patch by Jim Nasby, modified a bit by me.  Back-patch to all  
supported branches.  

M src/pl/plpython/expected/plpython_test.out
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/sql/plpython_test.sql

Improve documentation about CREATE INDEX CONCURRENTLY.

commit   : a65313f28bfc264573a066271a11172d109dc2c4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Feb 2016 13:43:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Feb 2016 13:43:03 -0500    

Click here for diff

Clarify the description of which transactions will block a CREATE INDEX  
CONCURRENTLY command from proceeding, and mention that the index might  
still not be usable after CREATE INDEX completes.  (This happens if the  
index build detected broken HOT chains, so that pg_index.indcheckxmin gets  
set, and there are open old transactions preventing the xmin horizon from  
advancing past the index's initial creation.  I didn't want to explain what  
broken HOT chains are, though, so I omitted an explanation of exactly when  
old transactions prevent the index from being used.)  
  
Per discussion with Chris Travers.  Back-patch to all supported branches,  
since the same text appears in all of them.  

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

release notes: fix 9.5 SGML comment about commit

commit   : ab0757c1f1bf6b9b7c86e51c9fb5b082c87c5109    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 16 Feb 2016 12:42:35 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 16 Feb 2016 12:42:35 -0500    

Click here for diff

Reported-by: Tatsuo Ishii  
  
Backpatch-through: 9.5  

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

Changed expected result to list IPv6 local interface too.

commit   : 868898739a8da9ab74c105b8349b7b5c711f265a    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 16 Feb 2016 14:34:10 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 16 Feb 2016 14:34:10 +0100    

Click here for diff

M src/interfaces/ecpg/test/expected/connect-test1.stderr

Change ecpg lexer to accept comments with line breaks in CPP lines.

commit   : fc1ae7d2eb6a3de47f5f5cd6ebf2d18d226b8036    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 16 Feb 2016 14:23:50 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 16 Feb 2016 14:23:50 +0100    

Click here for diff

M src/interfaces/ecpg/preproc/pgc.l

Improve wording in the planner doc

commit   : bdc309c7dc849a7362a624846ebc9170a8c353f3    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Tue, 16 Feb 2016 15:36:52 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Tue, 16 Feb 2016 15:36:52 +0900    

Click here for diff

Change "In this case" to "In the example above" to clarify what it  
actually refers to.  

M doc/src/sgml/planstats.sgml

Correct the formulas for System V IPC parameters SEMMNI and SEMMNS in docs.

commit   : 597f7e3a6ec393cf9ff3e11552faf69ff0ab652b    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 16 Feb 2016 14:49:47 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 16 Feb 2016 14:49:47 +0900    

Click here for diff

In runtime.sgml, the old formulas for calculating the reasonable  
values of SEMMNI and SEMMNS were incorrect. They have forgotten to  
count the number of semaphores which both the checkpointer process  
(introduced in 9.2) and the background worker processes (introduced  
in 9.3) need.  
  
This commit fixes those formulas so that they count the number of  
semaphores which the checkpointer process and the background worker  
processes need.  
  
Report and patch by Kyotaro Horiguchi. Only the patch for 9.3 was  
modified by me. Back-patch to 9.2 where the checkpointer process was  
added and the number of needed semaphores was increased.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Fujii Masao  
Backpatch: 9.2  
Discussion: http://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/runtime.sgml

Move DATA entry to correct position

commit   : 851636bfdaa9aa62d5adfaa0aa8c06b408e0d8a9    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 15 Feb 2016 16:37:03 -0800    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 15 Feb 2016 16:37:03 -0800    

Click here for diff

In commit 7b4bfc87 the DATA and DESCR entries for the new  
row_security_active() function were inadvertantly put after  
the PROVOLATILE defines, rather than before as they should  
have been placed. Move them up where they belong.  
  
Backpatch to 9.5 where the new entries were introduced.  

M src/include/catalog/pg_proc.h

Allow the WAL writer to flush WAL at a reduced rate.

commit   : 7975c5e0a992ae9a45e03d145e0d37e2b5a707f5    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 15 Feb 2016 23:52:38 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 15 Feb 2016 23:52:38 +0100    

Click here for diff

Commit 4de82f7d7 increased the WAL flush rate, mainly to increase the  
likelihood that hint bits can be set quickly. More quickly set hint bits  
can reduce contention around the clog et al.  But unfortunately the  
increased flush rate can have a significant negative performance impact,  
I have measured up to a factor of ~4.  The reason for this slowdown is  
that if there are independent writes to the underlying devices, for  
example because shared buffers is a lot smaller than the hot data set,  
or because a checkpoint is ongoing, the fdatasync() calls force cache  
flushes to be emitted to the storage.  
  
This is achieved by flushing WAL only if the last flush was longer than  
wal_writer_delay ago, or if more than wal_writer_flush_after (new GUC)  
unflushed blocks are pending. Based on some tests the default for  
wal_writer_delay is 1MB, which seems to work well both on SSD and  
rotational media.  
  
To avoid negative performance impact due to 4de82f7d7 an earlier  
commit (db76b1e) made SetHintBits() more likely to succeed; preventing  
performance regressions in the pgbench tests I performed.  
  
Discussion: [email protected]  

M doc/src/sgml/config.sgml
M src/backend/access/transam/README
M src/backend/access/transam/xlog.c
M src/backend/postmaster/walwriter.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/postmaster/walwriter.h

pgbench: avoid FD_ISSET on an invalid file descriptor

commit   : 5df44d14ba9fd3f6149c3fa0919745c9e24bcffe    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 15 Feb 2016 20:33:43 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 15 Feb 2016 20:33:43 -0300    

Click here for diff

The original code wasn't careful to test the file descriptor returned by  
PQsocket() for an invalid socket.  If an invalid socket did turn up,  
that would amount to calling FD_ISSET with fd = -1, whereby undefined  
behavior can be invoked.  
  
To fix, test file descriptor for validity and stop further processing if  
that fails.  
  
Problem noticed by Coverity.  
  
There is an existing FD_ISSET callsite that does check for invalid  
sockets beforehand, but the error message reported by it was  
strerror(errno); in testing the aforementioned change, that turns out to  
result in "bad socket: Success" which isn't terribly helpful.  Instead  
use PQerrorMessage() in both places which is more likely to contain an  
useful error message.  
  
Backpatch-through: 9.1.  

M src/bin/pgbench/pgbench.c

Suppress compiler warnings about useless comparison of unsigned to zero.

commit   : 8c95ae81fab11b75a611b57d6aaa0ef77e8b8e41    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Feb 2016 17:11:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Feb 2016 17:11:51 -0500    

Click here for diff

Reportedly, some compilers warn about tests like "c < 0" if c is unsigned,  
and hence complain about the character range checks I added in commit  
3bb3f42f3749d40b8d4de65871e8d828b18d4a45.  This is a bit of a pain since  
the regex library doesn't really want to assume that chr is unsigned.  
However, since any such reconfiguration would involve manual edits of  
regcustom.h anyway, we can put it on the shoulders of whoever wants to  
do that to adjust this new range-checking macro correctly.  
  
Per gripes from Coverity and Andres.  

M src/backend/regex/regc_lex.c
M src/include/regex/regcustom.h

Allow SetHintBits() to succeed if the buffer's LSN is new enough.

commit   : db76b1efbbab2441428a9ef21f7ac9ba43c52482    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 15 Feb 2016 22:15:35 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 15 Feb 2016 22:15:35 +0100    

Click here for diff

Previously we only allowed SetHintBits() to succeed if the commit LSN of  
the last transaction touching the page has already been flushed to  
disk. We can't generally change the LSN of the page, because we don't  
necessarily have the required locks on the page. But the required LSN  
interlock does not mean the commit record has to be flushed immediately,  
it just requires that the commit record will be flushed before the page is  
written out. Therefore if the buffer LSN is newer than the commit LSN,  
the hint bit can be safely set.  
  
In a number of scenarios (e.g. pgbench) this noticeably increases the  
number of hint bits are set. But more importantly it also keeps the  
success rate up when flushing WAL less frequently. That was the original  
reason for commit 4de82f7d7, which has negative performance consequences  
in a number of scenarios. This will allow a followup commit to reduce  
the flush rate.  
  
Discussion: [email protected]  

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

commit   : cfafd8beadcd6f8c8a570ab2504a75c33c58e504    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 15 Feb 2016 13:19:35 -0800    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 15 Feb 2016 13:19:35 -0800    

Click here for diff

Looks like this patch went in after Copyright messages  
were updated for 2016 and it missed the boat. Fixed.  

M src/include/storage/standbydefs.h

Make concurrent refresh check early that there is a unique index on matview.

commit   : 31b6606c48edf7c008ffe91907c080404a8c8046    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 16 Feb 2016 02:15:44 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 16 Feb 2016 02:15:44 +0900    

Click here for diff

In REFRESH MATERIALIZED VIEW command, CONCURRENTLY option is only  
allowed if there is at least one unique index with no WHERE clause on  
one or more columns of the matview. Previously, concurrent refresh  
checked the existence of a unique index on the matview after filling  
the data to new snapshot, i.e., after calling refresh_matview_datafill().  
So, when there was no unique index, we could need to wait a long time  
before we detected that and got the error. It was a waste of time.  
  
To eliminate such wasting time, this commit changes concurrent refresh  
so that it checks the existence of a unique index at the beginning of  
the refresh operation, i.e., before starting any time-consuming jobs.  
If CONCURRENTLY option is not allowed due to lack of a unique index,  
concurrent refresh can immediately detect it and emit an error.  
  
Author: Masahiko Sawada  
Reviewed-by: Michael Paquier, Fujii Masao  

M src/backend/commands/matview.c

Fix typo

commit   : 57c932475504d63d8f8a68fc6925d7decabc378a    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 15 Feb 2016 11:41:34 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 15 Feb 2016 11:41:34 +0100    

Click here for diff

M doc/src/sgml/protocol.sgml

commit   : 9449c4b1ec7114ae6927a563b43d1fbd4d5bbae4    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 15 Feb 2016 02:35:52 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 15 Feb 2016 02:35:52 -0500    

Click here for diff

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

Make GetLockStatusData's header comment resemble reality.

commit   : 9b92e76f7b6dcdc2de6fae53a1c069297ba454fc    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Feb 2016 15:42:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Feb 2016 15:42:31 -0500    

Click here for diff

The API spec for this function was changed completely (and for the better)  
by commit 3cba8999b343648c4c528432ab3d51400194e93b, but it didn't bother  
with anything as mundane as updating the comments.  

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

pg_upgrade: Add C comment about NextXID delimiter

commit   : 13a6fa3634a70f58e043c78984cd2fb626abcc16    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Feb 2016 17:53:36 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Feb 2016 17:53:36 -0500    

Click here for diff

We don't test the catversion for the NextXID delimiter change, we just  
test the string contents;  explain why.  
  
Reported-by: Michael Paquier  

M src/bin/pg_upgrade/controldata.c

Change delimiter used for display of NextXID

commit   : 59a884e9854cb3cb7338394fb5f856209b040fb3    
  
author   : Joe Conway <[email protected]>    
date     : Fri, 12 Feb 2016 14:23:59 -0800    
  
committer: Joe Conway <[email protected]>    
date     : Fri, 12 Feb 2016 14:23:59 -0800    

Click here for diff

NextXID has been rendered in the form of a pg_lsn even though it  
really is not. This can cause confusion, so change the format from  
%u/%u to %u:%u, per discussion on hackers.  
  
Complaint by me, patch by me and Bruce, reviewed by Michael Paquier  
and Alvaro. Applied to HEAD only.  
  
Author: Joe Conway, Bruce Momjian  
Reviewed-by: Michael Paquier, Alvaro Herrera  
Backpatch-through: master  

M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/xlog.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/bin/pg_upgrade/controldata.c

Increase deadlock_timeout some more in the deadlock-hard isolation test.

commit   : e84e06d2b3fc48c514fd44f7ac390eb5f3e20d72    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Feb 2016 17:22:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Feb 2016 17:22:42 -0500    

Click here for diff

The previous value of 5s is inadequate for the buildfarm's  
CLOBBER_CACHE_ALWAYS animals: they take long enough to do the is-it-waiting  
queries that the timeout expires, allowing the database state to change,  
before isolationtester is done looking.  Perhaps 10s will be enough.  
(If it isn't, I'm inclined to reduce the number of sessions involved.)  

M src/test/isolation/specs/deadlock-hard.spec

Revert "isolationtester: don't repeat the is-it-waiting query when retrying a step."

commit   : dca369320f6023b55feb49f281d394181fc57903    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Feb 2016 17:12:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Feb 2016 17:12:23 -0500    

Click here for diff

This mostly reverts commit 9c9782f066e0ce5424b8706df2cce147cb78170f.  
I left in the parts that rearranged removal of completed waiting steps;  
but the idea of not rechecking a step's blocked-ness isn't working.  

M src/test/isolation/isolationtester.c

Revert "Still further tweaking of deadlock isolation tests."

commit   : 3992188c2a8702bcb92140a840b5378b27468921    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Feb 2016 17:02:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Feb 2016 17:02:59 -0500    

Click here for diff

This reverts commit d03130d378b5fb071d231a7822784ad87268583a.  
That was dependent on an isolationtester.c change that now proves  
to be broken; we will need to find another solution.  

M src/test/isolation/expected/deadlock-hard.out
M src/test/isolation/specs/deadlock-hard.spec

pgbench: cleanup use of a "logfile" parameter

commit   : 34f13cc48432fb0a70bd76116347a758b7a0bc63    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 Feb 2016 17:30:46 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 Feb 2016 17:30:46 -0300    

Click here for diff

There is no reason to have the per-thread logfile file pointer as a  
separate parameter in various functions: it's much simpler to put it in  
the per-thread state struct instead, which is already being passed to  
all functions that need the log file anyway.  Change the callsites in  
which it was used as a boolean to test whether logging is active, so  
that they use the use_log global variable instead.  
  
No backpatch, even though this exists since commit a887c486d5df of March  
2010, because this is just for cleanliness' sake and the surrounding  
code has been modified a lot recently anyway.  

M src/bin/pgbench/pgbench.c

pgbench: fix segfault with empty sql file

commit   : db94419ffd6833da27176f6cca843483b4515065    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 Feb 2016 17:14:45 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 Feb 2016 17:14:45 -0300    

Click here for diff

Commit 1d0c3b3f8a introduced a bug that causes pgbench to crash if an  
empty script file is specified.  Fix it by rejecting such files at  
startup, which is the historical and intended behavior.  
  
Reported-By: Jeff Janes  
Discussion: https://www.postgresql.org/message-id/CAMkU=1zxKUbLPOt9hQWFp14pTc=V0cGo2GQBbn2GsK2Pu+8ZfA@mail.gmail.com  

M src/bin/pgbench/pgbench.c

Still further tweaking of deadlock isolation tests.

commit   : d03130d378b5fb071d231a7822784ad87268583a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Feb 2016 14:19:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Feb 2016 14:19:57 -0500    

Click here for diff

It turns out that there is a second race condition in the new deadlock-hard  
test: once the deadlock detector fires, it's uncertain whether step s7a8 or  
step s8a1 will report first, because killing s8's transaction unblocks s7.  
So far, s7 has only been seen to report first in CLOBBER_CACHE_ALWAYS  
builds, but it's pretty reproducible there, and in theory it should  
sometimes occur in normal builds too.  If s7 were a bit slower than usual,  
that could also break the test, since the existing expected-file assumes  
that we'll see s7a8 report the first time we check it after s8a1 completes.  
To fix, add a post-lock delay to s7a8.  

M src/test/isolation/expected/deadlock-hard.out
M src/test/isolation/specs/deadlock-hard.spec

isolationtester: don't repeat the is-it-waiting query when retrying a step.

commit   : 9c9782f066e0ce5424b8706df2cce147cb78170f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Feb 2016 14:10:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Feb 2016 14:10:36 -0500    

Click here for diff

If we're retrying a step, then we already decided it was blocked on a lock,  
and there's no need to recheck that.  The original coding of commit  
38f8bdcac4982215beb9f65a19debecaf22fd470 resulted in a large number of  
is-it-waiting queries when dealing with multiple concurrently-blocked  
sessions, which is fairly pointless and also results in test failures in  
CLOBBER_CACHE_ALWAYS builds, where the is-it-waiting query is quite slow.  
  
This definition also permits appending pg_sleep() calls to steps where it's  
needed to control the order of finish of concurrent steps.  Before, that  
did not work nicely because we'd decide that a step performing a sleep was  
not blocked and hang up waiting for it to finish, rather than noticing the  
completion of the concurrent step we're supposed to notice first.  
  
In passing, revise handling of removal of completed waiting steps  
to make it a bit less messy.  

M src/test/isolation/isolationtester.c

Re-pgindent isolationtester.c.

commit   : a361490806435fda6340fa13c0a881767c57c87a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Feb 2016 13:36:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Feb 2016 13:36:13 -0500    

Click here for diff

Need to do some more hacking on this, and got annoyed that it's not  
indent clean.  

M src/test/isolation/isolationtester.c

Fix whitespace

commit   : 29b4b7bda64d751e1c66d8b7cab222b53781aafb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 12 Feb 2016 12:08:40 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 12 Feb 2016 12:08:40 -0500    

Click here for diff

M src/test/isolation/isolationtester.c

Add missing "static" qualifier.

commit   : 99a9d6d563f389ad8137984aac13c9c0bd37cb66    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Feb 2016 11:20:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Feb 2016 11:20:16 -0500    

Click here for diff

Per buildfarm member pademelon.  

M contrib/postgres_fdw/deparse.c

Introduce extensible node types.

commit   : bcac23de73b89b001fbc628d84471a392e928d1c    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 12 Feb 2016 09:31:16 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 12 Feb 2016 09:31:16 -0500    

Click here for diff

An extensible node is always tagged T_Extensible, but the extnodename  
field identifies it more specifically; it may also include arbitrary  
private data.  Extensible nodes can be copied, tested for equality,  
serialized, and deserialized, but the core system doesn't know  
anything about them otherwise.  Some extensions may find it useful to  
include these nodes in fdw_private or custom_private lists in lieu of  
arm-wrestling their data into a format that the core code can  
understand.  
  
Along the way, so as not to burden the authors of such extensible  
node types too much, expose the functions for writing serialized  
tokens, and for serializing and deserializing bitmapsets.  
  
KaiGai Kohei, per a design suggested by me.  Reviewed by Andres Freund  
and by me, and further edited by me.  

M src/backend/nodes/Makefile
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
A src/backend/nodes/extensible.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
A src/include/nodes/extensible.h
M src/include/nodes/nodes.h

Make builtin lwlock tranche names consistent.

commit   : 63461a63f94a333eae272be3d44ae1602cda75cb    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 12 Feb 2016 08:07:11 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 12 Feb 2016 08:07:11 -0500    

Click here for diff

Previously, we had a mix of styles.  
  
Amit Kapila  

M src/backend/access/transam/xlog.c
M src/backend/replication/logical/origin.c
M src/backend/replication/slot.c
M src/backend/storage/buffer/buf_init.c

Further tweaking of deadlock isolation tests.

commit   : caefc11ef6613683ddf8ded2081da3db238f463e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 23:21:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 23:21:33 -0500    

Click here for diff

The new deadlock-soft-2 test has a timing dependency too: it supposes  
that isolationtester will detect step s1b as waiting before the deadlock  
detector runs and grants it the lock.  Adjust deadlock_timeout to ensure  
that that's true even in CLOBBER_CACHE_ALWAYS builds, where the wait  
detection query is quite slow.  Per buildfarm member jaguarundi.  

M src/test/isolation/specs/deadlock-soft-2.spec

Refactor check_functional_grouping() to use get_primary_key_attnos().

commit   : f144f73242acef574bc27a4c70e809a64806e4a4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 17:52:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 17:52:03 -0500    

Click here for diff

If we ever get around to allowing functional dependency to be proven  
from other things besides simple primary keys, this code will need to  
be rethought, but that was true anyway.  In the meantime, we might as  
well not have two very-similar routines for scanning pg_constraint.  
  
David Rowley, reviewed by Julien Rouhaud  

M src/backend/catalog/pg_constraint.c

Remove GROUP BY columns that are functionally dependent on other columns.

commit   : d4c3a156cb46dcd1f9f97a8011bd94c544079bb5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 17:34:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 17:34:59 -0500    

Click here for diff

If a GROUP BY clause includes all columns of a non-deferred primary key,  
as well as other columns of the same relation, those other columns are  
redundant and can be dropped from the grouping; the pkey is enough to  
ensure that each row of the table corresponds to a separate group.  
Getting rid of the excess columns will reduce the cost of the sorting or  
hashing needed to implement GROUP BY, and can indeed remove the need for  
a sort step altogether.  
  
This seems worth testing for since many query authors are not aware of  
the GROUP-BY-primary-key exception to the rule about queries not being  
allowed to reference non-grouped-by columns in their targetlists or  
HAVING clauses.  Thus, redundant GROUP BY items are not uncommon.  Also,  
we can make the test pretty cheap in most queries where it won't help  
by not looking up a rel's primary key until we've found that at least  
two of its columns are in GROUP BY.  
  
David Rowley, reviewed by Julien Rouhaud  

M src/backend/catalog/pg_constraint.c
M src/backend/optimizer/plan/planner.c
M src/include/catalog/pg_constraint_fn.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/join.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/join.sql

Move pg_constraint.h function declarations to new file pg_constraint_fn.h.

commit   : 72eee410d48dfb4e6f3a0b751c4b0057ca8adc81    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 15:51:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 15:51:28 -0500    

Click here for diff

A pending patch requires exporting a function returning Bitmapset from  
catalog/pg_constraint.c.  As things stand, that would mean including  
nodes/bitmapset.h in pg_constraint.h, which might be hazardous for the  
client-side includability of that header.  It's not entirely clear whether  
any client-side code needs to include pg_constraint.h, but it seems prudent  
to assume that there is some such code somewhere.  Therefore, split off the  
function definitions into a new file pg_constraint_fn.h, similarly to what  
we've done for some other catalog header files.  

M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_utilcmd.c
M src/include/catalog/pg_constraint.h
A src/include/catalog/pg_constraint_fn.h

Fix typo in comment.

commit   : 2564be360a1d25a4c66e7cd34997ab027e0ec9a8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 15:20:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 15:20:14 -0500    

Click here for diff

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

Shift the responsibility for emitting "database system is shut down".

commit   : d18643c4a6d5ac41b012abc5d11fb5a7ccddf6c5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 14:14:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 14:14:07 -0500    

Click here for diff

Historically this message has been emitted at the end of ShutdownXLOG().  
That's not an insane place for it in a standalone backend, but in the  
postmaster environment we've grown a fair amount of stuff that happens  
later, including archiver/walsender shutdown, stats collector shutdown,  
etc.  Recent buildfarm experimentation showed that on slower machines  
there could be many seconds' delay between finishing ShutdownXLOG() and  
actual postmaster exit.  That's fairly confusing, both for testing  
purposes and for DBAs.  Hence, move the code that prints this message  
into UnlinkLockFiles(), so that it comes out just after we remove the  
postmaster's pidfile.  That is a more appropriate definition of "is shut  
down" from the point of view of "pg_ctl stop", for example.  In general,  
removing the pidfile should be the last externally-visible action of  
either a postmaster or a standalone backend; compare commit  
d73d14c271653dff10c349738df79ea03b85236c for instance.  So this seems  
like a reasonably future-proof approach.  

M src/backend/access/transam/xlog.c
M src/backend/utils/init/miscinit.c

Use separate lwlock tranches for buffer, lock, and predicate lock managers.

commit   : c319991bcad02a2e99ddac3f42762b0f6fa8d52a    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Feb 2016 14:07:33 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Feb 2016 14:07:33 -0500    

Click here for diff

This finishes the work - spread across many commits over the last  
several months - of putting each type of lock other than the named  
individual locks into a separate tranche.  
  
Amit Kapila  

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

Make new deadlock isolation test more reproducible.

commit   : b11d07b6a3fc64904731e3b9a467a2567bc7dcdb    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 11:59:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 11:59:11 -0500    

Click here for diff

The original formulation of 4c9864b9b4d87d02f07f40bb27976da737afdcab  
was extremely timing-sensitive, because it arranged for the deadlock  
detector to be running (and possibly unblocking the current query)  
at almost exactly the same time as isolationtester would be probing  
to see if the query is blocked.  The committed expected-file assumed  
that the deadlock detection would finish first, but we see the opposite  
on both fast and slow buildfarm animals.  Adjust the deadlock timeout  
settings to make it predictable that isolationtester *will* see the  
query as waiting before deadlock detection unblocks it.  
  
I used a 5s timeout for the same reasons mentioned in  
a7921f71a3c747141344d8604f6a6d7b4cddb2a9.  

M src/test/isolation/expected/deadlock-hard.out
M src/test/isolation/specs/deadlock-hard.spec

Code review for isolationtester changes.

commit   : d9dc2b4149c017c0a1d2045b858e8e0cc1a92464    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 11:30:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Feb 2016 11:30:46 -0500    

Click here for diff

Fix a few oversights in 38f8bdcac4982215beb9f65a19debecaf22fd470:  
don't leak memory in run_permutation(), remember when we've issued  
a cancel rather than issuing another one every 10ms,  
fix some typos in comments.  

M src/test/isolation/isolationtester.c

Improve error reporting in format()

commit   : 07d25a964b2fb78169a4a34c6f6893736f69903a    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 11 Feb 2016 18:11:11 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 11 Feb 2016 18:11:11 +0300    

Click here for diff

Clarify invalid format conversion type error message and add hint.  
  
Author: Jim Nasby  

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

commit   : a455878d99561d4b199915ed7a7fb02f5e621710    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Feb 2016 08:55:24 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Feb 2016 08:55:24 -0500    

Click here for diff

Commit 0e141c0fbb211bdd23783afa731e3eef95c9ad7a introduced a new  
facility to reduce ProcArrayLock contention by clearing several XIDs  
from the ProcArray under a single lock acquisition.  The names  
initially chosen were deemed not to be very good choices, so commit  
4aec49899e5782247e134f94ce1c6ee926f88e1c renamed them.  But now it  
seems like we still didn't get it right.  A pending patch wants to  
add similar infrastructure for batching CLOG updates, so the names  
need to be clear enough to allow a new set of structure members with  
a related purpose.  
  
Amit Kapila  

M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/proc.h

Add some isolation tests for deadlock detection and resolution.

commit   : 4c9864b9b4d87d02f07f40bb27976da737afdcab    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Feb 2016 08:38:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Feb 2016 08:38:09 -0500    

Click here for diff

Previously, we had no test coverage for the deadlock detector.  

A src/test/isolation/expected/deadlock-hard.out
A src/test/isolation/expected/deadlock-simple.out
A src/test/isolation/expected/deadlock-soft-2.out
A src/test/isolation/expected/deadlock-soft.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/deadlock-hard.spec
A src/test/isolation/specs/deadlock-simple.spec
A src/test/isolation/specs/deadlock-soft-2.spec
A src/test/isolation/specs/deadlock-soft.spec

Modify the isolation tester so that multiple sessions can wait.

commit   : 38f8bdcac4982215beb9f65a19debecaf22fd470    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Feb 2016 08:36:30 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Feb 2016 08:36:30 -0500    

Click here for diff

This allows testing of deadlock scenarios.  Scenarios that would  
previously have been considered invalid are now simply taken as a  
scenario in which more than one backend will wait.  

M src/test/isolation/README
M src/test/isolation/isolationtester.c

Specify permutations for isolation tests with "invalid" permutations.

commit   : c9882c60f44cf5d0b37411535175a5c154fdad0e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Feb 2016 08:23:46 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Feb 2016 08:23:46 -0500    

Click here for diff

This is a necessary prerequisite for forthcoming changes to allow deadlock  
scenarios to be tested by the isolation tester.  It is also a good idea on  
general principle, since these scenarios add no useful test coverage not  
provided by other scenarios, but do to take time to execute.  

M src/test/isolation/expected/aborted-keyrevoke.out
M src/test/isolation/expected/aborted-keyrevoke_2.out
M src/test/isolation/expected/alter-table-1.out
M src/test/isolation/expected/alter-table-2.out
M src/test/isolation/expected/alter-table-3.out
M src/test/isolation/expected/create-trigger.out
M src/test/isolation/expected/delete-abort-savept.out
M src/test/isolation/expected/fk-deadlock.out
M src/test/isolation/expected/fk-deadlock2.out
M src/test/isolation/expected/fk-deadlock2_1.out
M src/test/isolation/expected/fk-deadlock2_2.out
M src/test/isolation/expected/fk-deadlock_1.out
M src/test/isolation/specs/aborted-keyrevoke.spec
M src/test/isolation/specs/alter-table-1.spec
M src/test/isolation/specs/alter-table-2.spec
M src/test/isolation/specs/alter-table-3.spec
M src/test/isolation/specs/create-trigger.spec
M src/test/isolation/specs/delete-abort-savept.spec
M src/test/isolation/specs/fk-deadlock.spec
M src/test/isolation/specs/fk-deadlock2.spec

In pg_rewind test suite, triple promote timeout to 90s.

commit   : 64d89a93c0a8b2ead0503684f54784bd071adad9    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 10 Feb 2016 20:34:57 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 10 Feb 2016 20:34:57 -0500    

Click here for diff

Thirty seconds was not consistently enough for promotion to complete on  
buildfarm members sungazer and tern.  Experiments suggest 43s would have  
been enough.  Back-patch to 9.5, where pg_rewind was introduced.  

M src/test/perl/PostgresNode.pm

Accept pg_ctl timeout from the PGCTLTIMEOUT environment variable.

commit   : 2ffa86962077c588d8bdf6244e2ef960338d3883    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 10 Feb 2016 20:34:02 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 10 Feb 2016 20:34:02 -0500    

Click here for diff

Many automated test suites call pg_ctl.  Buildfarm members axolotl,  
hornet, mandrill, shearwater, sungazer and tern have failed when server  
shutdown took longer than the pg_ctl default 60s timeout.  This addition  
permits slow hosts to easily raise the timeout without us editing a  
--timeout argument into every test suite pg_ctl call.  Back-patch to 9.1  
(all supported versions) for the sake of automated testing.  
  
Reviewed by Tom Lane.  

M doc/src/sgml/ref/pg_ctl-ref.sgml
M src/bin/pg_ctl/pg_ctl.c

Avoid use of sscanf() to parse ispell dictionary files.

commit   : 51e78ab4ff3282963f5e8ba2633040829413aefa    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Feb 2016 19:30:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Feb 2016 19:30:11 -0500    

Click here for diff

It turns out that on FreeBSD-derived platforms (including OS X), the  
*scanf() family of functions is pretty much brain-dead about multibyte  
characters.  In particular it will apply isspace() to individual bytes  
of input even when those bytes are part of a multibyte character, thus  
allowing false recognition of a field-terminating space.  
  
We appear to have little alternative other than instituting a coding  
rule that *scanf() is not to be used if the input string might contain  
multibyte characters.  (There was some discussion of relying on "%ls",  
but that probably just moves the portability problem somewhere else,  
and besides it doesn't fully prevent BSD *scanf() from using isspace().)  
  
This patch is a down payment on that: it gets rid of use of sscanf()  
to parse ispell dictionary files, which are certainly at great risk  
of having a problem.  The code is cleaner this way anyway, though  
a bit longer.  
  
In passing, improve a few comments.  
  
Report and patch by Artur Zakirov, reviewed and somewhat tweaked by me.  
Back-patch to all supported branches.  

M src/backend/tsearch/spell.c

Revert "Temporarily make pg_ctl and server shutdown a whole lot chattier."

commit   : c5e9b771275b93b09eec6b760677fe6c5e726ab2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Feb 2016 16:01:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Feb 2016 16:01:04 -0500    

Click here for diff

This reverts commit 3971f64843b02e4a55d854156bd53e46a0588e45 and a  
couple of followon debugging commits; I think we've learned what we can  
from them.  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/ipc.c
M src/backend/storage/smgr/md.c
M src/backend/utils/init/miscinit.c
M src/bin/pg_ctl/pg_ctl.c
M src/include/miscadmin.h

Code cleanup in the wake of recent LWLock refactoring.

commit   : 79a7ff0fe56ac9d782b0734ebb0e7a5299015e58    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 10 Feb 2016 09:58:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 10 Feb 2016 09:58:09 -0500    

Click here for diff

As of commit c1772ad9225641c921545b35c84ee478c326b95e, there's no  
longer any way of requesting additional LWLocks in the main tranche,  
so we don't need NumLWLocks() or LWLockAssign() any more.  Also,  
some of the allocation counters that we had previously aren't needed  
any more either.  
  
Amit Kapila  

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

postgres_fdw: Remove unnecessary variable.

commit   : 019e78813760e664a85f505b5953d362a2b468cc    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 10 Feb 2016 08:17:43 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 10 Feb 2016 08:17:43 -0500    

Click here for diff

It causes warnings in non-Assert-enabled builds.  
  
Per report from Jeff Janes.  

M contrib/postgres_fdw/postgres_fdw.c

Add still more chattiness in server shutdown.

commit   : 41d505a7ffaf8c1678b931e15f74469c84fbb91e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Feb 2016 19:36:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Feb 2016 19:36:21 -0500    

Click here for diff

Further investigation says that there may be some slow operations after  
we've finished ShutdownXLOG(), so add some more log messages to try to  
isolate that.  This is all temporary code too.  

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

postgres_fdw: Remove unstable regression test.

commit   : bb4df42e6a394ce77801b6952b6dc8b43d91fea7    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 Feb 2016 15:42:20 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 Feb 2016 15:42:20 -0500    

Click here for diff

Per Tom Lane and the buildfarm.  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql

postgres_fdw: Push down joins to remote servers.

commit   : e4106b2528727c4b48639c0e12bf2f70a766b910    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 Feb 2016 14:00:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 Feb 2016 14:00:50 -0500    

Click here for diff

If we've got a relatively straightforward join between two tables,  
this pushes that join down to the remote server instead of fetching  
the rows for each table and performing the join locally.  Some cases  
are not handled yet, such as SEMI and ANTI joins.  Also, we don't  
yet attempt to create presorted join paths or parameterized join  
paths even though these options do get tried for a base relation  
scan.  Nevertheless, this seems likely to be a very significant win  
in many practical cases.  
  
Shigeru Hanada and Ashutosh Bapat, reviewed by Robert Haas, with  
additional review at various points by Tom Lane, Etsuro Fujita,  
KaiGai Kohei, and Jeevan Chalke.  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Add more chattiness in server shutdown.

commit   : 7351e18286ec83461b386e23328d65fd4a538bba    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Feb 2016 11:21:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Feb 2016 11:21:46 -0500    

Click here for diff

Early returns from the buildfarm show that there's a bit of a gap in the  
logging I added in 3971f64843b02e4a: the portion of CreateCheckPoint()  
after CheckPointGuts() can take a fair amount of time.  Add a few more  
log messages in that section of code.  This too shall be reverted later.  

M src/backend/access/transam/xlog.c
M src/backend/storage/smgr/md.c

Temporarily make pg_ctl and server shutdown a whole lot chattier.

commit   : 3971f64843b02e4a55d854156bd53e46a0588e45    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Feb 2016 18:43:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Feb 2016 18:43:11 -0500    

Click here for diff

This is a quick hack, due to be reverted when its purpose has been served,  
to try to gather information about why some of the buildfarm critters  
regularly fail with "postmaster does not shut down" complaints.  Maybe they  
are just really overloaded, but maybe something else is going on.  Hence,  
instrument pg_ctl to print the current time when it starts waiting for  
postmaster shutdown and when it gives up, and add a lot of logging of the  
current time in the server's checkpoint and shutdown code paths.  
  
No attempt has been made to make this pretty.  I'm not even totally sure  
if it will build on Windows, but we'll soon find out.  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/init/miscinit.c
M src/bin/pg_ctl/pg_ctl.c
M src/include/miscadmin.h

Re-pgindent varlena.c.

commit   : 0231f838565d2921a0960407c4240237ba1d56ae    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Feb 2016 15:17:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Feb 2016 15:17:40 -0500    

Click here for diff

Just to make sure previous commit worked ...  

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

Rename typedef "string" to "VarString".

commit   : 58e797216ff52c0656d3c343d0732a2530cafb71    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Feb 2016 15:15:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Feb 2016 15:15:56 -0500    

Click here for diff

Since pgindent treats typedef names as global, the original coding of  
b47b4dbf683f13e6 would have had rather nasty effects on the formatting  
of other files in which "string" is used as a variable or field name.  
Use a less generic name for this typedef, and rename some other  
identifiers to match.  
  
Peter Geoghegan, per gripe from me  

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

Use %u not %d to print OIDs.

commit   : 63828969c822449744e63b76bff993ccd1d3245e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Feb 2016 11:06:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Feb 2016 11:06:23 -0500    

Click here for diff

Oversight in commit 96198d94c.  
  
Etsuro Fujita  

M contrib/postgres_fdw/connection.c

Last-minute updates for release notes.

commit   : 02292845ac6d6ec09d79abf1dbb0538e14582743    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Feb 2016 10:49:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Feb 2016 10:49:37 -0500    

Click here for diff

Security: CVE-2016-0773  

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 some regex issues with out-of-range characters and large char ranges.

commit   : 3bb3f42f3749d40b8d4de65871e8d828b18d4a45    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Feb 2016 10:25:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Feb 2016 10:25:40 -0500    

Click here for diff

Previously, our regex code defined CHR_MAX as 0xfffffffe, which is a  
bad choice because it is outside the range of type "celt" (int32).  
Characters approaching that limit could lead to infinite loops in logic  
such as "for (c = a; c <= b; c++)" where c is of type celt but the  
range bounds are chr.  Such loops will work safely only if CHR_MAX+1  
is representable in celt, since c must advance to beyond b before the  
loop will exit.  
  
Fortunately, there seems no reason not to restrict CHR_MAX to 0x7ffffffe.  
It's highly unlikely that Unicode will ever assign codes that high, and  
none of our other backend encodings need characters beyond that either.  
  
In addition to modifying the macro, we have to explicitly enforce character  
range restrictions on the values of \u, \U, and \x escape sequences, else  
the limit is trivially bypassed.  
  
Also, the code for expanding case-independent character ranges in bracket  
expressions had a potential integer overflow in its calculation of the  
number of characters it could generate, which could lead to allocating too  
small a character vector and then overwriting memory.  An attacker with the  
ability to supply arbitrary regex patterns could easily cause transient DOS  
via server crashes, and the possibility for privilege escalation has not  
been ruled out.  
  
Quite aside from the integer-overflow problem, the range expansion code was  
unnecessarily inefficient in that it always produced a result consisting of  
individual characters, abandoning the knowledge that we had a range to  
start with.  If the input range is large, this requires excessive memory.  
Change it so that the original range is reported as-is, and then we add on  
any case-equivalent characters that are outside that range.  With this  
approach, we can bound the number of individual characters allowed without  
sacrificing much.  This patch allows at most 100000 individual characters,  
which I believe to be more than the number of case pairs existing in  
Unicode, so that the restriction will never be hit in practice.  
  
It's still possible for range() to take awhile given a large character code  
range, so also add statement-cancel detection to its loop.  The downstream  
function dovec() also lacked cancel detection, and could take a long time  
given a large output from range().  
  
Per fuzz testing by Greg Stark.  Back-patch to all supported branches.  
  
Security: CVE-2016-0773  

M src/backend/regex/regc_lex.c
M src/backend/regex/regc_locale.c
M src/backend/regex/regcomp.c
M src/include/regex/regcustom.h
M src/test/regress/expected/regex.out
M src/test/regress/sql/regex.sql

Make GIN regression test stable.

commit   : f8a1c1d5a30003c9c24b00870d5a0f02f1c81e65    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 8 Feb 2016 23:41:46 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 8 Feb 2016 23:41:46 +0900    

Click here for diff

Commit 7f46eaf added the regression test which checks that  
gin_clean_pending_list() cleans up the GIN pending list and returns >0.  
This usually works fine. But if autovacuum comes along and cleans  
the list before gin_clean_pending_list() starts, the function may  
return 0, and then the regression test may fail.  
  
To fix the problem, this commit disables autovacuum on the target  
index of gin_clean_pending_list() by setting autovacuum_enabled  
reloption to off when creating the table.  
  
Also this commit sets gin_pending_list_limit reloption to 4MB on  
the target index. Otherwise when running "make installcheck" with  
small gin_pending_list_limit GUC, insertions of data may trigger  
the cleanup of pending list before gin_clean_pending_list() starts  
and the function may return 0. This could cause the regression test  
to fail.  
  
Per buildfarm member spoonbill.  
  
Reported-By: Tom Lane  

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

Fix overeager pushdown of HAVING clauses when grouping sets are used.

commit   : a6897efab92bc7e645b6c6d15274b8d61c53fe8f    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 8 Feb 2016 11:03:31 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 8 Feb 2016 11:03:31 +0100    

Click here for diff

In 61444bfb we started to allow HAVING clauses to be fully pushed down  
into WHERE, even when grouping sets are in use. That turns out not to  
work correctly, because grouping sets can "produce" NULLs, meaning that  
filtering in WHERE and HAVING can have different results, even when no  
aggregates or volatile functions are involved.  
  
Instead only allow pushdown of empty grouping sets.  
  
It'd be nice to do better, but the exact mechanics of deciding which  
cases are safe are still being debated. It's important to give correct  
results till we find a good solution, and such a solution might not be  
appropriate for backpatching anyway.  
  
Bug: #13863  
Reported-By: 'wrb'  
Diagnosed-By: Dean Rasheed  
Author: Andrew Gierth  
Reviewed-By: Dean Rasheed and Andres Freund  
Discussion: [email protected]  
Backpatch: 9.5, where grouping sets were introduced  

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

Improve documentation about PRIMARY KEY constraints.

commit   : c477e84fe2471cb675234fce75cd6bb4bc2cf481    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Feb 2016 16:02:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Feb 2016 16:02:44 -0500    

Click here for diff

Get rid of the false implication that PRIMARY KEY is exactly equivalent to  
UNIQUE + NOT NULL.  That was more-or-less true at one time in our  
implementation, but the standard doesn't say that, and we've grown various  
features (many of them required by spec) that treat a pkey differently from  
less-formal constraints.  Per recent discussion on pgsql-general.  
  
I failed to resist the temptation to do some other wordsmithing in the  
same area.  

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

Fix deparsing of ON CONFLICT arbiter WHERE clauses.

commit   : cc2ca9319a5dbe89ea47d87944650e65e3bb4ce8    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Feb 2016 14:57:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Feb 2016 14:57:24 -0500    

Click here for diff

The parser doesn't allow qualification of column names appearing in  
these clauses, but ruleutils.c would sometimes qualify them, leading  
to dump/reload failures.  Per bug #13891 from Onder Kalaci.  
  
(In passing, make stanzas in ruleutils.c that save/restore varprefix  
more consistent.)  
  
Peter Geoghegan  

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

Release notes for 9.5.1, 9.4.6, 9.3.11, 9.2.15, 9.1.20.

commit   : 1d76c9725087121bfa008f875450570a5c46241f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Feb 2016 14:16:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Feb 2016 14:16:31 -0500    

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

ExecHashRemoveNextSkewBucket must physically copy tuples to main hashtable.

commit   : f867ce5518202a4e625dc41b7036fec47ee0e09e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Feb 2016 12:29:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Feb 2016 12:29:17 -0500    

Click here for diff

Commit 45f6240a8fa9d355 added an assumption in ExecHashIncreaseNumBatches  
and ExecHashIncreaseNumBuckets that they could find all tuples in the main  
hash table by iterating over the "dense storage" introduced by that patch.  
However, ExecHashRemoveNextSkewBucket continued its old practice of simply  
re-linking deleted skew tuples into the main table's hashchains.  Hence,  
such tuples got lost during any subsequent increase in nbatch or nbuckets,  
and would never get joined, as reported in bug #13908 from Seth P.  
  
I (tgl) think that the aforesaid commit has got multiple design issues  
and should be reworked rather completely; but there is no time for that  
right now, so band-aid the problem by making ExecHashRemoveNextSkewBucket  
physically copy deleted skew tuples into the "dense storage" arena.  
  
The added test case is able to exhibit the problem by means of fooling the  
planner with a WHERE condition that it will underestimate the selectivity  
of, causing the initial nbatch estimate to be too small.  
  
Tomas Vondra and Tom Lane.  Thanks to David Johnston for initial  
investigation into the bug report.  

M src/backend/executor/nodeHash.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Fix parallel-safety markings for pg_upgrade functions.

commit   : d89f06f0482458d4b76e3be67ea428fec2a0aeb6    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 7 Feb 2016 11:45:21 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 7 Feb 2016 11:45:21 -0500    

Click here for diff

These establish backend-local state which will not be copied to  
parallel workers, so they must be marked parallel-restricted, not  
parallel-safe.  

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

Introduce a new GUC force_parallel_mode for testing purposes.

commit   : 7c944bd903392829608a9fba5b0e68c4fe89abf8    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 7 Feb 2016 11:39:22 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 7 Feb 2016 11:39:22 -0500    

Click here for diff

When force_parallel_mode = true, we enable the parallel mode restrictions  
for all queries for which this is believed to be safe.  For the subset of  
those queries believed to be safe to run entirely within a worker, we spin  
up a worker and run the query there instead of running it in the  
original process.  When force_parallel_mode = regress, make additional  
changes to allow the regression tests to run cleanly even though parallel  
workers have been injected under the hood.  
  
Taken together, this facilitates both better user testing and better  
regression testing of the parallelism code.  
  
Robert Haas, with help from Amit Kapila and Rushabh Lathia.  

M doc/src/sgml/config.sgml
M src/backend/access/transam/parallel.c
M src/backend/commands/explain.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/planmain.h

Introduce group locking to prevent parallel processes from deadlocking.

commit   : a1c1af2a1f6099c039f145c1edb52257f315be51    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 7 Feb 2016 10:16:13 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 7 Feb 2016 10:16:13 -0500    

Click here for diff

For locking purposes, we now regard heavyweight locks as mutually  
non-conflicting between cooperating parallel processes.  There are some  
possible pitfalls to this approach that are not to be taken lightly,  
but it works OK for now and can be changed later if we find a better  
approach.  Without this, it's very easy for parallel queries to  
silently self-deadlock if the user backend holds strong relation locks.  
  
Robert Haas, with help from Amit Kapila.  Thanks to Noah Misch and  
Andres Freund for extensive discussion of possible issues with this  
approach.  

M src/backend/access/transam/parallel.c
M src/backend/storage/lmgr/README
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/lock.h
M src/include/storage/proc.h

Improve speed of timestamp/time/date output functions.

commit   : aa2387e2fd532954e88dfd8546ab894b9305123d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Feb 2016 23:11:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Feb 2016 23:11:28 -0500    

Click here for diff

It seems that sprintf(), at least in glibc's version, is unreasonably slow  
compared to hand-rolled code for printing integers.  Replacing most uses of  
sprintf() in the datetime.c output functions with special-purpose code  
turns out to give more than a 2X speedup in COPY of a table with a single  
timestamp column; which is pretty impressive considering all the other  
logic in that code path.  
  
David Rowley and Andres Freund, reviewed by Peter Geoghegan and myself  

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

Fix comment block trashed by pgindent.

commit   : b921aeb1676f128f2c41ddc40d3887964ea9eae9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Feb 2016 15:13:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Feb 2016 15:13:36 -0500    

Click here for diff

Looks like I put the protective dashes in the wrong place in f4e4b32743.  

M src/backend/executor/nodeHash.c

Improve HJDEBUG code a bit.

commit   : be11f8400d7d99e8ae6602f3175e04b4f0c99376    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Feb 2016 15:05:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Feb 2016 15:05:23 -0500    

Click here for diff

Commit 30d7ae3c76d2de144232ae6ab328ca86b70e72c3 introduced an HJDEBUG  
stanza that probably didn't compile at the time, and definitely doesn't  
compile now, because it refers to a nonexistent variable.  It doesn't seem  
terribly useful anyway, so just get rid of it.  
  
While I'm fooling with it, use %z modifier instead of the obsolete hack of  
casting size_t to unsigned long, and include the HashJoinTable's address in  
each printout so that it's possible to distinguish the activities of  
multiple hashjoins occurring in one query.  
  
Noted while trying to use HJDEBUG to investigate bug #13908.  Back-patch  
to 9.5, because code that doesn't compile is certainly not very helpful.  

M src/backend/executor/nodeHash.c

Add missing "static" qualifier.

commit   : 392998bc58a985ea978c94c23594eb214d04c744    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Feb 2016 12:21:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Feb 2016 12:21:14 -0500    

Click here for diff

Per buildfarm member pademelon.  

M contrib/postgres_fdw/deparse.c

Comment on dead code in AtAbort_Portals() and AtSubAbort_Portals().

commit   : 41baee7a9312eefb315b6b2973ac058c9efaa9cf    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 5 Feb 2016 20:23:40 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 5 Feb 2016 20:23:40 -0500    

Click here for diff

Reviewed by Tom Lane and Robert Haas.  

M src/backend/utils/mmgr/portalmem.c

Force certain "pljava" custom GUCs to be PGC_SUSET.

commit   : f4aa3a18a20d51575562520754aa376b3b08b2d0    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 5 Feb 2016 20:22:51 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 5 Feb 2016 20:22:51 -0500    

Click here for diff

Future PL/Java versions will close CVE-2016-0766 by making these GUCs  
PGC_SUSET.  This PostgreSQL change independently mitigates that PL/Java  
vulnerability, helping sites that update PostgreSQL more frequently than  
PL/Java.  Back-patch to 9.1 (all supported versions).  

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

First-draft release notes for 9.4.6.

commit   : 7008e70d105b572821406744ce080771b74c06ab    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Feb 2016 17:06:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Feb 2016 17:06:23 -0500    

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.4.sgml

Update time zone data files to tzdata release 2016a.

commit   : a73311e5256b57a59677083e71b5bf93e583cc05    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Feb 2016 10:59:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Feb 2016 10:59:09 -0500    

Click here for diff

DST law changes in Cayman Islands, Metlakatla, Trans-Baikal Territory  
(Zabaykalsky Krai).  Historical corrections for Pakistan.  

M src/timezone/data/asia
M src/timezone/data/backward
M src/timezone/data/backzone
M src/timezone/data/europe
M src/timezone/data/northamerica
M src/timezone/data/zone.tab
M src/timezone/data/zone1970.tab

Fix typo in comment.

commit   : e98fd7860773698eaaf6332decc364bb31bca677    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 5 Feb 2016 08:11:00 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 5 Feb 2016 08:11:00 -0500    

Click here for diff

Michael Paquier  

M src/backend/replication/slot.c

Remove parallel-safety check from GetExistingLocalJoinPath.

commit   : e0e7b8fa22539a81cc390f8ec57d6b52391b1335    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 5 Feb 2016 08:07:38 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 5 Feb 2016 08:07:38 -0500    

Click here for diff

Commit a104a017fc5f67ff5d9c374cd831ac3948a874c2 has this check because  
I added it to the submitted patch before commit, but that was entirely  
wrongheaded, as explained to me by Ashutosh Bapat, who also wrote this  
patch.  

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

Fix small goof in comment.

commit   : 63f39b9148319c2e399dd827941b4d579b79f18b    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 5 Feb 2016 08:04:48 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 5 Feb 2016 08:04:48 -0500    

Click here for diff

Peter Geoghegan  

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

Fix typo.

commit   : 78bea62ab0b16a0c7aaa1e460064c32f9f35041d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 5 Feb 2016 07:56:59 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 5 Feb 2016 07:56:59 -0500    

Click here for diff

Amit Kapila  

M src/include/storage/lwlock.h

Add num_nulls() and num_nonnulls() to count NULL arguments.

commit   : 6819514fca22f8554edcab6e4d0402b0221f03bb    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Feb 2016 23:03:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Feb 2016 23:03:10 -0500    

Click here for diff

An example use-case is "CHECK(num_nonnulls(a,b,c) = 1)" to assert that  
exactly one of a,b,c isn't NULL.  The functions are variadic, so they  
can also be pressed into service to count the number of null or nonnull  
elements in an array.  
  
Marko Tiikkaja, reviewed by Pavel Stehule  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/misc.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h
A src/test/regress/expected/misc_functions.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/misc_functions.sql

postgres_fdw: pgindent run.

commit   : d0cd7bda97a626049aa7d247374909c52399c413    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Feb 2016 22:30:08 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Feb 2016 22:30:08 -0500    

Click here for diff

In preparation for upcoming commits.  

M contrib/postgres_fdw/postgres_fdw.c

postgres_fdw: Avoid possible misbehavior when RETURNING tableoid column only.

commit   : 37c84570b1e32aef886c9b546e0dd4a128cb7492    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Feb 2016 22:15:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Feb 2016 22:15:50 -0500    

Click here for diff

deparseReturningList ended up adding up RETURNING NULL to the code, but  
code elsewhere saw an empty list of attributes and concluded that it  
should not expect tuples from the remote side.  
  
Etsuro Fujita and Robert Haas, reviewed by Thom Brown  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql

When modifying a foreign table, initialize tableoid field properly.

commit   : 9418d79a7664e75a2824adfc78b859b4d0f77962    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Feb 2016 21:15:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Feb 2016 21:15:57 -0500    

Click here for diff

Failure to do this can cause AFTER ROW triggers or RETURNING expressions  
that reference this field to misbehave.  
  
Etsuro Fujita, reviewed by Thom Brown  

M src/backend/executor/nodeModifyTable.c

Improve error message

commit   : f8003e07f9715873796f39b1a36e07135f09d003    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Feb 2016 20:41:32 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Feb 2016 20:41:32 -0500    

Click here for diff

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

Add some additional core functions to support join pushdown for FDWs.

commit   : a104a017fc5f67ff5d9c374cd831ac3948a874c2    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Feb 2016 17:05:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Feb 2016 17:05:09 -0500    

Click here for diff

GetExistingLocalJoinPath() is useful for handling EvalPlanQual rechecks  
properly, and GetUserMappingById() is needed to make sure you're using  
the right credentials.  
  
Shigeru Hanada, Etsuro Fujita, Ashutosh Bapat, Robert Haas  

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

Change the way that LWLocks for extensions are allocated.

commit   : c1772ad9225641c921545b35c84ee478c326b95e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Feb 2016 16:43:04 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Feb 2016 16:43:04 -0500    

Click here for diff

The previous RequestAddinLWLocks() method had several disadvantages.  
First, the locks would be in the main tranche; we've recently decided  
that it's useful for LWLocks used for separate purposes to have  
separate tranche IDs.  Second, there wasn't any correlation between  
what code called RequestAddinLWLocks() and what code called  
LWLockAssign(); when multiple modules are in use, it could become  
quite difficult to troubleshoot problems where LWLockAssign() ran out  
of locks.  To fix, create a concept of named LWLock tranches which  
can be used either by extension or by core code.  
  
Amit Kapila and Robert Haas  

M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/xfunc.sgml
M src/backend/postmaster/postmaster.c
M src/backend/storage/lmgr/lwlock.c
M src/include/pg_config_manual.h
M src/include/storage/lwlock.h
M src/tools/pgindent/typedefs.list

Simplify syntax diagram for REINDEX.

commit   : 5ef244a28266ce8e5666b23baed33a4c238542ff    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Feb 2016 13:58:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Feb 2016 13:58:40 -0500    

Click here for diff

Since there currently is only one possible parenthesized option, namely  
VERBOSE, it's a bit pointless to show it with "{ } [, ... ]".  The curly  
braces are useless and therefore confusing, as seen in a recent question  
from Karsten Hilbert.  Remove the extra decoration for the time being;  
we can put it back when and if REINDEX grows some more options.  

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

In pg_dump, ensure that view triggers are processed after view rules.

commit   : 0ed707e9b7e90891d0eda91b353edf3a69c4b7c4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Feb 2016 00:26:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Feb 2016 00:26:10 -0500    

Click here for diff

If a view is split into CREATE TABLE + CREATE RULE to break a circular  
dependency, then any triggers on the view must be dumped/reloaded after  
the CREATE RULE; else the backend may reject the CREATE TRIGGER because  
it's the wrong type of trigger for a plain table.  This works all right  
in plain dump/restore because of pg_dump's sorting heuristic that places  
triggers after rules.  However, when using parallel restore, the ordering  
must be enforced by a dependency --- and we didn't have one.  
  
Fixing this is a mere matter of adding an addObjectDependency() call,  
except that we need to be able to find all the triggers belonging to the  
view relation, and there was no easy way to do that.  Add fields to  
pg_dump's TableInfo struct to remember where the associated TriggerInfo  
struct(s) are.  
  
Per bug report from Dennis Kögel.  The failure can be exhibited at least  
as far back as 9.1, so back-patch to all supported branches.  

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

Extend sortsupport for text to more opclasses.

commit   : b47b4dbf683f13e6ef09fa0d93aa6e84f3d00819    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 3 Feb 2016 14:17:35 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 3 Feb 2016 14:17:35 -0500    

Click here for diff

Have varlena.c expose an interface that allows the char(n), bytea, and  
bpchar types to piggyback on a now-generalized SortSupport for text.  
This pushes a little more knowledge of the bpchar/char(n) type into  
varlena.c than might be preferred, but that seems like the approach  
that creates least friction.  Also speed things up for index builds  
that use text_pattern_ops or varchar_pattern_ops.  
  
This patch does quite a bit of renaming, but it seems likely to be  
worth it, so as to avoid future confusion about the fact that this code  
is now more generally used than the old names might have suggested.  
  
Peter Geoghegan, reviewed by Álvaro Herrera and Andreas Karlsson,  
with small tweaks by me.  

M doc/src/sgml/datatype.sgml
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h

Add hstore_to_jsonb() and hstore_to_jsonb_loose() to hstore documentation.

commit   : 24a26c9f5448b24943df4c9bcf154bfd9f8197a6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Feb 2016 12:56:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Feb 2016 12:56:40 -0500    

Click here for diff

These were never documented anywhere user-visible.  Tut tut.  

M doc/src/sgml/hstore.sgml

Allow parallel custom and foreign scans.

commit   : 69d34408e5e7adcef8ef2f4e9c4f2919637e9a06    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 3 Feb 2016 12:46:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 3 Feb 2016 12:46:18 -0500    

Click here for diff

This patch doesn't put the new infrastructure to use anywhere, and  
indeed it's not clear how it could ever be used for something like  
postgres_fdw which has to send an SQL query and wait for a reply,  
but there might be FDWs or custom scan providers that are CPU-bound,  
so let's give them a way to join club parallel.  
  
KaiGai Kohei, reviewed by me.  

M doc/src/sgml/custom-scan.sgml
M doc/src/sgml/fdwhandler.sgml
M src/backend/executor/execParallel.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/foreign/fdwapi.h
M src/include/nodes/execnodes.h

doc: Fix stand-alone INSTALL file build

commit   : 25e44518c16461d66fb6cec2063035d591db1def    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Feb 2016 12:31:33 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Feb 2016 12:31:33 -0500    

Click here for diff

Commit 7d17e683fcc28a1b371c7dd02935728cd2cbf9bf introduced an external  
link.  

M doc/src/sgml/installation.sgml

Make hstore_to_jsonb_loose match hstore_to_json_loose on what's a number.

commit   : 41d2c081ce659f40dec3eb9efc647082aa775eb4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Feb 2016 12:03:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Feb 2016 12:03:50 -0500    

Click here for diff

Commit e09996ff8dee3f70 removed some ad-hoc code in hstore_to_json_loose  
that determined whether an hstore value string looked like a number,  
in favor of calling the JSON parser's is-it-a-number code.  However,  
it neglected the fact that the exact same code appeared in  
hstore_to_jsonb_loose.  
  
This is not a bug, exactly, because the requirements on the two functions  
are not the same: hstore_to_json_loose must accept only syntactically legal  
JSON numbers as numbers, or it will produce invalid JSON output, as per bug  
#12070 which spawned the prior commit.  But hstore_to_jsonb_loose could  
accept anything that numeric_in will eat, other than Inf and NaN.  
  
Nonetheless it seems surprising and arbitrary that the two functions don't  
use the same rules for what is a number versus what is a string; especially  
since they did use the same rules before the aforesaid commit.  For one  
thing, that means that doing hstore_to_json_loose and then casting to jsonb  
can produce results different from doing just hstore_to_jsonb_loose.  
  
Hence, change hstore_to_jsonb_loose's logic to match hstore_to_json_loose,  
ie, hstore values are treated as numbers when they match the JSON syntax  
for numbers.  
  
No back-patch, since this is more in the nature of a definitional change  
than a bug fix.  

M contrib/hstore/hstore_io.c

Code review for commit dc203dc3ac40a4b02b92fb827848a547d2957153.

commit   : 52b63649fc5ff5d86227b8905e1c79cd9ceddf4c    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 3 Feb 2016 11:53:46 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 3 Feb 2016 11:53:46 -0500    

Click here for diff

Remove duplicate assignment.  This part by Ashutosh Bapat.  
  
Remove now-obsolete comment.  This part by me, although the pending  
join pushdown patch does something similar, and for the same reason:  
there's no reason to keep two lists of the things in the fdw_private  
structure that have to be kept in sync with each other.  

M contrib/postgres_fdw/postgres_fdw.c

Remove CustomPath's TextOutCustomPath method.

commit   : f2305d40ec20e63f781983d103d819ad2b6c0faf    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 3 Feb 2016 10:38:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 3 Feb 2016 10:38:50 -0500    

Click here for diff

You can't really do anything useful with this in the form it currently  
exists; among other problems, there's no way to reread whatever  
information might be produced when the path is output.  Work is  
underway to replace this with a more useful and more general system of  
extensible nodes, but let's start by getting rid of this bit.  
  
Extracted from a larger patch by KaiGai Kohei.  

M doc/src/sgml/custom-scan.sgml
M src/backend/nodes/outfuncs.c
M src/include/nodes/relation.h

postgres_fdw: Allow fetch_size to be set per-table or per-server.

commit   : dc203dc3ac40a4b02b92fb827848a547d2957153    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 3 Feb 2016 09:01:59 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 3 Feb 2016 09:01:59 -0500    

Click here for diff

The default fetch size of 100 rows might not be right in every  
environment, so allow users to configure it.  
  
Corey Huinker, reviewed by Kyotaro Horiguchi, Andres Freund, and me.  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Fix IsValidJsonNumber() to notice trailing non-alphanumeric garbage.

commit   : e6ecc93a1747624c4d33fa48d8a2d77319f3400f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Feb 2016 01:39:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Feb 2016 01:39:08 -0500    

Click here for diff

Commit e09996ff8dee3f70 was one brick shy of a load: it didn't insist  
that the detected JSON number be the whole of the supplied string.  
This allowed inputs such as "2016-01-01" to be misdetected as valid JSON  
numbers.  Per bug #13906 from Dmitry Ryabov.  
  
In passing, be more wary of zero-length input (I'm not sure this can  
happen given current callers, but better safe than sorry), and do some  
minor cosmetic cleanup.  

M contrib/hstore/expected/hstore.out
M contrib/hstore/sql/hstore.sql
M src/backend/utils/adt/json.c

Add support for systemd service notifications

commit   : 7d17e683fcc28a1b371c7dd02935728cd2cbf9bf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 17 Nov 2015 06:46:17 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 17 Nov 2015 06:46:17 -0500    

Click here for diff

Insert sd_notify() calls at server start and stop for integration with  
systemd.  This allows the use of systemd service units of type "notify",  
which greatly simplifies the systemd configuration.  
  
Reviewed-by: Pavel Stěhule <[email protected]>  

M configure
M configure.in
M doc/src/sgml/installation.sgml
M doc/src/sgml/runtime.sgml
M src/Makefile.global.in
M src/backend/Makefile
M src/backend/postmaster/postmaster.c
M src/include/pg_config.h.in

Improve error reporting when location specified by postgres -D does not exist

commit   : ac7238dc0faccb0ad077aa9922df6e75b0b1bda3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 17 Nov 2015 06:47:18 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 17 Nov 2015 06:47:18 -0500    

Click here for diff

Previously, the first error seen would be that postgresql.conf does not  
exist.  But for the case where the whole directory does not exist, give  
an error message about that, together with a hint for how to create one.  

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

Remove printQueryOpt.quote field.

commit   : 2808a2e0f3e7dd98f5dc3041183fd5f389e0a8e1    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Feb 2016 15:26:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Feb 2016 15:26:21 -0500    

Click here for diff

This field was included in the original definition of the printQueryOpt  
struct in commit a45195a191eec367, but it was not used anywhere in that  
commit, nor since then.  Spotted by Dickson S. Guedes.  

M src/bin/psql/print.h

Don't test for system columns on join relations

commit   : 3cb5867b7d346eff4abcb69ca182ba658d5faecc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 2 Feb 2016 19:20:02 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 2 Feb 2016 19:20:02 +0100    

Click here for diff

create_foreignscan_plan needs to know whether any system columns are  
requested from a relation (this flag is needed by ForeignNext during  
execution).  However, for join relations this is a pointless test,  
because it's not possible to request system columns from them, so  
remove the check.  
  
Author: Etsuro Fujita  
Discussion: http://www.postgresql.org/message-id/[email protected]  
Reviewed-by: David Rowley, Robert Haas  

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

Remove unnecessary "implementation of FOO operator" DESCR() entries.

commit   : 2ad83fff221eec2cc76f8823b0043763d0dfe0c3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Feb 2016 11:52:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Feb 2016 11:52:27 -0500    

Click here for diff

Apparently at least one committer hasn't gotten the word that these do not  
need to be maintained by hand, since initdb will create them automatically.  
Noted while fixing bug #13905.  
  
No catversion bump since the post-initdb state is exactly the same either  
way.  I don't see a need for back-patch, either.  

M src/include/catalog/pg_proc.h

Fix pg_description entries for jsonb_to_record() and jsonb_to_recordset().

commit   : a4627e8fd479ff74fffdd49ad07636b79751be45    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Feb 2016 11:39:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Feb 2016 11:39:50 -0500    

Click here for diff

All the other jsonb function descriptions refer to the arguments as being  
"jsonb", but these two said "json".  Make it consistent.  Per bug #13905  
from Petru Florin Mihancea.  
  
No catversion bump --- we can't force one in the back branches, and this  
isn't very critical anyway.  

M src/include/catalog/pg_proc.h

Fix typo in comment

commit   : 23f3cc36ed8188b0b8bf22daa4bb5b47d216c15d    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 2 Feb 2016 13:49:02 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 2 Feb 2016 13:49:02 +0100    

Click here for diff

M src/bin/pg_basebackup/pg_recvlogical.c

Fix lossy KNN GiST when ordering operator returns non-float8 value.

commit   : f25d07d99f4acf136baed4ef29ea97faad7337db    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 2 Feb 2016 15:20:33 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 2 Feb 2016 15:20:33 +0300    

Click here for diff

KNN GiST with recheck flag should return to executor the same type as ordering  
operator, GiST detects this type by looking to return type of function which  
implements ordering operator. But occasionally detecting code works after  
replacing ordering operator function to distance support function.  
Distance support function always returns float8, so, detecting code get float8  
instead of actual return type of ordering operator.  
  
Built-in opclasses don't have ordering operator which doesn't return  
non-float8 value, so, tests are impossible here, at least now.  
  
Backpatch to 9.5 where lozzy KNN was introduced.  
  
Author: Alexander Korotkov  
Report by: Artur Zakirov  

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

Make all built-in lwlock tranche IDs fixed.

commit   : 7191ce8bea0cb110a28faef178efa92bf456e030    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 2 Feb 2016 06:42:14 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 2 Feb 2016 06:42:14 -0500    

Click here for diff

This makes the values more stable, which seems like a good thing for  
anybody who needs to look at at them.  
  
Alexander Korotkov and Amit Kapila  

M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/commands/async.c
M src/backend/replication/logical/origin.c
M src/backend/storage/lmgr/predicate.c
M src/include/access/slru.h
M src/include/storage/lwlock.h

pgbench: allow per-script statistics

commit   : 1d0c3b3f8a98b0ed9515ff0a3868266c3bfb5d38    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 1 Feb 2016 15:55:33 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 1 Feb 2016 15:55:33 +0100    

Click here for diff

Provide per-script statistical info (count of transactions executed  
under that script, average latency for the whole script) after a  
multi-script run, adding an intermediate level of detail to existing  
global stats and per-command stats.  
  
Author: Fabien Coelho  
Reviewer: Michaël Paquier, Álvaro Herrera  

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

pgbench: Install guards against obscure overflow conditions.

commit   : 64f5edca2401f6c2f23564da9dd52e92d08b3a20    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 1 Feb 2016 08:23:41 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 1 Feb 2016 08:23:41 -0500    

Click here for diff

Dividing INT_MIN by -1 or taking INT_MIN modulo -1 can sometimes  
cause floating-point exceptions or otherwise misbehave.  
  
Fabien Coelho and Michael Paquier  

M src/bin/pgbench/pgbench.c

Various fixes to "ALTER ... SET/RESET" tab completions

commit   : 89611c4dfa67630f7dcc25881c17cbd1b2e24ea1    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 1 Feb 2016 22:19:51 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 1 Feb 2016 22:19:51 +0900    

Click here for diff

Add  
- ALTER SYSTEM SET/RESET ... -> GUC variables  
- ALTER TABLE ... SET WITH -> OIDS  
- ALTER DATABASE/FUNCTION/ROLE/USER ... SET/RESET -> GUC variables  
- ALTER DATABASE/FUNCTION/ROLE/USER ... SET ... -> FROM CURRENT/TO  
- ALTER DATABASE/FUNCTION/ROLE/USER ... SET ... TO/= -> possible values  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier, Masahiko Sawada  

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

Make sure ecpg header files do not have a comment lasting several lines, one of which is a preprocessor directive. This leads ecpg to incorrectly parse the comment as nested.

commit   : 7a58d19b0c80300e7974620d336d5f90fe2d0087    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 1 Feb 2016 13:10:40 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 1 Feb 2016 13:10:40 +0100    

Click here for diff

M src/interfaces/ecpg/include/datetime.h
M src/interfaces/ecpg/include/decimal.h

Fix typos in comments

commit   : e51ab85cd95855d541311f204e1e7db2c40301f7    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 1 Feb 2016 11:43:48 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 1 Feb 2016 11:43:48 +0100    

Click here for diff

Author: Michael Paquier  

M contrib/pgcrypto/fortuna.c
M src/backend/postmaster/bgwriter.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/snapbuild.c
M src/common/pg_lzcompress.c

Fix misspelled function name in comment.

commit   : 61ce1e8f154aefa97e9e5d5796f7b36c857efc74    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 1 Feb 2016 10:10:24 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 1 Feb 2016 10:10:24 +0200    

Click here for diff

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

Fix error in documentated use of mingw-w64 compilers

commit   : 7dc09c138493424e32876894c2c68ddecff3afc6    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 30 Jan 2016 19:28:44 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 30 Jan 2016 19:28:44 -0500    

Click here for diff

Error reported by Igal Sapir.  

M doc/src/sgml/installation.sgml

Fix whitespace

commit   : 9217bf3961c8420ca38bbe10819fb022185b9744    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 30 Jan 2016 15:58:20 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 30 Jan 2016 15:58:20 -0500    

Click here for diff

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

postgres_fdw: More preliminary refactoring for upcoming join pushdown.

commit   : cc592c48c58d9c1920f8e2063756dcbcce79e4dd    
  
author   : Robert Haas <[email protected]>    
date     : Sat, 30 Jan 2016 10:32:38 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Sat, 30 Jan 2016 10:32:38 -0500    

Click here for diff

The code that generates a complete SQL query for a given foreign relation  
was repeated in two places, and they didn't quite agree: the EXPLAIN case  
left out the locking clause.  Centralize the code so we get the same  
behavior everywhere, and adjust calling conventions and which functions  
are static vs. extern accordingly .  Centralize the code so we get the same  
behavior everywhere, and adjust calling conventions and which functions  
are static vs. extern accordingly.  
  
Ashutosh Bapat, reviewed and slightly adjusted by me.  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h

Migrate replication slot I/O locks into a separate tranche.

commit   : 2251179e6ad3a865d2f55e1832fab34608fcce43    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Jan 2016 09:44:29 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Jan 2016 09:44:29 -0500    

Click here for diff

This is following in a long train of similar changes and for the same  
reasons - see b319356f0e94a6482c726cf4af96597c211d8d6e and  
fe702a7b3f9f2bc5bf6d173166d7d55226af82c8 inter alia.  
  
Author: Amit Kapila  
Reviewed-by: Alexander Korotkov, Robert Haas  

M src/backend/replication/slot.c
M src/backend/storage/lmgr/lwlock.c
M src/include/replication/slot.h
M src/include/storage/lwlock.h

Migrate PGPROC's backendLock into PGPROC itself, using a new tranche.

commit   : b319356f0e94a6482c726cf4af96597c211d8d6e    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Jan 2016 08:10:47 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Jan 2016 08:10:47 -0500    

Click here for diff

Previously, each PGPROC's backendLock was part of the main tranche,  
and the PGPROC just contained a pointer.  Now, the actual LWLock is  
part of the PGPROC.  
  
As with previous, similar patches, this makes it significantly easier  
to identify these lwlocks in LWLOCK_STATS or Trace_lwlocks output  
and improves modularity.  
  
Author: Ildus Kurbangaliev  
Reviewed-by: Amit Kapila, Robert Haas  

M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/lwlock.h
M src/include/storage/proc.h

pgbench: refactor handling of stats tracking

commit   : b60376649600268b75e1e8be86a6a6fe7fb9b3c3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 29 Jan 2016 13:05:08 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 29 Jan 2016 13:05:08 +0100    

Click here for diff

This doesn't add any functionality but just shuffles things around so  
that it can be reused and improved later.  
  
Author: Fabien Coelho  
Reviewed-by: Michael Paquier, Álvaro Herrera  

M src/bin/pgbench/pgbench.c

Fix incorrect pattern-match processing in psql's \det command.

commit   : 7e22470471e9ed7010fcbc4a18b0a461d088d7c7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Jan 2016 10:28:02 +0100    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Jan 2016 10:28:02 +0100    

Click here for diff

listForeignTables' invocation of processSQLNamePattern did not match up  
with the other ones that handle potentially-schema-qualified names; it  
failed to make use of pg_table_is_visible() and also passed the name  
arguments in the wrong order.  Bug seems to have been aboriginal in commit  
0d692a0dc9f0e532.  It accidentally sort of worked as long as you didn't  
inquire too closely into the behavior, although the silliness was later  
exposed by inconsistencies in the test queries added by 59efda3e50ca4de6  
(which I probably should have questioned at the time, but didn't).  
  
Per bug #13899 from Reece Hart.  Patch by Reece Hart and Tom Lane.  
Back-patch to all affected branches.  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/bin/psql/describe.c

Fix syntax descriptions for replication commands in logicaldecoding.sgml

commit   : c35c4ec45443cfb36893ce15769659c60fb80f3b    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 29 Jan 2016 12:14:56 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 29 Jan 2016 12:14:56 +0900    

Click here for diff

Patch-by: Oleksandr Shulgin  
Reviewed-by: Craig Ringer and Fujii Masao  
Backpatch-through: 9.4 where logical decoding was introduced  

M doc/src/sgml/logicaldecoding.sgml

postgres_fdw: Refactor deparsing code for locking clauses.

commit   : b88ef201d46e6519b5e0589358c952a4c0f5bf0f    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 28 Jan 2016 16:44:01 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 28 Jan 2016 16:44:01 -0500    

Click here for diff

The upcoming patch to allow join pushdown in postgres_fdw needs to use  
this code multiple times, which requires moving it to deparse.c.  That  
seems like a good idea anyway, so do that now both on general principle  
and to simplify the future patch.  
  
Inspired by a patch by Shigeru Hanada and Ashutosh Bapat, but I did  
it a little differently than what that patch did.  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h

Only try to push down foreign joins if the user mapping OIDs match.

commit   : fbe5a3fb73102c2cfec11aaaa4a67943f4474383    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 28 Jan 2016 14:05:36 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 28 Jan 2016 14:05:36 -0500    

Click here for diff

Previously, the foreign join pushdown infrastructure left the question  
of security entirely up to individual FDWs, but it would be easy for  
a foreign data wrapper to inadvertently open up subtle security holes  
that way.  So, make it the core code's job to determine which user  
mapping OID is relevant, and don't attempt join pushdown unless it's  
the same for all relevant relations.  
  
Per a suggestion from Tom Lane.  Shigeru Hanada and Ashutosh Bapat,  
reviewed by Etsuro Fujita and KaiGai Kohei, with some further  
changes by me.  

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/plan/createplan.c
M src/backend/optimizer/plan/planner.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/plannodes.h
M src/include/nodes/relation.h
M src/include/utils/plancache.h

Add missing quotation mark.

commit   : 2f6b041f76e6de0fa2921131a23bda794ffb83bb    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 28 Jan 2016 12:21:51 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 28 Jan 2016 12:21:51 -0500    

Click here for diff

This fix accidentally got left out of the previous commit.  

M contrib/postgres_fdw/connection.c

Avoid multiple foreign server connections when all use same user mapping.

commit   : 96198d94cb7adc664bda341842dc8db671d8be72    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 28 Jan 2016 12:05:19 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 28 Jan 2016 12:05:19 -0500    

Click here for diff

Previously, postgres_fdw's connection cache was keyed by user OID and  
server OID, but this can lead to multiple connections when it's not  
really necessary.  In particular, if all relevant users are mapped to  
the public user mapping, then their connection options are certainly  
the same, so one connection can be used for all of them.  
  
While we're cleaning things up here, drop the "server" argument to  
GetConnection(), which isn't really needed.  This saves a few cycles  
because callers no longer have to look this up; the function itself  
does, but only when establishing a new connection, not when reusing  
an existing one.  
  
Ashutosh Bapat, with a few small changes by me.  

M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M src/backend/foreign/foreign.c
M src/include/foreign/foreign.h

Add [NO]BYPASSRLS options to CREATE USER and ALTER USER docs.

commit   : 80db1ca2d79338c35bb3e01f2aecad78c2231b06    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 28 Jan 2016 09:29:04 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 28 Jan 2016 09:29:04 -0500    

Click here for diff

Patch-by: Filip Rembiałkowski  
Reviewed-by: Robert Haas  
Backpatch-through: 9.5  

M doc/src/sgml/ref/alter_user.sgml
M doc/src/sgml/ref/create_user.sgml

Fix spi_worker mention in bgworker documentation

commit   : e37483857dc4cf7106a47847620a074b1c921142    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 28 Jan 2016 14:08:21 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 28 Jan 2016 14:08:21 +0100    

Click here for diff

The documentation mentioned contrib/ but the module was moved to  
src/test/modules/ by commit 22dfd116a127a of 9.5 era.  
  
Problem pointed out by Dickson Guedes in bug #13896  
Backpatch-to: 9.5.  

M doc/src/sgml/bgworker.sgml

Fix typos in comments and doc

commit   : 62e2ddd4ca47756372f2788256f445bba6bb492c    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 28 Jan 2016 16:47:36 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 28 Jan 2016 16:47:36 +0900    

Click here for diff

overriden -> overridden  
  
The misspelling in create_extension.sgml was introduced in b67aaf2,  
so no need to backpatch.  

M doc/src/sgml/ref/create_extension.sgml
M src/backend/bootstrap/bootstrap.c
M src/makefiles/Makefile.win32

Add gin_clean_pending_list function to clean up GIN pending list

commit   : 7f46eaf035440564e7dae3b03916735b92c83248    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 28 Jan 2016 12:57:52 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 28 Jan 2016 12:57:52 +0900    

Click here for diff

This function cleans up the pending list of the GIN index by  
moving entries in it to the main GIN data structure in bulk.  
It returns the number of pages cleaned up from the pending list.  
  
This function is useful, for example, when the pending list  
needs to be cleaned up *quickly* to improve the performance of  
the search using GIN index. VACUUM can do the same thing, too,  
but it may take days to run on a large table.  
  
Jeff Janes,  
reviewed by Julien Rouhaud, Jaime Casanova, Alvaro Herrera and me.  
  
Discussion: CAMkU=1x8zFkpfnozXyt40zmR3Ub_kHu58LtRmwHUKRgQss7=iQ@mail.gmail.com  

M doc/src/sgml/func.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/ref/create_index.sgml
M src/backend/access/gin/ginfast.c
M src/include/access/gin_private.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/gin.out
M src/test/regress/sql/gin.sql

Assert that create_unique_path returns non-NULL.

commit   : eaf7b1f6432480e93d8c6824fbd503761a1c1a4f    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Jan 2016 22:03:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Jan 2016 22:03:18 -0500    

Click here for diff

Per off-list discussion with Tom Lane and Michael Paquier, Coverity  
gets unhappy if this is not done.  

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

Fix cross-version pg_dump for aggregate combine functions.

commit   : 025b2f339260b727e113a01a20b616a336bff00a    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Jan 2016 21:45:07 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Jan 2016 21:45:07 -0500    

Click here for diff

Fixes a defect in commit a7de3dc5c346e07e0439275982569996e645b3c2.  
  
David Rowley, per report from Jeff Janes, who also checked that the  
fix works.  

M src/bin/pg_dump/pg_dump.c

Fix volatility marking of pg_size_pretty function

commit   : e09507a272e32bf203a51cc3cbb4d34028cba331    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 27 Jan 2016 11:13:31 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 27 Jan 2016 11:13:31 +0900    

Click here for diff

pg_size_pretty function should be marked immutable rather than volatile  
because it always returns the same result given the same argument.  
  
Pavel Stehule  

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

pgbench: improve multi-script support

commit   : 8bea3d2219844887e170471f223ba100b3c17571    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 27 Jan 2016 02:54:22 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 27 Jan 2016 02:54:22 +0100    

Click here for diff

Previously, it was possible to specify one or several custom scripts to  
run, or only one of the builtin scripts.  With this patch it is also  
possible to specify to run the builtin scripts multiple times, using the  
new -b option.  Also, unify the code for both cases; this eases future  
pgbench improvements.  
  
Author: Fabien Coelho  
Review: Michaël Paquier, Álvaro Herrera  

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

Mostly mechanical cleanup of pgbench

commit   : 5b3cc1af2f9ba7b0e30054b30e28bd2cc4175b78    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 27 Jan 2016 02:11:34 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 27 Jan 2016 02:11:34 +0100    

Click here for diff

pgindent for recent commits; also change some variables from int to  
boolean, which is how they are really used.  
  
Mostly submitted by Fabien Coelho; this is in preparation to commit  
further patches to the file.  

M src/bin/pgbench/pgbench.c

Fix startup so that log prefix %h works for the log_connections message.

commit   : b8682a7155bee06667c5773e1ca6499a670338b0    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Jan 2016 15:38:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Jan 2016 15:38:33 -0500    

Click here for diff

We entirely randomly chose to initialize port->remote_host just after  
printing the log_connections message, when we could perfectly well do it  
just before, allowing %h and %r to work for that message.  Per gripe from  
Artem Tomyuk.  

M src/backend/postmaster/postmaster.c

Improve ResourceOwners' behavior for large numbers of owned objects.

commit   : cc988fbb0bf60a83b628b5615e6bade5ae9ae6f4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Jan 2016 15:20:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Jan 2016 15:20:22 -0500    

Click here for diff

The original coding was quite fast so long as objects were always  
released in reverse order of addition; otherwise, it degenerated into  
O(N^2) behavior due to searching for the array element to delete.  
Improve matters by switching to hashed storage when the number of  
objects of a given type exceeds 64.  (The cutover point is open to  
discussion, of course, but some simple performance testing suggests  
that hashing has enough overhead to be a loser below there.)  
  
Also, refactor resowner.c so that we don't need N copies of the array  
management code.  Since all the resource IDs the code currently needs  
to deal with are either pointers or integers, it seems sufficient to  
create a one-size-fits-all infrastructure in which everything is  
converted to a Datum for storage.  
  
Aleksander Alekseev, reviewed by Stas Kelvich, further fixes by me  

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

Various fixes to REFRESH MATERIALIZED VIEW tab completion.

commit   : 879d71393de001880e031255e41ca322c6027713    
  
author   : Kevin Grittner <[email protected]>    
date     : Tue, 26 Jan 2016 08:45:08 -0600    
  
committer: Kevin Grittner <[email protected]>    
date     : Tue, 26 Jan 2016 08:45:08 -0600    

Click here for diff

Masahiko Sawada, Fujii Masao, Kevin Grittner  

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

Revert "Fix broken multibyte regression tests."

commit   : ad2e233385ee3e441454f20a02ac0f68f7873bc2    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Tue, 26 Jan 2016 08:29:15 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Tue, 26 Jan 2016 08:29:15 +0900    

Click here for diff

This reverts commit efc1610b64b04e7cf08cc1d6c608ede8b7d5ff07.  
The commit was plain wrong as pointed out in:  
http://www.postgresql.org/message-id/[email protected]  

M src/test/mb/expected/big5.out
M src/test/mb/expected/euc_jp.out
M src/test/mb/expected/euc_kr.out
M src/test/mb/expected/euc_tw.out
M src/test/mb/expected/gb18030.out
M src/test/mb/expected/mule_internal.out
M src/test/mb/expected/sjis.out
M src/test/mb/expected/utf8.out

Correct comment in GetConflictingVirtualXIDs()

commit   : 1129c2b0ad2732f301f696ae2cf98fb063a4c1f8    
  
author   : Simon Riggs <[email protected]>    
date     : Sun, 24 Jan 2016 10:22:11 -0800    
  
committer: Simon Riggs <[email protected]>    
date     : Sun, 24 Jan 2016 10:22:11 -0800    

Click here for diff

We use Share lock because it is safe to do so.  

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

Yet further adjust degree-based trig functions for more portability.

commit   : 00347575e2754b1aaacd357776560803564d3f35    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Jan 2016 12:53:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Jan 2016 12:53:03 -0500    

Click here for diff

Buildfarm member cockatiel is still saying that cosd(60) isn't 0.5.  
What seems likely is that the subexpression (1.0 - cos(x)) isn't being  
rounded to double width before more arithmetic is done on it, so force  
that by storing it into a variable.  

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

Still further adjust degree-based trig functions for more portability.

commit   : 360f67d31a5656991122b89c9ca22a860f41512c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Jan 2016 18:12:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Jan 2016 18:12:54 -0500    

Click here for diff

Indeed, the non-static declaration foreseen in my previous commit message  
is necessary.  Per Noah Misch.  

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

Further adjust degree-based trig functions for more portability.

commit   : 65abaab547a5758b0d6d92df4af1663bb47d545f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Jan 2016 16:17:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Jan 2016 16:17:31 -0500    

Click here for diff

The last round didn't do it.  Per Noah Misch, the problem on at least  
some machines is that the compiler pre-evaluates trig functions having  
constant arguments using code slightly different from what will be used  
at runtime.  Therefore, we must prevent the compiler from seeing constant  
arguments to any of the libm trig functions used in this code.  
  
The method used here might still fail if init_degree_constants() gets  
inlined into the call sites.  That probably won't happen given the large  
number of call sites; but if it does, we could probably fix it by making  
init_degree_constants() non-static.  I'll avoid that till proven  
necessary, though.  

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

Adjust degree-based trig functions for more portability.

commit   : 73193d82d7c8d849774bf6952dfb4287e213c572    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Jan 2016 11:26:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Jan 2016 11:26:07 -0500    

Click here for diff

The buildfarm isn't very happy with the results of commit e1bd684a34c11139.  
To try to get the expected exact results everywhere:  
  
* Replace M_PI / 180 subexpressions with a precomputed constant, so that  
the compiler can't decide to rearrange that division with an adjacent  
operation.  Hopefully this will fix failures to get exactly 0.5 from  
sind(30) and cosd(60).  
  
* Add scaling to ensure that tand(45) and cotd(45) give exactly 1; there  
was nothing particularly guaranteeing that before.  
  
* Replace minus zero by zero when tand() or cotd() would output that;  
many machines did so for tand(180) and cotd(270), but not all.  We could  
alternatively deem both results valid, but that doesn't seem likely to  
be what users will want.  

M src/backend/utils/adt/float.c
M src/test/regress/expected/float8-exp-three-digits-win32.out
M src/test/regress/expected/float8-small-is-zero.out
M src/test/regress/expected/float8-small-is-zero_1.out
M src/test/regress/expected/float8.out

psql: Improve completion of FDW DDL commands

commit   : 6ae4c8de00c382b10e851e1eaf7f5e19e143b251    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 23 Jan 2016 06:57:42 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 23 Jan 2016 06:57:42 -0500    

Click here for diff

Add  
- ALTER FOREIGN DATA WRAPPER -> RENAME TO  
- ALTER SERVER -> RENAME TO  
- ALTER SERVER ... VERSION ... -> OPTIONS  
- CREATE FOREIGN DATA WRAPPER -> OPTIONS  
- CREATE SERVER -> OPTIONS  
- CREATE|ALTER USER MAPPING -> OPTIONS  
  
From: Andreas Karlsson <[email protected]>  

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

pg_dump: Fix quoting of domain constraint names

commit   : df43fcf4575cf77d85f4c4dcc096661905a6eb33    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 22 Jan 2016 20:04:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 22 Jan 2016 20:04:35 -0300    

Click here for diff

The original code was adding double quotes to an already-quoted  
identifier, leading to nonsensical results.  Remove the quoting call.  
  
I introduced the broken code in 7eca575d1c of 9.5 era, so backpatch to  
9.5.  
  
Report and patch by Elvis Pranskevichus  
Reviewed by Michael Paquier  

M src/bin/pg_dump/pg_dump.c

Add trigonometric functions that work in degrees.

commit   : e1bd684a34c11139a1bf4e5200c3bbe59a0fbfad    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Jan 2016 15:46:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Jan 2016 15:46:22 -0500    

Click here for diff

The implementations go to some lengths to deliver exact results for values  
where an exact result can be expected, such as sind(30) = 0.5 exactly.  
  
Dean Rasheed, reviewed by Michael Paquier  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/float.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h
M src/test/regress/expected/float8-exp-three-digits-win32.out
M src/test/regress/expected/float8-small-is-zero.out
M src/test/regress/expected/float8-small-is-zero_1.out
M src/test/regress/expected/float8.out
M src/test/regress/sql/float8.sql

Improve cross-platform consistency of Inf/NaN handling in trig functions.

commit   : fd5200c3dca0bc725f5848eef7ffff538f4479ed    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Jan 2016 14:50:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Jan 2016 14:50:51 -0500    

Click here for diff

Ensure that the trig functions return NaN for NaN input regardless of what  
the underlying C library functions might do.  Also ensure that an error  
is thrown for Inf (or otherwise out-of-range) input, except for atan/atan2  
which should accept it.  
  
All these behaviors should now conform to the POSIX spec; previously, all  
our popular platforms deviated from that in one case or another.  
  
The main remaining platform dependency here is whether the C library might  
choose to throw a domain error for sin/cos/tan inputs that are large but  
less than infinity.  (Doing so is not unreasonable, since once a single  
unit-in-the-last-place exceeds PI, there can be no significance at all in  
the result; however there doesn't seem to be any suggestion in POSIX that  
such an error is allowed.)  We will report such errors if they are reported  
via "errno", but not if they are reported via "fetestexcept" which is the  
other mechanism sanctioned by POSIX.  Some preliminary experiments with  
fetestexcept indicated that it might also report errors we could do  
without, such as complaining about underflow at an unreasonably large  
threshold.  So let's skip that complexity for now.  
  
Dean Rasheed, reviewed by Michael Paquier  

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

Improve levenshtein() docs.

commit   : 80aa219146c090d46b599ac40d8d63e30532b622    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Jan 2016 12:29:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Jan 2016 12:29:07 -0500    

Click here for diff

Fix chars-vs-bytes confusion here too.  Improve poor grammar and  
markup.  

M doc/src/sgml/fuzzystrmatch.sgml

Remove new coupling between NAMEDATALEN and MAX_LEVENSHTEIN_STRLEN.

commit   : a396144ac03b0cf337f80201df7e4663cc5a8131    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Jan 2016 11:53:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Jan 2016 11:53:06 -0500    

Click here for diff

Commit e529cd4ffa605c6f introduced an Assert requiring NAMEDATALEN to be  
less than MAX_LEVENSHTEIN_STRLEN, which has been 255 for a long time.  
Since up to that instant we had always allowed NAMEDATALEN to be  
substantially more than that, this was ill-advised.  
  
It's debatable whether we need MAX_LEVENSHTEIN_STRLEN at all (versus  
putting a CHECK_FOR_INTERRUPTS into the loop), or whether it has to be  
so tight; but this patch takes the narrower approach of just not applying  
the MAX_LEVENSHTEIN_STRLEN limit to calls from the parser.  
  
Trusting the parser for this seems reasonable, first because the strings  
are limited to NAMEDATALEN which is unlikely to be hugely more than 256,  
and second because the maximum distance is tightly constrained by  
MAX_FUZZY_DISTANCE (though we'd forgotten to make use of that limit in one  
place).  That means the cost is not really O(mn) but more like O(max(m,n)).  
  
Relaxing the limit for user-supplied calls is left for future research;  
given the lack of complaints to date, it doesn't seem very high priority.  
  
In passing, fix confusion between lengths-in-bytes and lengths-in-chars  
in comments and error messages.  
  
Per gripe from Kevin Day; solution suggested by Robert Haas.  Back-patch  
to 9.5 where the unwanted restriction was introduced.  

M contrib/fuzzystrmatch/fuzzystrmatch.c
M src/backend/parser/parse_relation.c
M src/backend/utils/adt/levenshtein.c
M src/include/utils/builtins.h

Make extract() do something more reasonable with infinite datetimes.

commit   : 647d87c56ab6da70adb753c08d7cdf7ee905ea8a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Jan 2016 22:26:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Jan 2016 22:26:20 -0500    

Click here for diff

Historically, extract() just returned zero for any case involving an  
infinite timestamp[tz] input; even cases in which the unit name was  
invalid.  This is not very sensible.  Instead, return infinity or  
-infinity as appropriate when the requested field is one that is  
monotonically increasing (e.g, year, epoch), or NULL when it is not  
(e.g., day, hour).  Also, throw the expected errors for bad unit names.  
  
BACKWARDS INCOMPATIBLE CHANGE  
  
Vitaly Burovoy, reviewed by Vik Fearing  

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

Suppress compiler warning.

commit   : d9b9289c837a98b78b948b597fabd9ab0a96c0db    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Jan 2016 21:14:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Jan 2016 21:14:07 -0500    

Click here for diff

Given the limited range of i, these shifts should not cause any  
problem, but that apparently doesn't stop some compilers from  
whining about them.  
  
David Rowley  

M src/backend/access/gin/ginvalidate.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/spgist/spgvalidate.c

Improve index AMs' opclass validation procedures.

commit   : be44ed27b86ebd165bbedf06a4ac5a8eb943d43c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Jan 2016 19:47:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Jan 2016 19:47:15 -0500    

Click here for diff

The amvalidate functions added in commit 65c5fcd353a859da were on the  
crude side.  Improve them in a few ways:  
  
* Perform signature checking for operators and support functions.  
  
* Apply more thorough checks for missing operators and functions,  
where possible.  
  
* Instead of reporting problems as ERRORs, report most problems as INFO  
messages and make the amvalidate function return FALSE.  This allows  
more than one problem to be discovered per run.  
  
* Report object names rather than OIDs, and work a bit harder on making  
the messages understandable.  
  
Also, remove a few more opr_sanity regression test queries that are  
now superseded by the amvalidate checks.  

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/index/Makefile
A src/backend/access/index/amvalidate.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/utils/cache/lsyscache.c
A src/include/access/amvalidate.h
M src/include/utils/lsyscache.h
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/opr_sanity.sql

Add defenses against putting expanded objects into Const nodes.

commit   : b99551832e79c915e4d877cf0a072120bd248748    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Jan 2016 12:55:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Jan 2016 12:55:59 -0500    

Click here for diff

Putting a reference to an expanded-format value into a Const node would be  
a bad idea for a couple of reasons.  It'd be possible for the supposedly  
immutable Const to change value, if something modified the referenced  
variable ... in fact, if the Const's reference were R/W, any function that  
has the Const as argument might itself change it at runtime.  Also, because  
datumIsEqual() is pretty simplistic, the Const might fail to compare equal  
to other Consts that it should compare equal to, notably including copies  
of itself.  This could lead to unexpected planner behavior, such as "could  
not find pathkey item to sort" errors or inferior plans.  
  
I have not been able to find any way to get an expanded value into a Const  
within the existing core code; but Paul Ramsey was able to trigger the  
problem by writing a datatype input function that returns an expanded  
value.  
  
The best fix seems to be to establish a rule that varlena values being  
placed into Const nodes should be passed through pg_detoast_datum().  
That will do nothing (and cost little) in normal cases, but it will flatten  
expanded values and thereby avoid the above problems.  Also, it will  
convert short-header or compressed values into canonical format, which will  
avoid possible unexpected lack-of-equality issues for those cases too.  
And it provides a last-ditch defense against putting a toasted value into  
a Const, which we already knew was dangerous, cf commit 2b0c86b66563cf2f.  
(In the light of this discussion, I'm no longer sure that that commit  
provided 100% protection against such cases, but this fix should do it.)  
  
The test added in commit 65c3d05e18e7c530 to catch datatype input functions  
with unstable results would fail for functions that returned expanded  
values; but it seems a bit uncharitable to deem a result unstable just  
because it's expressed in expanded form, so revise the coding so that we  
check for bitwise equality only after applying pg_detoast_datum().  That's  
a sufficient condition anyway given the new rule about detoasting when  
forming a Const.  
  
Back-patch to 9.5 where the expanded-object facility was added.  It's  
possible that this should go back further; but in the absence of clear  
evidence that there's any live bug in older branches, I'll refrain for now.  

M src/backend/nodes/makefuncs.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_type.c
M src/include/nodes/primnodes.h

Remove unused argument from ginInsertCleanup()

commit   : 38710a374ea9a29159ff12af7dbecd2959476447    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 22 Jan 2016 01:22:56 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 22 Jan 2016 01:22:56 +0900    

Click here for diff

It's an oversight in commit dc943ad.  

M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginvacuum.c
M src/include/access/gin_private.h

Refactor headers to split out standby defs

commit   : c80b31d557cb4b2d2a65cb0a7e71fd961834fdb2    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 20 Jan 2016 18:51:34 -0800    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 20 Jan 2016 18:51:34 -0800    

Click here for diff

Jeff Janes  

M src/backend/access/rmgrdesc/standbydesc.c
M src/bin/pg_xlogdump/rmgrdesc.c
M src/include/storage/standby.h
A src/include/storage/standbydefs.h

Speedup 2PC by skipping two phase state files in normal path

commit   : 978b2f65aa1262eb4ecbf8b3785cb1b9cf4db78e    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 20 Jan 2016 18:40:44 -0800    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 20 Jan 2016 18:40:44 -0800    

Click here for diff

2PC state info is written only to WAL at PREPARE, then read back from WAL at  
COMMIT PREPARED/ABORT PREPARED. Prepared transactions that live past one bufmgr  
checkpoint cycle will be written to disk in the same form as previously. Crash  
recovery path is not altered. Measured performance gains of 50-100% for short  
2PC transactions by completely avoiding writing files and fsyncing. Other  
optimizations still available, further patches in related areas expected.  
  
Stas Kelvich and heavily edited by Simon Riggs  
  
Based upon earlier ideas and patches by Michael Paquier and Heikki Linnakangas,  
a concrete example of how Postgres-XC has fed back ideas into PostgreSQL.  
  
Reviewed by Michael Paquier, Jeff Janes and Andres Freund  
Performance testing by Jesper Pedersen  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/include/access/xlog.h

psql: Add tab completion for COPY with query

commit   : d0f2f53cd6f2f1fe6e53b8e3bfcce43c16ea851b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 20 Jan 2016 21:27:46 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 20 Jan 2016 21:27:46 -0500    

Click here for diff

From: Andreas Karlsson <[email protected]>  

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

Refactor to create generic WAL page read callback

commit   : 422a55a68784fd00f4514834f3649140a9166fa5    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 20 Jan 2016 17:18:58 -0800    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 20 Jan 2016 17:18:58 -0800    

Click here for diff

Previously we didn’t have a generic WAL page read callback function,  
surprisingly. Logical decoding has logical_read_local_xlog_page(), which was  
actually generic, so move that to xlogfunc.c and rename to  
read_local_xlog_page().  
Maintain logical_read_local_xlog_page() so existing callers still work.  
  
As requested by Michael Paquier, Alvaro Herrera and Andres Freund  

M src/backend/access/transam/xlogutils.c
M src/backend/replication/logical/logicalfuncs.c
M src/include/access/xlogutils.h

commit   : 45be99f8cd5d606086e0a458c9c72910ba8a613d    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 20 Jan 2016 14:29:22 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 20 Jan 2016 14:29:22 -0500    

Click here for diff

The core innovation of this patch is the introduction of the concept  
of a partial path; that is, a path which if executed in parallel will  
generate a subset of the output rows in each process.  Gathering a  
partial path produces an ordinary (complete) path.  This allows us to  
generate paths for parallel joins by joining a partial path for one  
side (which at the baserel level is currently always a Partial Seq  
Scan) to an ordinary path on the other side.  This is subject to  
various restrictions at present, especially that this strategy seems  
unlikely to be sensible for merge joins, so only nested loops and  
hash joins paths are generated.  
  
This also allows an Append node to be pushed below a Gather node in  
the case of a partitioned table.  
  
Testing revealed that early versions of this patch made poor decisions  
in some cases, which turned out to be caused by the fact that the  
original cost model for Parallel Seq Scan wasn't very good.  So this  
patch tries to make some modest improvements in that area.  
  
There is much more to be done in the area of generating good parallel  
plans in all cases, but this seems like a useful step forward.  
  
Patch by me, reviewed by Dilip Kumar and Amit Kapila.  

M src/backend/executor/execParallel.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/README
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/relation.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h

Support multi-stage aggregation.

commit   : a7de3dc5c346e07e0439275982569996e645b3c2    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 20 Jan 2016 13:46:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 20 Jan 2016 13:46:50 -0500    

Click here for diff

Aggregate nodes now have two new modes: a "partial" mode where they  
output the unfinalized transition state, and a "finalize" mode where  
they accept unfinalized transition states rather than individual  
values as input.  
  
These new modes are not used anywhere yet, but they will be necessary  
for parallel aggregation.  The infrastructure also figures to be  
useful for cases where we want to aggregate local data and remote  
data via the FDW interface, and want to bring back partial aggregates  
from the remote side that can then be combined with locally generated  
partial aggregates to produce the final value.  It may also be useful  
even when neither FDWs nor parallelism are in play, as explained in  
the comments in nodeAgg.c.  
  
David Rowley and Simon Riggs, reviewed by KaiGai Kohei, Heikki  
Linnakangas, Haribabu Kommi, and me.  

M doc/src/sgml/ref/create_aggregate.sgml
M src/backend/catalog/pg_aggregate.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/explain.c
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/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/parser/parse_agg.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/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/planmain.h
M src/include/parser/parse_agg.h
M src/test/regress/expected/create_aggregate.out
M src/test/regress/sql/create_aggregate.sql

PostgresNode: Add names to nodes

commit   : c8642d909fdd57c36dd71e0b0bb4071523324794    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 20 Jan 2016 14:13:11 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 20 Jan 2016 14:13:11 -0300    

Click here for diff

This makes the log files easier to follow when investigating a test  
failure.  
  
Author: Michael Paquier  
Review: Noah Misch  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_rewind/RewindTest.pm
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/011_clusterdb_all.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/030_createlang.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/050_dropdb.pl
M src/bin/scripts/t/060_droplang.pl
M src/bin/scripts/t/070_dropuser.pl
M src/bin/scripts/t/080_pg_isready.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/091_reindexdb_all.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/t/101_vacuumdb_all.pl
M src/bin/scripts/t/102_vacuumdb_stages.pl
M src/test/perl/PostgresNode.pm
M src/test/ssl/t/001_ssltests.pl

Properly install dynloader.h on MSVC builds

commit   : 216d5684325dd2f6959f4859648e7aa908ae0757    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 19 Jan 2016 23:30:29 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 19 Jan 2016 23:30:29 -0500    

Click here for diff

This will enable PL/Java to be cleanly compiled, as dynloader.h is a  
requirement.  
  
Report by Chapman Flack  
  
Patch by Michael Paquier  
  
Backpatch through 9.1  

M src/backend/utils/fmgr/dfmgr.c
M src/tools/msvc/Install.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/clean.bat

Fix assorted inconsistencies in GIN opclass support function declarations.

commit   : dbe2328959e12701fade6b500ad411271923d6e4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Jan 2016 22:32:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Jan 2016 22:32:19 -0500    

Click here for diff

GIN had some minor issues too, mostly using "internal" where something  
else would be more appropriate.  I went with the same approach as in  
9ff60273e35cad6e, namely preferring the opclass' indexed datatype for  
arguments that receive an operator RHS value, even if that's not  
necessarily what they really are.  
  
Again, this is with an eye to having a uniform rule for ginvalidate()  
to check support function signatures.  

M contrib/hstore/hstore–1.3.sql
M contrib/intarray/intarray–1.1.sql
M contrib/tsearch2/tsearch2–1.0.sql
M doc/src/sgml/gin.sgml
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h

Add two HyperLogLog functions

commit   : 948c97958bf37adb2a9c2d6d92c255abfc7499ba    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 19 Jan 2016 17:40:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 19 Jan 2016 17:40:15 -0300    

Click here for diff

New functions initHyperLogLogError() and freeHyperLogLog() simplify  
using this module from elsewhere.  
  
Author: Tomáš Vondra  
Review: Peter Geoghegan  

M src/backend/lib/hyperloglog.c
M src/include/lib/hyperloglog.h

Fix assorted inconsistencies in GiST opclass support function declarations.

commit   : 9ff60273e35cad6e9d3a4adf59d5c2455afe9d9e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Jan 2016 12:04:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Jan 2016 12:04:32 -0500    

Click here for diff

The conventions specified by the GiST SGML documentation were widely  
ignored.  For example, the strategy-number argument for "consistent" and  
"distance" functions is specified to be a smallint, but most of the  
built-in support functions declared it as an integer, and for that matter  
the core code passed it using Int32GetDatum not Int16GetDatum.  None of  
that makes any real difference at runtime, but it's quite confusing for  
newcomers to the code, and it makes it very hard to write an amvalidate()  
function that checks support function signatures.  So let's try to instill  
some consistency here.  
  
Another similar issue is that the "query" argument is not of a single  
well-defined type, but could have different types depending on the strategy  
(corresponding to search operators with different righthand-side argument  
types).  Some of the functions threw up their hands and declared the query  
argument as being of "internal" type, which surely isn't right ("any" would  
have been more appropriate); but the majority position seemed to be to  
declare it as being of the indexed data type, corresponding to a search  
operator with both input types the same.  So I've specified a convention  
that that's what to do always.  
  
Also, the result of the "union" support function actually must be of the  
index's storage type, but the documentation suggested declaring it to  
return "internal", and some of the functions followed that.  Standardize  
on telling the truth, instead.  
  
Similarly, standardize on declaring the "same" function's inputs as  
being of the storage type, not "internal".  
  
Also, somebody had forgotten to add the "recheck" argument to both  
the documentation of the "distance" support function and all of their  
SQL declarations, even though the C code was happily using that argument.  
Clean that up too.  
  
Fix up some other omissions in the docs too, such as documenting that  
union's second input argument is vestigial.  
  
So far as the errors in core function declarations go, we can just fix  
pg_proc.h and bump catversion.  Adjusting the erroneous declarations in  
contrib modules is more debatable: in principle any change in those  
scripts should involve an extension version bump, which is a pain.  
However, since these changes are purely cosmetic and make no functional  
difference, I think we can get away without doing that.  

M contrib/btree_gist/btree_gist–1.1.sql
M contrib/cube/cube–1.1.sql
M contrib/hstore/hstore–1.3.sql
M contrib/intarray/intarray–1.1.sql
M contrib/ltree/ltree–1.0.sql
M contrib/pg_trgm/pg_trgm–1.2.sql
M contrib/seg/seg–1.0.sql
M contrib/tsearch2/tsearch2–1.0.sql
M doc/src/sgml/gist.sgml
M doc/src/sgml/ref/create_opclass.sgml
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_proc.h
M src/include/utils/geo_decls.h
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/opr_sanity.sql

Remove Cygwin-specific code from pg_ctl

commit   : 53c949c1be2f43cd47cb433923e76ea00e9222bc    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 19 Jan 2016 07:31:18 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 19 Jan 2016 07:31:18 -0500    

Click here for diff

This code has been there for a long time, but it's never really been  
needed. Cygwin has its own utility for registering, unregistering,  
stopping and starting Windows services, and that's what's used in the  
Cygwin postgres packages. So now pg_ctl for Cygwin looks like it is for  
any Unix platform.  
  
Michael Paquier and me  

M src/bin/pg_ctl/pg_ctl.c

Fix typo.

commit   : 85f22281a1190165851f15b35f8283c8b7592b3c    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Mon, 18 Jan 2016 21:26:30 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Mon, 18 Jan 2016 21:26:30 +0900    

Click here for diff

Reported by KOIZUMI Satoru.  

M doc/src/sgml/datatype.sgml

Add explicit cast to amcostestimate call.

commit   : 49b49506502026a3653bca490c939dc8934afe95    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Jan 2016 22:56:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Jan 2016 22:56:16 -0500    

Click here for diff

My compiler doesn't complain here, but David Rowley's does ...  

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

Restructure index access method API to hide most of it at the C level.

commit   : 65c5fcd353a859da9e61bfb2b92a99f12937de3b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Jan 2016 19:36:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Jan 2016 19:36:59 -0500    

Click here for diff

This patch reduces pg_am to just two columns, a name and a handler  
function.  All the data formerly obtained from pg_am is now provided  
in a C struct returned by the handler function.  This is similar to  
the designs we've adopted for FDWs and tablesample methods.  There  
are multiple advantages.  For one, the index AM's support functions  
are now simple C functions, making them faster to call and much less  
error-prone, since the C compiler can now check function signatures.  
For another, this will make it far more practical to define index access  
methods in installable extensions.  
  
A disadvantage is that SQL-level code can no longer see attributes  
of index AMs; in particular, some of the crosschecks in the opr_sanity  
regression test are no longer possible from SQL.  We've addressed that  
by adding a facility for the index AM to perform such checks instead.  
(Much more could be done in that line, but for now we're content if the  
amvalidate functions more or less replace what opr_sanity used to do.)  
We might also want to expose some sort of reporting functionality, but  
this patch doesn't do that.  
  
Alexander Korotkov, reviewed by Petr Jelínek, and rather heavily  
editorialized on by me.  

M contrib/pageinspect/btreefuncs.c
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/pgstattuple.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/xindex.sgml
M src/backend/access/brin/Makefile
M src/backend/access/brin/brin.c
A src/backend/access/brin/brin_validate.c
M src/backend/access/common/reloptions.c
M src/backend/access/gin/Makefile
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
A src/backend/access/gin/ginvalidate.c
M src/backend/access/gist/Makefile
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
A src/backend/access/gist/gistvalidate.c
M src/backend/access/hash/Makefile
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashutil.c
A src/backend/access/hash/hashvalidate.c
M src/backend/access/index/Makefile
A src/backend/access/index/amapi.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/Makefile
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtutils.c
A src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/spgist/Makefile
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
A src/backend/access/spgist/spgvalidate.c
M src/backend/catalog/index.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/toasting.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/execAmi.c
M src/backend/executor/nodeIndexscan.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_utilcmd.c
M src/backend/postmaster/autovacuum.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesort.c
A src/include/access/amapi.h
M src/include/access/brin.h
M src/include/access/brin_internal.h
M src/include/access/gin_private.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/hash.h
M src/include/access/nbtree.h
M src/include/access/reloptions.h
M src/include/access/spgist.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_am.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_type.h
M src/include/nodes/nodes.h
M src/include/nodes/relation.h
M src/include/utils/builtins.h
A src/include/utils/index_selfuncs.h
M src/include/utils/rel.h
M src/include/utils/selfuncs.h
M src/test/regress/expected/oidjoins.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/oidjoins.sql
M src/test/regress/sql/opr_sanity.sql
M src/tools/findoidjoins/README

Re-pgindent a few files.

commit   : 8d290c8ec6c182a4df1d089c21fe84c7912f01fe    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Jan 2016 19:13:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Jan 2016 19:13:18 -0500    

Click here for diff

In preparation for landing index AM interface changes.  

M src/backend/catalog/index.c
M src/backend/optimizer/path/costsize.c
M src/include/access/gist_private.h

Remove dead code in pg_dump.

commit   : 57ce9acc04483df4913921d4ff21f01483583fb8    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Jan 2016 11:38:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Jan 2016 11:38:40 -0500    

Click here for diff

Coverity quite reasonably complained that this check for fout==NULL  
occurred after we'd already dereferenced fout.  However, the check  
is just dead code since there is no code path by which CreateArchive  
can return a null pointer.  Errors such as can't-open-that-file are  
reported down inside CreateArchive, and control doesn't return.  
So let's silence the warning by removing the dead code, rather than  
continuing to pretend it does something.  
  
Coverity didn't complain about this before 5b5fea2a1, so back-patch  
to 9.5 like that patch.  

M src/bin/pg_dump/pg_dump.c

psql: Add completion support for DROP INDEX CONCURRENTLY

commit   : 4189e3d659abb48d159a6c3faabaa7e99498ca3e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 16 Jan 2016 20:46:14 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 16 Jan 2016 20:46:14 -0500    

Click here for diff

based on patch by Kyotaro Horiguchi  

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

Fix minor typo in comment

commit   : cf7dfbf2d6c5892747cd6fca399350d86c16f00f    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 15 Jan 2016 10:24:37 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 15 Jan 2016 10:24:37 +0100    

Click here for diff

Tatsuro Yamada  

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

Fix spelling mistakes.

commit   : 23c2dd03d5db2f4a20dcd09bd6c49e293e3c8f03    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 14 Jan 2016 23:12:05 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 14 Jan 2016 23:12:05 -0500    

Click here for diff

Same patch submitted independently by David Rowley and Peter Geoghegan.  

M src/backend/executor/nodeGather.c
M src/bin/pg_upgrade/controldata.c

Fix build_grouping_chain() to not clobber its input lists.

commit   : a923af382c5678f3dfb591aacb6b90bf4e5ed7a9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Jan 2016 11:51:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Jan 2016 11:51:57 -0500    

Click here for diff

There's no good reason for stomping on the input data; it makes the logic  
in this function no simpler, in fact probably the reverse.  And it makes  
it impossible to separate path generation from plan generation, as I'm  
working towards doing; that will require more than one traversal of these  
lists.  

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

Properly close token in sspi authentication

commit   : 6a61d1ff9dce7406c0affdc013da27ed4252ba29    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 14 Jan 2016 13:06:03 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 14 Jan 2016 13:06:03 +0100    

Click here for diff

We can never leak more than one token, but we shouldn't do that. We  
don't bother closing it in the error paths since the process will  
exit shortly anyway.  
  
Christian Ullrich  

M src/backend/libpq/auth.c

Handle extension members when first setting object dump flags in pg_dump.

commit   : e72d7d85310c397a94748db72d73a59c57e0b0dc    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Jan 2016 18:55:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Jan 2016 18:55:27 -0500    

Click here for diff

pg_dump's original approach to handling extension member objects was to  
run around and clear (or set) their dump flags rather late in its data  
collection process.  Unfortunately, quite a lot of code expects those flags  
to be valid before that; which was an entirely reasonable expectation  
before we added extensions.  In particular, this explains Karsten Hilbert's  
recent report of pg_upgrade failing on a database in which an extension  
has been installed into the pg_catalog schema.  Its objects are initially  
marked as not-to-be-dumped on the strength of their schema, and later we  
change them to must-dump because we're doing a binary upgrade of their  
extension; but we've already skipped essential tasks like making associated  
DO_SHELL_TYPE objects.  
  
To fix, collect extension membership data first, and incorporate it in the  
initial setting of the dump flags, so that those are once again correct  
from the get-go.  This has the undesirable side effect of slightly  
lengthening the time taken before pg_dump acquires table locks, but testing  
suggests that the increase in that window is not very much.  
  
Along the way, get rid of ugly special-case logic for deciding whether  
to dump procedural languages, FDWs, and foreign servers; dump decisions  
for those are now correct up-front, too.  
  
In 9.3 and up, this also fixes erroneous logic about when to dump event  
triggers (basically, they were *always* dumped before).  In 9.5 and up,  
transform objects had that problem too.  
  
Since this problem came in with extensions, back-patch to all supported  
versions.  

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

Access pg_dump's options structs through Archive struct, not directly.

commit   : 5b5fea2a11741e651f7c25e981dd29b610a08426    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Jan 2016 17:48:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Jan 2016 17:48:33 -0500    

Click here for diff

Rather than passing around DumpOptions and RestoreOptions as separate  
arguments, add fields to struct Archive to carry pointers to these objects,  
and access them through those fields when needed.  There already was a  
RestoreOptions pointer in Archive, though for no obvious reason it was part  
of the "private" struct rather than out where pg_dump.c could see it.  
  
Doing this allows reversion of quite a lot of parameter-addition changes  
made in commit 0eea8047bf, which is a good thing IMO because this will  
reduce the code delta between 9.4 and 9.5, probably easing a few future  
back-patch efforts.  Moreover, the previous commit only added a DumpOptions  
argument to functions that had to have it at the time, which means we could  
anticipate still more code churn (and more back-patch hazard) as the  
requirement spread further.  I'd hit exactly that problem in my upcoming  
patch to fix extension membership marking, which is what motivated me to  
do this.  

M src/bin/pg_dump/common.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_null.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_restore.c

Run pgindent on src/bin/pg_dump/*

commit   : 26905e009babe6020fddcf3820e57e2f87c5539c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Jan 2016 15:48:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Jan 2016 15:48:54 -0500    

Click here for diff

To ease doing indent fixups on a couple of patches I have in progress.  

M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c

psql: Improve CREATE INDEX CONCURRENTLY tab completion

commit   : b1bfb28b586a319052d96dd4dfd40a05505ea6ed    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Jan 2016 20:31:43 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Jan 2016 20:31:43 -0500    

Click here for diff

The completion of CREATE INDEX CONCURRENTLY was lacking in several ways  
compared to a plain CREATE INDEX command:  
  
- CREATE INDEX <name> ON completes table names, but didn't with  
  CONCURRENTLY.  
  
- CREATE INDEX completes ON and existing index names, but with  
  CONCURRENTLY it only completed ON.  
  
- CREATE INDEX <name> completes ON, but didn't with CONCURRENTLY.  
  
These are now all fixed.  

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

psql: Fix CREATE INDEX tab completion

commit   : bc56d5898d1cbd9dee6fe16ea7a814a5820b6181    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 10 Jan 2016 11:43:27 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 10 Jan 2016 11:43:27 -0500    

Click here for diff

The previous code supported a syntax like CREATE INDEX name  
CONCURRENTLY, which never existed.  Mistake introduced in commit  
37ec19a15ce452ee94f32ebc3d6a9a45868e82fd.  Remove the addition of  
CONCURRENTLY at that point.  

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

psql: Update tab completion comment

commit   : 70327030095d07abb58f9b3452dc6315a02aff0e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 10 Jan 2016 11:24:51 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 10 Jan 2016 11:24:51 -0500    

Click here for diff

This just updates a comment to match the code.  
  
from Michael Paquier  

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

Add new user fn pg_current_xlog_flush_location()

commit   : e63bb4549a2f47b86de9fc21c9f8b00440f34f99    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 12 Jan 2016 07:54:52 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 12 Jan 2016 07:54:52 +0000    

Click here for diff

Tomas Vondra, reviewed by Michael Paquier and Amit Kapila  
Minor edits by me  

M doc/src/sgml/func.sgml
M src/backend/access/transam/xlogfuncs.c
M src/include/access/xlog_fn.h
M src/include/catalog/pg_proc.h

Maintain local LogwrtResult consistently

commit   : 1e29e6324ca7d52eb751c8d63881d1f7c44e3921    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 12 Jan 2016 07:33:20 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 12 Jan 2016 07:33:20 +0000    

Click here for diff

Teach GetFlushRecPtr() to update LogwrtResult cache as performed by all other  
functions in xlog.c  

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

Remove no-longer-needed old-style check for incompatible plpythons.

commit   : 796d1e889f2b5f88b33a425fdfd08d7906cbd66a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Jan 2016 20:13:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Jan 2016 20:13:31 -0500    

Click here for diff

Commit 866566a690bb9916 introduced a new mechanism for incompatible  
plpythons to detect each other.  I left the old mechanism in place,  
because it seems possible that a plpython predating that commit might be  
used with one postdating it.  (This would require updating plpython3 but  
not plpython2 or vice versa, but that seems well within the realm of  
possibility.)  However, surely it will not be able to happen in 9.6 or  
later, so we can delete the old mechanism in HEAD.  

M src/pl/plpython/plpy_main.c

Use LOAD not actual code execution to pull in plpython library.

commit   : fb6fcbd33fbbd6d31fa2b39938e60ecb48dc4de4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Jan 2016 20:06:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Jan 2016 20:06:36 -0500    

Click here for diff

Commit 866566a690bb9916 is insufficient to prevent dump/reload failures  
when using transform modules in a database with both plpython2 and  
plpython3 installed.  The reason is that the transform extension scripts  
use DO blocks as a mechanism to pull in the libpython library before  
creating the transform function.  It's necessary to preload the library  
because the dynamic loader won't do it for us on every platform, leading  
to "unresolved symbol" failures when the transform library is loaded.  
But it's *not* necessary to execute Python code, and doing so will  
provoke a multiple-Pythons-are-loaded error even after the preceding  
commit.  
  
To fix, use LOAD instead of a DO block.  That requires superuser privilege,  
but creation of a C function does anyway.  It also embeds knowledge of  
the underlying library name for each PL language; but that's wired into  
the initdb-time contents of pg_pltemplate too, so that doesn't seem like  
a large problem either.  Note that CREATE TRANSFORM as such doesn't call  
the language module at all.  
  
Per a report from Paul Jones.  Back-patch to 9.5 where transform modules  
were introduced.  

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

Avoid dump/reload problems when using both plpython2 and plpython3.

commit   : 866566a690bb9916dcd294807e65a6e173396530    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Jan 2016 19:55:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Jan 2016 19:55:39 -0500    

Click here for diff

Commit 803716013dc1350f installed a safeguard against loading plpython2  
and plpython3 at the same time, but asserted that both could still be  
used in the same database, just not in the same session.  However, that's  
not actually all that practical because dumping and reloading will fail  
(since both libraries necessarily get loaded into the restoring session).  
pg_upgrade is even worse, because it checks for missing libraries by  
loading every .so library mentioned in the entire installation into one  
session, so that you can have only one across the whole cluster.  
  
We can improve matters by not throwing the error immediately in _PG_init,  
but only when and if we're asked to do something that requires calling  
into libpython.  This ameliorates both of the above situations, since  
while execution of CREATE LANGUAGE, CREATE FUNCTION, etc will result in  
loading plpython, it isn't asked to do anything interesting (at least  
not if check_function_bodies is off, as it will be during a restore).  
  
It's possible that this opens some corner-case holes in which a crash  
could be provoked with sufficient effort.  However, since plpython  
only exists as an untrusted language, any such crash would require  
superuser privileges, making it "don't do that" not a security issue.  
To reduce the hazards in this area, the error is still FATAL when it  
does get thrown.  
  
Per a report from Paul Jones.  Back-patch to 9.2, which is as far back  
as the patch applies without work.  (It could be made to work in 9.1,  
but given the lack of previous complaints, I'm disinclined to expend  
effort so far back.  We've been pretty desultory about support for  
Python 3 in 9.1 anyway.)  

M src/pl/plpython/plpy_main.c

Remove obsolete comment.

commit   : 950ab82c3d967e6f4cec2a7c8ead2edd5b311518    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 10 Jan 2016 21:35:33 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 10 Jan 2016 21:35:33 -0500    

Click here for diff

Noted while reviewing a question from Dickson S. Guedes.  

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

doc: Fix typo in logical decoding documentation

commit   : c618e1b5067d4a8233f8f403a87fd168fb621a39    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 10 Jan 2016 20:12:27 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 10 Jan 2016 20:12:27 -0500    

Click here for diff

From: Petr Jelinek <[email protected]>  

M doc/src/sgml/logicaldecoding.sgml

Remove a useless PG_GETARG_DATUM() call from jsonb_build_array.

commit   : 820bdccc1be22513e1aaa441d554992a5a2e314f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Jan 2016 17:39:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Jan 2016 17:39:45 -0500    

Click here for diff

This loop uselessly fetched the argument after the one it's currently  
looking at.  No real harm is done since we couldn't possibly fetch off  
the end of memory, but it's confusing to the reader.  
  
Also remove a duplicate (and therefore confusing) PG_ARGISNULL check in  
jsonb_build_object.  
  
I happened to notice these things while trolling for missed null-arg  
checks earlier today.  Back-patch to 9.5, not because there is any  
real bug, but just because 9.5 and HEAD are still in sync in this  
file and we might as well keep them so.  
  
In passing, re-pgindent.  

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

Add some checks on "char"-type columns to type_sanity and opr_sanity.

commit   : 3ef16c46fb3a64c150a3b42c3cc4a8538a12ff3f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Jan 2016 17:20:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Jan 2016 17:20:58 -0500    

Click here for diff

I noticed that the sanity checks in the regression tests omitted to  
check a couple of "poor man's enum" columns that you'd reasonably  
expect them to check.  
  
There are other "char"-type columns in system catalogs that are not  
covered by either type_sanity or opr_sanity, e.g. pg_rewrite.ev_type.  
However, those catalogs are not populated with any manually-created  
data during bootstrap, so it seems less necessary to check them  
this way.  

M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/opr_sanity.sql
M src/test/regress/sql/type_sanity.sql

Clean up some lack-of-STRICT issues in the core code, too.

commit   : 26d538dc93543ed80c315b8313ea4dacd7309ff6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Jan 2016 16:58:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Jan 2016 16:58:32 -0500    

Click here for diff

A scan for missed proisstrict markings in the core code turned up  
these functions:  
  
brin_summarize_new_values  
pg_stat_reset_single_table_counters  
pg_stat_reset_single_function_counters  
pg_create_logical_replication_slot  
pg_create_physical_replication_slot  
pg_drop_replication_slot  
  
The first three of these take OID, so a null argument will normally look  
like a zero to them, resulting in "ERROR: could not open relation with OID  
0" for brin_summarize_new_values, and no action for the pg_stat_reset_XXX  
functions.  The other three will dump core on a null argument, though this  
is mitigated by the fact that they won't do so until after checking that  
the caller is superuser or has rolreplication privilege.  
  
In addition, the pg_logical_slot_get/peek[_binary]_changes family was  
intentionally marked nonstrict, but failed to make nullness checks on all  
the arguments; so again a null-pointer-dereference crash is possible but  
only for superusers and rolreplication users.  
  
Add the missing ARGISNULL checks to the latter functions, and mark the  
former functions as strict in pg_proc.  Make that change in the back  
branches too, even though we can't force initdb there, just so that  
installations initdb'd in future won't have the issue.  Since none of these  
bugs rise to the level of security issues (and indeed the pg_stat_reset_XXX  
functions hardly misbehave at all), it seems sufficient to do this.  
  
In addition, fix some order-of-operations oddities in the slot_get_changes  
family, mostly cosmetic, but not the part that moves the function's last  
few operations into the PG_TRY block.  As it stood, there was significant  
risk for an error to exit without clearing historical information from  
the system caches.  
  
The slot_get_changes bugs go back to 9.4 where that code was introduced.  
Back-patch appropriate subsets of the pg_proc changes into all active  
branches, as well.  

M src/backend/catalog/system_views.sql
M src/backend/replication/logical/logicalfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h

Clean up code for widget_in() and widget_out().

commit   : 1cb63c791c7d070c1bb3cce58885c9697d769cd2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Jan 2016 13:44:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Jan 2016 13:44:27 -0500    

Click here for diff

Given syntactically wrong input, widget_in() could call atof() with an  
indeterminate pointer argument, typically leading to a crash; or if it  
didn't do that, it might return a NULL pointer, which again would lead  
to a crash since old-style C functions aren't supposed to do things  
that way.  Fix that by correcting the off-by-one syntax test and  
throwing a proper error rather than just returning NULL.  
  
Also, since widget_in and widget_out have been marked STRICT for a  
long time, their tests for null inputs are just dead code; remove 'em.  
In the oldest branches, also improve widget_out to use snprintf not  
sprintf, just to be sure.  
  
In passing, get rid of a long-since-useless sprintf into a local buffer  
that nothing further is done with, and make some other minor coding  
style cleanups.  
  
In the intended regression-testing usage of these functions, none of  
this is very significant; but if the regression test database were  
left around in a production installation, these bugs could amount  
to a minor security hazard.  
  
Piotr Stefaniak, Michael Paquier, and Tom Lane  

M src/test/regress/regress.c

Revoke change to rmgr desc of btree vacuum

commit   : b6028426137532afae00188405fdecf7057b208c    
  
author   : Simon Riggs <[email protected]>    
date     : Sat, 9 Jan 2016 18:31:08 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Sat, 9 Jan 2016 18:31:08 +0000    

Click here for diff

Per discussion with Andres Freund  

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

Add STRICT to some C functions created by the regression tests.

commit   : 529baf6a2f3fe85e7e6b4ad3ca38ed4ebffd6bb4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Jan 2016 13:02:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Jan 2016 13:02:54 -0500    

Click here for diff

These functions readily crash when passed a NULL input value.  The tests  
themselves do not pass NULL values to them; but when the regression  
database is used as a basis for fuzz testing, they cause a lot of noise.  
Also, if someone were to leave a regression database lying about in a  
production installation, these would create a minor security hazard.  
  
Andreas Seltenreich  

M src/test/regress/input/create_function_2.source
M src/test/regress/output/create_function_2.source

Avoid pin scan for replay of XLOG_BTREE_VACUUM Replay of XLOG_BTREE_VACUUM during Hot Standby was previously thought to require complex interlocking that matched the requirements on the master. This required an O(N) operation that became a significant problem with large indexes, causing replication delays of seconds or in some cases minutes while the XLOG_BTREE_VACUUM was replayed.

commit   : 687f2cd7a0150647794efe432ae0397cb41b60ff    
  
author   : Simon Riggs <[email protected]>    
date     : Sat, 9 Jan 2016 10:10:08 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Sat, 9 Jan 2016 10:10:08 +0000    

Click here for diff

This commit skips the “pin scan” that was previously required, by observing in  
detail when and how it is safe to do so, with full documentation. The pin scan  
is skipped only in replay; the VACUUM code path on master is not touched here.  
  
The current commit still performs the pin scan for toast indexes, though this  
can also be avoided if we recheck scans on toast indexes. Later patch will  
address this.  
  
No tests included. Manual tests using an additional patch to view WAL records  
and their timing have shown the change in WAL records and their handling has  
successfully reduced replication delay.  

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

Revert "Blind attempt at a Cygwin fix"

commit   : 463172116634423f8708ad9d7afb0f759a40cf2c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 8 Jan 2016 13:18:40 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 8 Jan 2016 13:18:40 -0300    

Click here for diff

This reverts commit e9282e953205a2f3125fc8d1052bc01cb77cd2a3, which blew  
up in a pretty spectacular way.  Re-introduce the original code while we  
search for a real fix.  

M configure
M configure.in
M src/bin/pg_ctl/pg_ctl.c

Blind attempt at a Cygwin fix

commit   : e9282e953205a2f3125fc8d1052bc01cb77cd2a3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 8 Jan 2016 11:48:39 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 8 Jan 2016 11:48:39 -0300    

Click here for diff

Further portability fix for a967613911f7.  Mingw- and MSVC-based builds  
appear to be working fine, but Cygwin needs an extra tweak whereby the  
new win32security.c file is explicitely added to the list of files to  
build in pgport, per Cygwin members brolga and lorikeet.  
  
Author: Michael Paquier  

M configure
M configure.in

Fix typo in comment

commit   : 2650486ebc6fcd32b8f42d6063efc099d00a6708    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 8 Jan 2016 08:54:40 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 8 Jan 2016 08:54:40 +0100    

Click here for diff

Tatsuro Yamada  

M src/include/port/atomics/arch-x86.h

Remove reundand include of TestLib

commit   : c662ef1d03e8e963ae097d40e3eb16d15aef5d00    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 8 Jan 2016 08:53:00 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 8 Jan 2016 08:53:00 +0100    

Click here for diff

Kyotaro HORIGUCHI  

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

Marginal cleanup of GROUPING SETS code in grouping_planner().

commit   : a54676acadcf811f6945db15e81651df96beabc4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Jan 2016 20:32:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Jan 2016 20:32:35 -0500    

Click here for diff

Improve comments and make it a shade less messy.  I think we might want  
to move all of this somewhere else later, but it needs to be more  
readable first.  
  
In passing, re-pgindent the file, affecting some recently-added comments  
concerning parallel query planning.  

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

Delay creation of subplan tlist until after create_plan().

commit   : c44d013835049053d19bc1795f0d169f3d1d6ff0    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Jan 2016 20:23:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Jan 2016 20:23:57 -0500    

Click here for diff

Once upon a time it was necessary for grouping_planner() to determine  
the tlist it wanted from the scan/join plan subtree before it called  
query_planner(), because query_planner() would actually make a Plan using  
that.  But we refactored things a long time ago to delay construction of  
the Plan tree till later, so there's no need to build that tlist until  
(and indeed unless) we're ready to plaster it onto the Plan.  The only  
thing query_planner() cares about is what Vars are going to be needed for  
the tlist, and it can perfectly well get that by looking at the real tlist  
rather than some masticated version.  
  
Well, actually, there is one minor glitch in that argument, which is that  
make_subplanTargetList also adds Vars appearing only in HAVING to the  
tlist it produces.  So now we have to account for HAVING explicitly in  
build_base_rel_tlists.  But that just adds a few lines of code, and  
I doubt it moves the needle much on processing time; we might be doing  
pull_var_clause() twice on the havingQual, but before we had it scanning  
dummy tlist entries instead.  
  
This is a very small down payment on rationalizing grouping_planner  
enough so it can be refactored.  

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

Fix order of arguments to va_start()

commit   : f81c966d2095fdab70a5d81ceb6dd9c89f4acd87    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 Jan 2016 20:32:14 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 Jan 2016 20:32:14 -0300    

Click here for diff

M src/port/win32security.c

Fix unobvious interaction between -X switch and subdirectory creation.

commit   : b41fb65056076b42d64a8690d61fd73dc648645b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Jan 2016 18:20:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Jan 2016 18:20:57 -0500    

Click here for diff

Turns out the only reason initdb -X worked is that pg_mkdir_p won't  
whine if you point it at something that's a symlink to a directory.  
Otherwise, the attempt to create pg_xlog/ just like all the other  
subdirectories would have failed.  Let's be a little more explicit  
about what's happening.  Oversight in my patch for bug #13853  
(mea culpa for not testing -X ...)  

M src/bin/initdb/initdb.c

Add win32security to LIBOBJS

commit   : fa838b555f90039ae5f0e6fb86ccae6a88b42703    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 Jan 2016 18:50:28 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 Jan 2016 18:50:28 -0300    

Click here for diff

This seems to fix Mingw's compile that was broken in a967613911f7e, as  
evidenced by buildfarm.  

M configure
M configure.in

Use plain mkdir() not pg_mkdir_p() to create subdirectories of PGDATA.

commit   : 33b054bc797628e418e379badd38b00e4b523115    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Jan 2016 15:22:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Jan 2016 15:22:01 -0500    

Click here for diff

When we're creating subdirectories of PGDATA during initdb, we know darn  
well that the parent directory exists (or should exist) and that the new  
subdirectory doesn't (or shouldn't).  There is therefore no need to use  
anything more complicated than mkdir().  Using pg_mkdir_p() just opens us  
up to unexpected failure modes, such as the one exhibited in bug #13853  
from Nuri Boardman.  It's not very clear why pg_mkdir_p() went wrong there,  
but it is clear that we didn't need to be trying to create parent  
directories in the first place.  We're not even saving any code, as proven  
by the fact that this patch nets out at minus five lines.  
  
Since this is a response to a field bug report, back-patch to all branches.  

M src/bin/initdb/initdb.c

pgstat: add WAL receiver status view & SRF

commit   : b1a9bad9e744857291c7d5516080527da8219854    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 Jan 2016 16:21:19 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 Jan 2016 16:21:19 -0300    

Click here for diff

This new view provides insight into the state of a running WAL receiver  
in a HOT standby node.  
The information returned includes the PID of the WAL receiver process,  
its status (stopped, starting, streaming, etc), start LSN and TLI, last  
received LSN and TLI, timestamp of last message send and receipt, latest  
end-of-WAL LSN and time, and the name of the slot (if any).  
  
Access to the detailed data is only granted to superusers; others only  
get the PID.  
  
Author: Michael Paquier  
Reviewer: Haribabu Kommi  

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

Remove vestigial CHECK_FOR_INTERRUPTS call.

commit   : 6b1a837f69d00d265bee4b57ba2d320f1463f131    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Jan 2016 11:26:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Jan 2016 11:26:54 -0500    

Click here for diff

Commit e710b65c inserted code in md5_crypt_verify to disable and later  
re-enable interrupts, with a CHECK_FOR_INTERRUPTS call as part of the  
second step, to process any interrupts that had been held off.  Commit  
6647248e removed the interrupt disable/re-enable code, but left behind  
the CHECK_FOR_INTERRUPTS, even though this is now an entirely random,  
pointless place for one.  md5_crypt_verify doesn't run long enough to  
need such a check, and if it did, this would still be the wrong place  
to put one.  

M src/backend/libpq/crypt.c

Provide more detail in postmaster log for password authentication failures.

commit   : 5e0b5dcab685fe2a342385450a29a825cf40cddf    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Jan 2016 11:19:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Jan 2016 11:19:33 -0500    

Click here for diff

We tell people to examine the postmaster log if they're unsure why they are  
getting auth failures, but actually only a few relatively-uncommon failure  
cases were given their own log detail messages in commit 64e43c59b817a78d.  
Expand on that so that every failure case detected within md5_crypt_verify  
gets a specific log detail message.  This should cover pretty much every  
ordinary password auth failure cause.  
  
So far I've not noticed user demand for a similar level of auth detail  
for the other auth methods, but sooner or later somebody might want to  
work on them.  This is not that patch, though.  

M src/backend/libpq/crypt.c

Windows: Make pg_ctl reliably detect service status

commit   : a967613911f7ef7b6387b9e8718f0ab8f0c4d9c8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 Jan 2016 11:59:08 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 Jan 2016 11:59:08 -0300    

Click here for diff

pg_ctl is using isatty() to verify whether the process is running in a  
terminal, and if not it sends its output to Windows' Event Log ... which  
does the wrong thing when the output has been redirected to a pipe, as  
reported in bug #13592.  
  
To fix, make pg_ctl use the code we already have to detect service-ness:  
in the master branch, move src/backend/port/win32/security.c to src/port  
(with suitable tweaks so that it runs properly in backend and frontend  
environments); pg_ctl already has access to pgport so it Just Works.  In  
older branches, that's likely to cause trouble, so instead duplicate the  
required code in pg_ctl.c.  
  
Author: Michael Paquier  
Bug report and diagnosis: Egon Kocjan  
Backpatch: all supported branches  

M src/backend/port/win32/Makefile
M src/bin/pg_ctl/pg_ctl.c
M src/include/port/win32.h
R073 src/backend/port/win32/security.c src/port/win32security.c
M src/tools/msvc/Mkvcbuild.pm

In initdb's post-bootstrap phase, drop temp tables explicitly.

commit   : dad08994b25b8cd2caa83b2e856fcc940d5e515c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Jan 2016 12:25:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Jan 2016 12:25:32 -0500    

Click here for diff

Although these temp tables will get removed from template1 at the end of  
the standalone-backend run, that's too late to keep them from getting  
copied into the template0 and postgres databases, now that we use only a  
single backend run for the whole sequence.  While no real harm is done  
by the extra copies (since they'd be deleted on first use of the temp  
schema), it's still unsightly, and it would mean some wasted cycles for  
every database creation for the life of the installation.  
  
Oversight in commit c4a8812cf64b1426.  Noticed by Amit Langote.  

M src/bin/initdb/initdb.c

Comment typo fix.

commit   : 4bf87169cc1890442aa694f3057e0a0ad60c51f4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Jan 2016 11:06:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Jan 2016 11:06:42 -0500    

Click here for diff

Per Amit Langote.  

M src/backend/catalog/namespace.c

Fix typo in create_transform.sgml.

commit   : 65681d08b4213110a879ce6d65f10de11fe4d3cc    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Wed, 6 Jan 2016 08:01:40 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Wed, 6 Jan 2016 08:01:40 +0900    

Click here for diff

M doc/src/sgml/ref/create_transform.sgml

Add scale(numeric)

commit   : abb1733922f3ff17a514499883a549f8bd03af44    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 5 Jan 2016 19:02:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 5 Jan 2016 19:02:13 -0300    

Click here for diff

Author: Marko Tiikkaja  

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

Remove some ancient and unmaintained encoding-conversion test cruft.

commit   : 419400c5da738d86c87e903a3d1924ff365bf203    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Jan 2016 16:43:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Jan 2016 16:43:40 -0500    

Click here for diff

In commit 921191912c48a68d I claimed that we weren't testing encoding  
conversion functions, but further poking around reveals that we did  
have an equivalent though hard-wired set of tests in conversion.sql.  
AFAICS there is no advantage to doing it like that as compared to letting  
the catalog contents drive the test, so let the opr_sanity addition stand  
and remove the now-redundant tests in conversion.sql.  
  
Also, remove some infrastructure in src/backend/utils/mb/conversion_procs  
for building conversion.sql's list of tests.  That was unmaintained, and  
had not corresponded to the actual contents of conversion.sql since 2007  
or perhaps even further back.  

M src/backend/utils/mb/conversion_procs/Makefile
D src/backend/utils/mb/conversion_procs/regress_epilogue
D src/backend/utils/mb/conversion_procs/regress_prolog
M src/test/regress/expected/conversion.out
M src/test/regress/sql/conversion.sql

Sort $(wildcard) output where needed for reproducible build output.

commit   : 3343ea9e8ea4f552b3f6e5436938f2f0e153b947    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Jan 2016 15:47:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Jan 2016 15:47:05 -0500    

Click here for diff

The order of inclusion of .o files makes a difference in linker output;  
not a functional difference, but still a bitwise difference, which annoys  
some packagers who would like reproducible builds.  
  
Report and patch by Christoph Berg  

M contrib/hstore_plperl/Makefile
M contrib/hstore_plpython/Makefile
M contrib/ltree_plpython/Makefile
M src/bin/pg_xlogdump/Makefile

Make pg_receivexlog silent with 9.3 and older servers

commit   : 4aecd22d3c84c44dd230426bcccd286798ac6b65    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 5 Jan 2016 17:25:12 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 5 Jan 2016 17:25:12 -0300    

Click here for diff

A pointless and confusing error message is shown to the user when  
attempting to identify a 9.3 or older remote server with a 9.5/9.6  
pg_receivexlog, because the return signature of IDENTIFY_SYSTEM was  
changed in 9.4.  There's no good reason for the warning message, so  
shuffle code around to keep it quiet.  
  
(pg_recvlogical is also affected by this commit, but since it obviously  
cannot work with 9.3 that doesn't actually matter much.)  
  
Backpatch to 9.5.  
  
Reported by Marco Nenciarini, who also wrote the initial patch.  Further  
tweaked by Robert Haas and Fujii Masao; reviewed by Michael Paquier and  
Craig Ringer.  

M src/bin/pg_basebackup/streamutil.c

In opr_sanity regression test, check for unexpected uses of cstring.

commit   : 921191912c48a68db81c02c02f3bc22e291d918c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Jan 2016 15:00:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Jan 2016 15:00:54 -0500    

Click here for diff

In light of commit ea0d494dae0d3d6f, it seems like a good idea to add  
a regression test that will complain about random functions taking or  
returning cstring.  Only I/O support functions and encoding conversion  
functions should be declared that way.  
  
While at it, add some checks that encoding conversion functions are  
declared properly.  Since pg_conversion isn't populated manually,  
it's not quite as necessary to check its contents as it is for catalogs  
like pg_proc; but one thing we definitely have not tested in the past  
is whether the identified conproc for a conversion actually does that  
conversion vs. some other one.  

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

Make the to_reg*() functions accept text not cstring.

commit   : ea0d494dae0d3d6fce26bf5d6fbaa07e2ee6c402    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Jan 2016 13:02:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Jan 2016 13:02:43 -0500    

Click here for diff

Using cstring as the input type was a poor decision, because that's not  
really a full-fledged type.  In particular, it lacks implicit coercions  
from text or varchar, meaning that usages like to_regproc('foo'||'bar')  
wouldn't work; basically the only case that did work without explicit  
casting was a simple literal constant argument.  
  
The lack of field complaints about this suggests that hardly anyone  
is using these functions, so hopefully fixing it won't cause much of  
a compatibility problem.  They've only been there since 9.4, anyway.  
  
Petr Korobeinikov  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/regproc.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h

Make pg_shseclabel available in early backend startup

commit   : efa318bcfac132c48dff8196f726e56a6843f06b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 5 Jan 2016 14:50:53 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 5 Jan 2016 14:50:53 -0300    

Click here for diff

While the in-core authentication mechanism doesn't need to access  
pg_shseclabel at all, it's reasonable to think that an authentication  
hook will want to look at the label for the role logging in, or for rows  
in other catalogs used during the authentication phase of startup.  
  
Catalog version bumped, because this changes the "is nailed" status for  
pg_shseclabel.  
  
Author: Adam Brightwell  

M src/backend/utils/cache/relcache.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_shseclabel.h

Add to_regnamespace() and to_regrole() to the documentation.

commit   : 83be1844acdcb0cbff31369a65ec61d588fbe9f3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Jan 2016 12:35:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Jan 2016 12:35:18 -0500    

Click here for diff

Commits cb9fa802b32b222b and 0c90f6769de6a60f added these functions,  
but did not bother with documentation.  

M doc/src/sgml/func.sgml

Convert psql's tab completion for backslash commands to the new style.

commit   : 4f18010af126f126824e01eec2285e6263d98b3d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Jan 2016 12:00:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Jan 2016 12:00:13 -0500    

Click here for diff

This requires adding some more infrastructure to handle both case-sensitive  
and case-insensitive matching, as well as the ability to match a prefix of  
a previous word.  So it ends up being about a wash line-count-wise, but  
it's just as big a readability win here as in the SQL tab completion rules.  
  
Michael Paquier, some adjustments by me  

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

In psql's tab completion, change most TailMatches patterns to Matches.

commit   : 9b181b0363deb65b15a9feaf3eb74f86707498a9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 20:08:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 20:08:08 -0500    

Click here for diff

In the refactoring in commit d37b816dc9e8f976c8913296781e08cbd45c5af1,  
we mostly kept to the original design whereby only the last few words  
on the line were matched to identify a completable pattern.  However,  
after commit d854118c8df8c413d069f7e88bb01b9e18e4c8ed, there's really  
no reason to do it like that: where it's sensible, we can use patterns  
that expect to match the entire input line.  And mostly, it's sensible.  
Matching the entire line greatly reduces the odds of a false match that  
leads to offering irrelevant completions.  Moreover (though I've not  
tried to measure this), it should make tab completion faster since  
many of the patterns will be discarded after a single integer comparison  
that finds that the wrong number of words appear on the line.  
  
There are certain identifiable places where we still need to use  
TailMatches because the statement in question is allowed to appear  
embedded in a larger statement.  These are just a small minority of  
the existing patterns, though, so the benefit of switching where  
possible is large.  
  
It's possible that this patch has removed some within-line matching  
behaviors that are in fact desirable, but we can put those back when  
we get complaints.  Most of the removed behaviors are certainly silly.  
  
Michael Paquier, with some further adjustments by me  

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

Docs: provide a concrete discussion and example for RLS race conditions.

commit   : 7debf36072b3a088b3003aab6dcf57c3f186100d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 15:11:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 15:11:43 -0500    

Click here for diff

Commit 43cd468cf01007f3 added some wording to create_policy.sgml purporting  
to warn users against a race condition of the sort that had been noted some  
time ago by Peter Geoghegan.  However, that warning was far too vague to be  
useful (or at least, I completely failed to grasp what it was on about).  
Since the problem case occurs with a security design pattern that lots of  
people are likely to try to use, we need to be as clear as possible about  
it.  Provide a concrete example in the main-line docs in place of the  
original warning.  

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

Adjust behavior of row_security GUC to match the docs.

commit   : 5d35438273c4523a4dc4b48c3bd575e64310d3d4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 12:21:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 12:21:31 -0500    

Click here for diff

Some time back we agreed that row_security=off should not be a way to  
bypass RLS entirely, but only a way to get an error if it was being  
applied.  However, the code failed to act that way for table owners.  
Per discussion, this is a must-fix bug for 9.5.0.  
  
Adjust the logic in rls.c to behave as expected; also, modify the  
error message to be more consistent with the new interpretation.  
The regression tests need minor corrections as well.  Also update  
the comments about row_security in ddl.sgml to be correct.  (The  
official description of the GUC in config.sgml is already correct.)  
  
I failed to resist the temptation to do some other very minor  
cleanup as well, such as getting rid of a duplicate extern declaration.  

M doc/src/sgml/ddl.sgml
M src/backend/utils/misc/rls.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Fix typo in comment.

commit   : 8978eb03a8dcfafd9e0839bc430749839476c34a    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 4 Jan 2016 10:12:37 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 4 Jan 2016 10:12:37 -0500    

Click here for diff

Masahiko Sawada  

M src/bin/pg_rewind/RewindTest.pm

Fix regrole and regnamespace output functions to do quoting, too.

commit   : b0cadc08fea564f75a0702e15b2bd949377bd2f3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 01:53:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 01:53:24 -0500    

Click here for diff

We discussed this but somehow failed to implement it...  

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

Fix regrole and regnamespace types to honor quoting like other reg* types.

commit   : fb1227af67eae5e97795f7e3563673c6e67d2844    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 01:03:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 01:03:53 -0500    

Click here for diff

Aside from any consistency arguments, this is logically necessary because  
the I/O functions for these types also handle numeric OID values.  Without  
a quoting rule it is impossible to distinguish numeric OIDs from role or  
namespace names that happen to contain only digits.  
  
Also change the to_regrole and to_regnamespace functions to dequote their  
arguments.  While not logically essential, this seems like a good idea  
since the other to_reg* functions do it.  Anyone who really wants raw  
lookup of an uninterpreted name can fall back on the time-honored solution  
of (SELECT oid FROM pg_namespace WHERE nspname = whatever).  
  
Report and patch by Jim Nasby, reviewed by Michael Paquier  

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

Fix bogus lock release in RemovePolicyById and RemoveRoleFromObjectPolicy.

commit   : f47b602df80d7647ca2e71c86f7228b1bf5bf9f3    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 20:53:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 20:53:35 -0500    

Click here for diff

Can't release the AccessExclusiveLock on the target table until commit.  
Otherwise there is a race condition whereby other backends might service  
our cache invalidation signals before they can actually see the updated  
catalog rows.  
  
Just to add insult to injury, RemovePolicyById was closing the rel (with  
incorrect lock drop) and then passing the now-dangling rel pointer to  
CacheInvalidateRelcache.  Probably the reason this doesn't fall over on  
CLOBBER_CACHE buildfarm members is that some outer level of the DROP logic  
is still holding the rel open ... but it'd have bit us on the arse  
eventually, no doubt.  

M src/backend/commands/policy.c

Do some copy-editing on the docs for row-level security.

commit   : c1611db01fec587525e88270854c4b993846dcb3    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 20:04:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 20:04:11 -0500    

Click here for diff

Clarifications, markup improvements, corrections of misleading or  
outright wrong statements.  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_policy.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/drop_policy.sgml

Guard against null arguments in binary_upgrade_create_empty_extension().

commit   : 939d10cd8711fdeb7f0ff62c9c6b08e3eddbba3e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 16:26:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 16:26:38 -0500    

Click here for diff

The CHECK_IS_BINARY_UPGRADE macro is not sufficient security protection  
if we're going to dereference pass-by-reference arguments before it.  
  
But in any case we really need to explicitly check PG_ARGISNULL for all  
the arguments of a non-strict function, not only the ones we expect null  
values for.  
  
Oversight in commits 30982be4e5019684e1772dd9170aaa53f5a8e894 and  
f92fc4c95ddcc25978354a8248d3df22269201bc.  Found by Andreas Seltenreich.  
(The other usages in pg_upgrade_support.c seem safe.)  

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

Do some copy-editing on the docs for replication origins.

commit   : c6aeba353a15d71f584488a7482fb88337f843e3    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 16:03:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 16:03:42 -0500    

Click here for diff

Minor grammar and markup improvements.  

M doc/src/sgml/func.sgml
M doc/src/sgml/replication-origins.sgml

Do a final round of copy-editing on the 9.5 release notes.

commit   : 027989197aab9e555328721b003ebd1839a16704    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 15:33:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 15:33:12 -0500    

Click here for diff

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

Fix treatment of *lpNumberOfBytesRecvd == 0: that's a completion condition.

commit   : 90e61df8130dc7051a108ada1219fb0680cb3eb6    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 13:56:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 13:56:29 -0500    

Click here for diff

pgwin32_recv() has treated a non-error return of zero bytes from WSARecv()  
as being a reason to block ever since the current implementation was  
introduced in commit a4c40f140d23cefb.  However, so far as one can tell  
from Microsoft's documentation, that is just wrong: what it means is  
graceful connection closure (in stream protocols) or receipt of a  
zero-length message (in message protocols), and neither case should result  
in blocking here.  The only reason the code worked at all was that control  
then fell into the retry loop, which did *not* treat zero bytes specially,  
so we'd get out after only wasting some cycles.  But as of 9.5 we do not  
normally reach the retry loop and so the bug is exposed, as reported by  
Shay Rojansky and diagnosed by Andres Freund.  
  
Remove the unnecessary test on the byte count, and rearrange the code  
in the retry loop so that it looks identical to the initial sequence.  
  
Back-patch to 9.5.  The code is wrong all the way back, AFAICS, but  
since it's relatively harmless in earlier branches we'll leave it alone.  

M src/backend/port/win32/socket.c

Teach pg_dump to quote reloption values safely.

commit   : b416c0bb622ce5d33fdbec3bbce00451132f10ec    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 19:04:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 19:04:45 -0500    

Click here for diff

Commit c7e27becd2e6eb93 fixed this on the backend side, but we neglected  
the fact that several code paths in pg_dump were printing reloptions  
values that had not gotten massaged by ruleutils.  Apply essentially the  
same quoting logic in those places, too.  

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

Fix overly-strict assertions in spgtextproc.c.

commit   : 7157fe80f42476db249e062b4f6eef6a3994b234    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 16:24:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 16:24:50 -0500    

Click here for diff

spg_text_inner_consistent is capable of reconstructing an empty string  
to pass down to the next index level; this happens if we have an empty  
string coming in, no prefix, and a dummy node label.  (In practice, what  
is needed to trigger that is insertion of a whole bunch of empty-string  
values.)  Then, we will arrive at the next level with in->level == 0  
and a non-NULL (but zero length) in->reconstructedValue, which is valid  
but the Assert tests weren't expecting it.  
  
Per report from Andreas Seltenreich.  This has no impact in non-Assert  
builds, so should not be a problem in production, but back-patch to  
all affected branches anyway.  
  
In passing, remove a couple of useless variable initializations and  
shorten the code by not duplicating DatumGetPointer() calls.  

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

Adjust back-branch release note description of commits a2a718b22 et al.

commit   : df35af2ca7b5545d32b978a88b665bac2b9fa638    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 15:29:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 15:29:02 -0500    

Click here for diff

As pointed out by Michael Paquier, recovery_min_apply_delay didn't exist  
in 9.0-9.3, making the release note text not very useful.  Instead make it  
talk about recovery_target_xid, which did exist then.  
  
9.0 is already out of support, but we can fix the text in the newer  
branches' copies of its release notes.  

M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml

commit   : de7c8dbea1a17a0e1709c4b12371615d28e21c13    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 14:45:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 14:45:21 -0500    

Click here for diff

The need for this is shown by the files it missed in Bruce's recent run.  
I fixed it so that it will actually adjust the case when needed.  
  
In passing, also make it skip .po files, since those will just get  
overwritten anyway from the translation repository.  

M src/tools/copyright.pl

commit   : 48c9f2889a4ad25a771d13b88f2778a306f2d970    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 14:19:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 14:19:48 -0500    

Click here for diff

On closer inspection, the reason copyright.pl was missing files is  
that it is looking for 'Copyright (c)' and they had 'Copyright (C)'.  
Fix that, and update a couple more that grepping for that revealed.  

M contrib/auth_delay/auth_delay.c
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/test_rls_hooks/test_rls_hooks.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/test_shm_mq/worker.c
M src/test/modules/worker_spi/worker_spi.c

commit   : ad08bf5c8b96c2a3a70d96f5be1c04cb83b4ed6e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 14:08:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 14:08:55 -0500    

Click here for diff

Manually fix some copyright lines missed by the automated script.  

M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/test_rls_hooks/test_rls_hooks.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/worker.c
M src/test/modules/worker_spi/worker_spi.c

commit   : ee943004466418595363d567f18c053bae407792    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 2 Jan 2016 13:33:40 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 2 Jan 2016 13:33:40 -0500    

Click here for diff

Backpatch certain files through 9.1  

M COPYRIGHT
M configure
M configure.in
M contrib/adminpack/adminpack.c
M contrib/auto_explain/auto_explain.c
M contrib/dblink/dblink.c
M contrib/dblink/dblink.h
M contrib/dict_int/dict_int.c
M contrib/dict_xsyn/dict_xsyn.c
M contrib/file_fdw/file_fdw.c
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/intarray/_int_selfuncs.c
M contrib/isn/isn.c
M contrib/isn/isn.h
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/rawpage.c
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/shippable.c
M contrib/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/launcher
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h
M contrib/sepgsql/uavc.c
M contrib/tablefunc/tablefunc.c
M contrib/tablefunc/tablefunc.h
M contrib/tcn/tcn.c
M contrib/test_decoding/test_decoding.c
M contrib/tsearch2/tsearch2.c
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/tsm_system_time.c
M contrib/unaccent/unaccent.c
M contrib/uuid-ossp/uuid-ossp.c
M contrib/vacuumlo/vacuumlo.c
M doc/src/sgml/generate-errcodes-table.pl
M doc/src/sgml/legal.sgml
M doc/src/sgml/lobj.sgml
M src/backend/Makefile
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/scankey.c
M src/backend/access/common/tupconvert.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginlogic.c
M src/backend/access/gin/ginpostinglist.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashscan.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashsort.c
M src/backend/access/hash/hashutil.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/syncscan.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/brindesc.c
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/relmapdesc.c
M src/backend/access/rmgrdesc/replorigindesc.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/tblspcdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c
M src/backend/access/tablesample/tablesample.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/transam.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/twophase_rmgr.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaccess.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/storage.c
M src/backend/catalog/system_views.sql
M src/backend/catalog/toasting.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/discard.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumlazy.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/executor/execAmi.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execJunk.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execQual.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/instrument.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/executor/tstoreReceiver.c
M src/backend/foreign/foreign.c
M src/backend/lib/binaryheap.c
M src/backend/lib/bipartite_match.c
M src/backend/lib/hyperloglog.c
M src/backend/lib/ilist.c
M src/backend/lib/pairingheap.c
M src/backend/lib/rbtree.c
M src/backend/lib/stringinfo.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/backend/libpq/ip.c
M src/backend/libpq/md5.c
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqformat.c
M src/backend/libpq/pqmq.c
M src/backend/libpq/pqsignal.c
M src/backend/main/main.c
M src/backend/nodes/bitmapset.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/list.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/nodes.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/print.c
M src/backend/nodes/read.c
M src/backend/nodes/readfuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/nodes/value.c
M src/backend/optimizer/geqo/geqo_copy.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_misc.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_random.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/prep/prepsecurity.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/check_keywords.pl
M src/backend/parser/gram.y
M src/backend/parser/keywords.c
M src/backend/parser/kwlookup.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/backend/parser/scansup.c
M src/backend/port/atomics.c
M src/backend/port/dynloader/aix.h
M src/backend/port/dynloader/cygwin.h
M src/backend/port/dynloader/freebsd.c
M src/backend/port/dynloader/freebsd.h
M src/backend/port/dynloader/hpux.c
M src/backend/port/dynloader/hpux.h
M src/backend/port/dynloader/linux.c
M src/backend/port/dynloader/linux.h
M src/backend/port/dynloader/netbsd.c
M src/backend/port/dynloader/netbsd.h
M src/backend/port/dynloader/openbsd.c
M src/backend/port/dynloader/openbsd.h
M src/backend/port/dynloader/sco.h
M src/backend/port/dynloader/solaris.h
M src/backend/port/dynloader/unixware.h
M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/port/tas/sunstudio_sparc.s
M src/backend/port/tas/sunstudio_x86.s
M src/backend/port/unix_latch.c
M src/backend/port/win32/crashdump.c
M src/backend/port/win32/mingwcompat.c
M src/backend/port/win32/security.c
M src/backend/port/win32/signal.c
M src/backend/port/win32/socket.c
M src/backend/port/win32/timer.c
M src/backend/port/win32_latch.c
M src/backend/port/win32_sema.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/regex/regc_pg_locale.c
M src/backend/regex/regexport.c
M src/backend/regex/regprefix.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/rewrite/rowsecurity.c
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/snowball.sql.in
M src/backend/snowball/snowball_func.sql.in
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/reinit.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/freespace/indexfsm.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/ipc.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/shm_toc.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/shmqueue.c
M src/backend/storage/ipc/sinval.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/large_object/inv_api.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/s_lock.c
M src/backend/storage/lmgr/spin.c
M src/backend/storage/page/bufpage.c
M src/backend/storage/page/checksum.c
M src/backend/storage/page/itemptr.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/storage/smgr/smgrtype.c
M src/backend/tcop/dest.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/tsearch/Makefile
M src/backend/tsearch/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/regis.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/Gen_dummy_probes.sed
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/bool.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/expandeddatum.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_selfuncs.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/nabstime.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/adt/quote.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/trigfuncs.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsquery_rewrite.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/txid.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/version.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/adt/xid.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/errcodes.txt
M src/backend/utils/error/assert.c
M src/backend/utils/error/elog.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/generate-errcodes.pl
M src/backend/utils/hash/dynahash.c
M src/backend/utils/hash/hashfn.c
M src/backend/utils/hash/pg_crc.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/ucs2utf.pl
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c
M src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
M src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c
M src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
M src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
M src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
M src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c
M src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
M src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
M src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/help_config.c
M src/backend/utils/misc/pg_rusage.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/misc/rls.c
M src/backend/utils/misc/sampling.c
M src/backend/utils/misc/superuser.c
M src/backend/utils/misc/timeout.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/probes.d
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/combocid.c
M src/backend/utils/time/snapmgr.c
M src/backend/utils/time/tqual.c
M src/bin/Makefile
M src/bin/initdb/Makefile
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_config/Makefile
M src/bin/pg_config/pg_config.c
M src/bin/pg_controldata/Makefile
M src/bin/pg_ctl/Makefile
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/keywords.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_resetxlog/Makefile
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/datapagemap.h
M src/bin/pg_rewind/fetch.c
M src/bin/pg_rewind/fetch.h
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/file_ops.h
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/logging.c
M src/bin/pg_rewind/logging.h
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_rewind/timeline.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/page.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/test.sh
M src/bin/pg_upgrade/util.c
M src/bin/pg_upgrade/version.c
M src/bin/pg_xlogdump/compat.c
M src/bin/pg_xlogdump/pg_xlogdump.c
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/pgevent/Makefile
M src/bin/psql/Makefile
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/copy.c
M src/bin/psql/copy.h
M src/bin/psql/create_help.pl
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/help.h
M src/bin/psql/input.c
M src/bin/psql/input.h
M src/bin/psql/large_obj.c
M src/bin/psql/large_obj.h
M src/bin/psql/mainloop.c
M src/bin/psql/mainloop.h
M src/bin/psql/mbprint.c
M src/bin/psql/print.c
M src/bin/psql/print.h
M src/bin/psql/prompt.c
M src/bin/psql/prompt.h
M src/bin/psql/psqlscan.h
M src/bin/psql/psqlscan.l
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/stringutils.c
M src/bin/psql/stringutils.h
M src/bin/psql/tab-complete.c
M src/bin/psql/tab-complete.h
M src/bin/psql/variables.c
M src/bin/psql/variables.h
M src/bin/scripts/Makefile
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createdb.c
M src/bin/scripts/createlang.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/droplang.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/pg_isready.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/common/exec.c
M src/common/fe_memutils.c
M src/common/pg_lzcompress.c
M src/common/pgfnames.c
M src/common/psprintf.c
M src/common/relpath.c
M src/common/restricted_token.c
M src/common/rmtree.c
M src/common/string.c
M src/common/username.c
M src/common/wait_error.c
M src/include/access/attnum.h
M src/include/access/brin.h
M src/include/access/brin_internal.h
M src/include/access/brin_page.h
M src/include/access/brin_pageops.h
M src/include/access/brin_revmap.h
M src/include/access/brin_tuple.h
M src/include/access/brin_xlog.h
M src/include/access/clog.h
M src/include/access/commit_ts.h
M src/include/access/genam.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/hash.h
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/hio.h
M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/parallel.h
M src/include/access/printtup.h
M src/include/access/reloptions.h
M src/include/access/relscan.h
M src/include/access/rewriteheap.h
M src/include/access/rmgrlist.h
M src/include/access/sdir.h
M src/include/access/skey.h
M src/include/access/slru.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/access/stratnum.h
M src/include/access/subtrans.h
M src/include/access/sysattr.h
M src/include/access/timeline.h
M src/include/access/transam.h
M src/include/access/tsmapi.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/tupmacs.h
M src/include/access/tuptoaster.h
M src/include/access/twophase.h
M src/include/access/twophase_rmgr.h
M src/include/access/valid.h
M src/include/access/visibilitymap.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_fn.h
M src/include/access/xlog_internal.h
M src/include/access/xlogdefs.h
M src/include/access/xloginsert.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/access/xlogutils.h
M src/include/bootstrap/bootstrap.h
M src/include/c.h
M src/include/catalog/binary_upgrade.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/genbki.h
M src/include/catalog/heap.h
M src/include/catalog/index.h
M src/include/catalog/indexing.h
M src/include/catalog/namespace.h
M src/include/catalog/objectaccess.h
M src/include/catalog/objectaddress.h
M src/include/catalog/opfam_internal.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_collation_fn.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_conversion_fn.h
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_inherits_fn.h
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_operator_fn.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_proc_fn.h
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.h
M src/include/catalog/pg_type_fn.h
M src/include/catalog/pg_user_mapping.h
M src/include/catalog/storage.h
M src/include/catalog/storage_xlog.h
M src/include/catalog/toasting.h
M src/include/commands/alter.h
M src/include/commands/async.h
M src/include/commands/cluster.h
M src/include/commands/collationcmds.h
M src/include/commands/comment.h
M src/include/commands/conversioncmds.h
M src/include/commands/copy.h
M src/include/commands/createas.h
M src/include/commands/dbcommands.h
M src/include/commands/dbcommands_xlog.h
M src/include/commands/defrem.h
M src/include/commands/discard.h
M src/include/commands/event_trigger.h
M src/include/commands/explain.h
M src/include/commands/extension.h
M src/include/commands/lockcmds.h
M src/include/commands/matview.h
M src/include/commands/policy.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/sequence.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/commands/vacuum.h
M src/include/commands/variable.h
M src/include/commands/view.h
M src/include/common/fe_memutils.h
M src/include/common/relpath.h
M src/include/common/restricted_token.h
M src/include/common/string.h
M src/include/common/username.h
M src/include/datatype/timestamp.h
M src/include/executor/execParallel.h
M src/include/executor/execdebug.h
M src/include/executor/execdesc.h
M src/include/executor/executor.h
M src/include/executor/functions.h
M src/include/executor/hashjoin.h
M src/include/executor/instrument.h
M src/include/executor/nodeAgg.h
M src/include/executor/nodeAppend.h
M src/include/executor/nodeBitmapAnd.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeBitmapIndexscan.h
M src/include/executor/nodeBitmapOr.h
M src/include/executor/nodeCtescan.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/executor/nodeFunctionscan.h
M src/include/executor/nodeGather.h
M src/include/executor/nodeGroup.h
M src/include/executor/nodeHash.h
M src/include/executor/nodeHashjoin.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h
M src/include/executor/nodeLimit.h
M src/include/executor/nodeLockRows.h
M src/include/executor/nodeMaterial.h
M src/include/executor/nodeMergeAppend.h
M src/include/executor/nodeMergejoin.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/nodeNestloop.h
M src/include/executor/nodeRecursiveunion.h
M src/include/executor/nodeResult.h
M src/include/executor/nodeSamplescan.h
M src/include/executor/nodeSeqscan.h
M src/include/executor/nodeSetOp.h
M src/include/executor/nodeSort.h
M src/include/executor/nodeSubplan.h
M src/include/executor/nodeSubqueryscan.h
M src/include/executor/nodeTidscan.h
M src/include/executor/nodeUnique.h
M src/include/executor/nodeValuesscan.h
M src/include/executor/nodeWindowAgg.h
M src/include/executor/nodeWorktablescan.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.h
M src/include/executor/tqueue.h
M src/include/executor/tstoreReceiver.h
M src/include/executor/tuptable.h
M src/include/fmgr.h
M src/include/foreign/fdwapi.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/getaddrinfo.h
M src/include/getopt_long.h
M src/include/lib/binaryheap.h
M src/include/lib/bipartite_match.h
M src/include/lib/hyperloglog.h
M src/include/lib/ilist.h
M src/include/lib/pairingheap.h
M src/include/lib/rbtree.h
M src/include/lib/stringinfo.h
M src/include/libpq/auth.h
M src/include/libpq/be-fsstubs.h
M src/include/libpq/crypt.h
M src/include/libpq/ip.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq-fs.h
M src/include/libpq/libpq.h
M src/include/libpq/md5.h
M src/include/libpq/pqcomm.h
M src/include/libpq/pqformat.h
M src/include/libpq/pqmq.h
M src/include/libpq/pqsignal.h
M src/include/mb/pg_wchar.h
M src/include/miscadmin.h
M src/include/nodes/bitmapset.h
M src/include/nodes/execnodes.h
M src/include/nodes/lockoptions.h
M src/include/nodes/makefuncs.h
M src/include/nodes/memnodes.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/print.h
M src/include/nodes/readfuncs.h
M src/include/nodes/relation.h
M src/include/nodes/replnodes.h
M src/include/nodes/tidbitmap.h
M src/include/nodes/value.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_copy.h
M src/include/optimizer/geqo_gene.h
M src/include/optimizer/geqo_misc.h
M src/include/optimizer/geqo_mutation.h
M src/include/optimizer/geqo_pool.h
M src/include/optimizer/geqo_random.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/orclauses.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/optimizer/predtest.h
M src/include/optimizer/prep.h
M src/include/optimizer/restrictinfo.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/include/optimizer/var.h
M src/include/parser/analyze.h
M src/include/parser/gramparse.h
M src/include/parser/keywords.h
M src/include/parser/kwlist.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_collate.h
M src/include/parser/parse_cte.h
M src/include/parser/parse_expr.h
M src/include/parser/parse_func.h
M src/include/parser/parse_node.h
M src/include/parser/parse_oper.h
M src/include/parser/parse_param.h
M src/include/parser/parse_relation.h
M src/include/parser/parse_target.h
M src/include/parser/parse_type.h
M src/include/parser/parse_utilcmd.h
M src/include/parser/parser.h
M src/include/parser/parsetree.h
M src/include/parser/scanner.h
M src/include/parser/scansup.h
M src/include/pg_config_manual.h
M src/include/pg_getopt.h
M src/include/pg_trace.h
M src/include/pgstat.h
M src/include/pgtar.h
M src/include/pgtime.h
M src/include/port.h
M src/include/port/atomics.h
M src/include/port/atomics/arch-arm.h
M src/include/port/atomics/arch-hppa.h
M src/include/port/atomics/arch-ia64.h
M src/include/port/atomics/arch-ppc.h
M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/fallback.h
M src/include/port/atomics/generic-acc.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic-sunpro.h
M src/include/port/atomics/generic-xlc.h
M src/include/port/atomics/generic.h
M src/include/port/pg_bswap.h
M src/include/port/pg_crc32c.h
M src/include/portability/instr_time.h
M src/include/portability/mem.h
M src/include/postgres.h
M src/include/postgres_fe.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/bgworker.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.h
M src/include/postmaster/fork_process.h
M src/include/postmaster/pgarch.h
M src/include/postmaster/postmaster.h
M src/include/postmaster/startup.h
M src/include/postmaster/syslogger.h
M src/include/postmaster/walwriter.h
M src/include/regex/regexport.h
M src/include/replication/basebackup.h
M src/include/replication/decode.h
M src/include/replication/logical.h
M src/include/replication/logicalfuncs.h
M src/include/replication/origin.h
M src/include/replication/output_plugin.h
M src/include/replication/reorderbuffer.h
M src/include/replication/slot.h
M src/include/replication/snapbuild.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/rewrite/prs2lock.h
M src/include/rewrite/rewriteDefine.h
M src/include/rewrite/rewriteHandler.h
M src/include/rewrite/rewriteManip.h
M src/include/rewrite/rewriteRemove.h
M src/include/rewrite/rewriteSupport.h
M src/include/rewrite/rowsecurity.h
M src/include/rusagestub.h
M src/include/snowball/header.h
M src/include/storage/backendid.h
M src/include/storage/barrier.h
M src/include/storage/block.h
M src/include/storage/buf.h
M src/include/storage/buf_internals.h
M src/include/storage/buffile.h
M src/include/storage/bufmgr.h
M src/include/storage/bufpage.h
M src/include/storage/checksum.h
M src/include/storage/checksum_impl.h
M src/include/storage/copydir.h
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h
M src/include/storage/fd.h
M src/include/storage/freespace.h
M src/include/storage/fsm_internals.h
M src/include/storage/indexfsm.h
M src/include/storage/ipc.h
M src/include/storage/item.h
M src/include/storage/itemid.h
M src/include/storage/itemptr.h
M src/include/storage/large_object.h
M src/include/storage/latch.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/lockdefs.h
M src/include/storage/lwlock.h
M src/include/storage/off.h
M src/include/storage/pg_sema.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/pos.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/procsignal.h
M src/include/storage/reinit.h
M src/include/storage/relfilenode.h
M src/include/storage/s_lock.h
M src/include/storage/shm_mq.h
M src/include/storage/shm_toc.h
M src/include/storage/shmem.h
M src/include/storage/sinval.h
M src/include/storage/sinvaladt.h
M src/include/storage/smgr.h
M src/include/storage/spin.h
M src/include/storage/standby.h
M src/include/tcop/deparse_utility.h
M src/include/tcop/dest.h
M src/include/tcop/fastpath.h
M src/include/tcop/pquery.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/tsearch/dicts/regis.h
M src/include/tsearch/dicts/spell.h
M src/include/tsearch/ts_cache.h
M src/include/tsearch/ts_locale.h
M src/include/tsearch/ts_public.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/aclchk_internal.h
M src/include/utils/array.h
M src/include/utils/arrayaccess.h
M src/include/utils/ascii.h
M src/include/utils/attoptcache.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h
M src/include/utils/catcache.h
M src/include/utils/combocid.h
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/include/utils/datum.h
M src/include/utils/dynahash.h
M src/include/utils/dynamic_loader.h
M src/include/utils/elog.h
M src/include/utils/evtcache.h
M src/include/utils/expandeddatum.h
M src/include/utils/fmgrtab.h
M src/include/utils/formatting.h
M src/include/utils/geo_decls.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/help_config.h
M src/include/utils/hsearch.h
M src/include/utils/inet.h
M src/include/utils/int8.h
M src/include/utils/inval.h
M src/include/utils/json.h
M src/include/utils/jsonapi.h
M src/include/utils/jsonb.h
M src/include/utils/logtape.h
M src/include/utils/lsyscache.h
M src/include/utils/memdebug.h
M src/include/utils/memutils.h
M src/include/utils/nabstime.h
M src/include/utils/numeric.h
M src/include/utils/palloc.h
M src/include/utils/pg_crc.h
M src/include/utils/pg_locale.h
M src/include/utils/pg_lsn.h
M src/include/utils/pg_rusage.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/include/utils/rangetypes.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/relfilenodemap.h
M src/include/utils/relmapper.h
M src/include/utils/reltrigger.h
M src/include/utils/resowner.h
M src/include/utils/resowner_private.h
M src/include/utils/rls.h
M src/include/utils/ruleutils.h
M src/include/utils/sampling.h
M src/include/utils/selfuncs.h
M src/include/utils/snapmgr.h
M src/include/utils/snapshot.h
M src/include/utils/sortsupport.h
M src/include/utils/spccache.h
M src/include/utils/syscache.h
M src/include/utils/timeout.h
M src/include/utils/timestamp.h
M src/include/utils/tqual.h
M src/include/utils/tuplesort.h
M src/include/utils/tuplestore.h
M src/include/utils/typcache.h
M src/include/utils/tzparser.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/xml.h
M src/include/windowapi.h
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/ecpglib/pg_type.h
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/keywords.c
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/libpq-events.c
M src/interfaces/libpq/libpq-events.h
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/libpq.rc.in
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/interfaces/libpq/pthread-win32.c
M src/interfaces/libpq/test/uri-regress.c
M src/interfaces/libpq/win32.c
M src/pl/plperl/plperl.h
M src/pl/plpgsql/src/generate-plerrcodes.pl
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/generate-spiexceptions.pl
M src/pl/plpython/plpython.h
M src/port/chklocale.c
M src/port/dirent.c
M src/port/dirmod.c
M src/port/fls.c
M src/port/fseeko.c
M src/port/getaddrinfo.c
M src/port/getpeereid.c
M src/port/getrusage.c
M src/port/isinf.c
M src/port/kill.c
M src/port/mkdtemp.c
M src/port/noblock.c
M src/port/open.c
M src/port/path.c
M src/port/pg_crc32c_choose.c
M src/port/pg_crc32c_sb8.c
M src/port/pg_crc32c_sse42.c
M src/port/pgcheckdir.c
M src/port/pgsleep.c
M src/port/pgstrcasecmp.c
M src/port/pqsignal.c
M src/port/quotes.c
M src/port/random.c
M src/port/sprompt.c
M src/port/srandom.c
M src/port/strlcpy.c
M src/port/system.c
M src/port/thread.c
M src/port/unsetenv.c
M src/port/win32env.c
M src/port/win32error.c
M src/port/win32setlocale.c
M src/port/win32ver.rc
M src/test/examples/testlo.c
M src/test/examples/testlo64.c
M src/test/isolation/isolation_main.c
M src/test/isolation/isolationtester.h
M src/test/isolation/specparse.y
M src/test/isolation/specscanner.l
M src/test/modules/dummy_seclabel/dummy_seclabel.c
M src/test/modules/test_parser/test_parser.c
M src/test/regress/GNUmakefile
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h
M src/test/regress/pg_regress_main.c
M src/test/regress/regress.c
M src/test/ssl/Makefile
M src/test/thread/Makefile
M src/test/thread/thread_test.c
M src/timezone/pgtz.c
M src/timezone/pgtz.h
M src/tools/check_bison_recursion.pl
M src/tools/copyright.pl
M src/tools/findoidjoins/Makefile
M src/tools/findoidjoins/findoidjoins.c
M src/tools/ifaddrs/Makefile
M src/tools/version_stamp.pl
M src/tools/win32tzlist.pl
M src/tutorial/complex.source
M src/tutorial/syscat.source

Cover heap_page_prune_opt()'s cleanup lock tactic in README.

commit   : dfcd9cb30237f882b7308bdcbfb0318b22b1e224    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 1 Jan 2016 21:52:22 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 1 Jan 2016 21:52:22 -0500    

Click here for diff

Jeff Janes, reviewed by Jim Nasby.  

M src/backend/storage/buffer/README

Teach flatten_reloptions() to quote option values safely.

commit   : c7e27becd2e6eb93b20965b9f22701eaad42a764    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Jan 2016 15:27:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Jan 2016 15:27:53 -0500    

Click here for diff

flatten_reloptions() supposed that it didn't really need to do anything  
beyond inserting commas between reloption array elements.  However, in  
principle the value of a reloption could be nearly anything, since the  
grammar allows a quoted string there.  Any restrictions on it would come  
from validity checking appropriate to the particular option, if any.  
  
A reloption value that isn't a simple identifier or number could thus lead  
to dump/reload failures due to syntax errors in CREATE statements issued  
by pg_dump.  We've gotten away with not worrying about this so far with  
the core-supported reloptions, but extensions might allow reloption values  
that cause trouble, as in bug #13840 from Kouhei Sutou.  
  
To fix, split the reloption array elements explicitly, and then convert  
any value that doesn't look like a safe identifier to a string literal.  
(The details of the quoting rule could be debated, but this way is safe  
and requires little code.)  While we're at it, also quote reloption names  
if they're not safe identifiers; that may not be a likely problem in the  
field, but we might as well try to be bulletproof here.  
  
It's been like this for a long time, so back-patch to all supported  
branches.  
  
Kouhei Sutou, adjusted some by me  

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

Add some more defenses against silly estimates to gincostestimate().

commit   : 3c93a60f6019768f5742b7893a93db93fb67e71f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Jan 2016 13:42:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Jan 2016 13:42:21 -0500    

Click here for diff

A report from Andy Colson showed that gincostestimate() was not being  
nearly paranoid enough about whether to believe the statistics it finds in  
the index metapage.  The problem is that the metapage stats (other than the  
pending-pages count) are only updated by VACUUM, and in the worst case  
could still reflect the index's original empty state even when it has grown  
to many entries.  We attempted to deal with that by scaling up the stats to  
match the current index size, but if nEntries is zero then scaling it up  
still gives zero.  Moreover, the proportion of pages that are entry pages  
vs. data pages vs. pending pages is unlikely to be estimated very well by  
scaling if the index is now orders of magnitude larger than before.  
  
We can improve matters by expanding the use of the rule-of-thumb estimates  
I introduced in commit 7fb008c5ee59b040: if the index has grown by more  
than a cutoff amount (here set at 4X growth) since VACUUM, then use the  
rule-of-thumb numbers instead of scaling.  This might not be exactly right  
but it seems much less likely to produce insane estimates.  
  
I also improved both the scaling estimate and the rule-of-thumb estimate  
to account for numPendingPages, since it's reasonable to expect that that  
is accurate in any case, and certainly pages that are in the pending list  
are not either entry or data pages.  
  
As a somewhat separate issue, adjust the estimation equations that are  
concerned with extra fetches for partial-match searches.  These equations  
suppose that a fraction partialEntries / numEntries of the entry and data  
pages will be visited as a consequence of a partial-match search.  Now,  
it's physically impossible for that fraction to exceed one, but our  
estimate of partialEntries is mostly bunk, and our estimate of numEntries  
isn't exactly gospel either, so we could arrive at a silly value.  In the  
example presented by Andy we were coming out with a value of 100, leading  
to insane cost estimates.  Clamp the fraction to one to avoid that.  
  
Like the previous patch, back-patch to all supported branches; this  
problem can be demonstrated in one form or another in all of them.  

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

Fix comments about WAL rule "write xlog before data" versus pg_multixact.

commit   : 3cd1ba147e5619199914e5b71e0edbd188a763d2    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 1 Jan 2016 01:46:46 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 1 Jan 2016 01:46:46 -0500    

Click here for diff

Recovery does not achieve its goal of zeroing all pg_multixact entries  
whose accompanying WAL records never reached disk.  Remove that claim  
and justify its expendability.  Detail the need for TrimMultiXact(),  
which has little in common with the TrimCLOG() rationale.  Merge two  
tightly-related comments.  Stop presenting pg_multixact as specific to  
heap_lock_tuple(); PostgreSQL 9.3 extended its use to heap_update().  
  
Noticed while investigating a report from Andres Freund.  

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

commit   : 253de19b8414b8b91e0fd710c2b492dc6375f9fa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 31 Dec 2015 22:26:57 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 31 Dec 2015 22:26:57 -0500    

Click here for diff

Empty ulink elements default to displaying the URL, so there is no need  
to specify the URL again.  This was already done for most occurrences,  
but some cases didn't follow this convention.  

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

commit   : 805ac78aaba1c5f71e878c3bc50bec8b82e076bb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 31 Dec 2015 22:03:13 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 31 Dec 2015 22:03:13 -0500    

Click here for diff

M doc/src/sgml/runtime.sgml

Add a comment noting that FDWs don't have to implement EXCEPT or LIMIT TO.

commit   : 5f36096b77fe47015cbac130d1a20d089f202a1e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 31 Dec 2015 17:59:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 31 Dec 2015 17:59:10 -0500    

Click here for diff

postgresImportForeignSchema pays attention to IMPORT's EXCEPT and LIMIT TO  
options, but only as an efficiency hack, not for correctness' sake.  The  
FDW documentation does explain that, but someone using postgres_fdw.c  
as a coding guide might not remember it, so let's add a comment here.  
Per question from Regina Obe.  

M contrib/postgres_fdw/postgres_fdw.c

Fix ALTER OPERATOR to update dependencies properly.

commit   : 0dab5ef39b3d9d86e45bbbb2f6ea60b4f5517d9a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 31 Dec 2015 17:37:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 31 Dec 2015 17:37:31 -0500    

Click here for diff

Fix an oversight in commit 321eed5f0f7563a0: replacing an operator's  
selectivity functions needs to result in a corresponding update in  
pg_depend.  We have a function that can handle that, but it was not  
called by AlterOperator().  
  
To fix this without enlarging pg_operator.h's #include list beyond  
what clients can safely include, split off the function definitions  
into a new file pg_operator_fn.h, similarly to what we've done for  
some other catalog header files.  It's not entirely clear whether  
any client-side code needs to include pg_operator.h, but it seems  
prudent to assume that there is some such code somewhere.  

M src/backend/catalog/pg_operator.c
M src/backend/commands/operatorcmds.c
M src/include/catalog/pg_operator.h
A src/include/catalog/pg_operator_fn.h
M src/test/regress/expected/alter_operator.out
M src/test/regress/sql/alter_operator.sql

Dept of second thoughts: the !scan_all exit mustn't increase scanned_pages.

commit   : e5d06f2b12a7c75f2b0c7fd2055a14efaa2b59ec    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Dec 2015 17:32:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Dec 2015 17:32:23 -0500    

Click here for diff

In the extreme edge case where contended pages are the only ones that  
escape being scanned, the previous commit would have allowed us to think  
that relfrozenxid could be advanced, which is exactly wrong.  

M src/backend/commands/vacuumlazy.c

Avoid useless truncation attempts during VACUUM.

commit   : e842908233bb9c5cea0e765fc828b52badd8228e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Dec 2015 17:13:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Dec 2015 17:13:15 -0500    

Click here for diff

VACUUM can skip heap pages altogether when there's a run of consecutive  
pages that are all-visible according to the visibility map.  This causes it  
to not update its nonempty_pages count, just as if those pages were empty,  
which means that at the end we will think they are candidates for deletion.  
Thus, we may take the table's AccessExclusive lock only to find that no  
pages are really truncatable.  This usually causes no real problems on a  
master server, thanks to the lock being acquired only conditionally; but on  
hot-standby servers, the same lock must be acquired unconditionally which  
can result in unnecessary query cancellations.  
  
To improve matters, force examination of the table's last page whenever  
we reach there with a nonempty_pages count that would allow a truncation  
attempt.  If it's not empty, we'll advance nonempty_pages and thereby  
prevent the truncation attempt.  
  
If we are unable to acquire cleanup lock on that page, there's no need to  
force it, unless we're doing an anti-wraparound vacuum.  We can just check  
for tuples with a shared buffer lock and then give up.  (When we are doing  
an anti-wraparound vacuum, and decide it's okay to skip the page because it  
contains no freezable tuples, this patch still improves matters because  
nonempty_pages is properly updated, which it was not before.)  
  
Since only the last page is special-cased in this way, we might attempt a  
truncation that will release many fewer pages than the normal heuristic  
would suggest; at worst, only one page would be truncated.  But that seems  
all right, because the situation won't repeat during the next vacuum.  
The real problem with the old logic is that the useless truncation attempt  
happens every time we vacuum, so long as the state of the last few dozen  
pages doesn't change.  
  
This is a longstanding deficiency, but since the consequences aren't very  
severe in most scenarios, I'm not going to risk a back-patch.  
  
Jeff Janes and Tom Lane  

M src/backend/commands/vacuumlazy.c

Minor hacking on contrib/cube documentation.

commit   : e5e5267a91f4880c121bf50865cbc38078441989    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Dec 2015 21:21:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Dec 2015 21:21:04 -0500    

Click here for diff

Improve markup, particularly of the table of functions; add or improve  
examples for some of the functions; wordsmith some of the function  
descriptions.  

M doc/src/sgml/cube.sgml

Add some comments about division of labor between rewriter and planner.

commit   : efe4c9d7049f0bf832b792bfad05c92aaf86aa3c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Dec 2015 18:50:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Dec 2015 18:50:35 -0500    

Click here for diff

The rationale for the way targetlist processing is done wasn't clearly  
stated anywhere, and I for one had forgotten some of the details.  Having  
just painfully re-learned them, add some breadcrumbs for the next person.  

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

Put back one copyObject() in rewriteTargetView().

commit   : fd1952575618cacf7afa544d8b89ddb77be9eaee    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Dec 2015 16:45:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Dec 2015 16:45:47 -0500    

Click here for diff

Commit 6f8cb1e23485bd6d tried to centralize rewriteTargetView's copying  
of a target view's Query struct.  However, it ignored the fact that the  
jointree->quals field was used twice.  This only accidentally failed to  
fail immediately because the same ChangeVarNodes mutation is applied in  
both cases, so that we end up with logically identical expression trees  
for both uses (and, as the code stands, the second ChangeVarNodes call  
actually does nothing).  However, we end up linking *physically*  
identical expression trees into both an RTE's securityQuals list and  
the WithCheckOption list.  That's pretty dangerous, mainly because  
prepsecurity.c is utterly cavalier about further munging such structures  
without copying them first.  
  
There may be no live bug in HEAD as a consequence of the fact that we apply  
preprocess_expression in between here and prepsecurity.c, and that will  
make a copy of the tree anyway.  Or it may just be that the regression  
tests happen to not trip over it.  (I noticed this only because things  
fell over pretty badly when I tried to relocate the planner's call of  
expand_security_quals to before expression preprocessing.)  In any case  
it's very fragile because if anyone tried to make the securityQuals and  
WithCheckOption trees diverge before we reach preprocess_expression, it  
would not work.  The fact that the current code will preprocess  
securityQuals and WithCheckOptions lists at completely different times in  
different query levels does nothing to increase my trust that that can't  
happen.  
  
In view of the fact that 9.5.0 is almost upon us and the aforesaid commit  
has seen exactly zero field testing, the prudent course is to make an extra  
copy of the quals so that the behavior is not different from what has been  
in the field during beta.  

M src/backend/rewrite/rewriteHandler.c

Rename (new|old)estCommitTs to (new|old)estCommitTsXid

commit   : 241448b23adf3432988f2b4012ff90a338b4d0bf    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 28 Dec 2015 12:34:11 -0800    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 28 Dec 2015 12:34:11 -0800    

Click here for diff

The variables newestCommitTs and oldestCommitTs sound as if they are  
timestamps, but in fact they are the transaction Ids that correspond  
to the newest and oldest timestamps rather than the actual timestamps.  
Rename these variables to reflect that they are actually xids: to wit  
newestCommitTsXid and oldestCommitTsXid respectively. Also modify  
related code in a similar fashion, particularly the user facing output  
emitted by pg_controldata and pg_resetxlog.  
  
Complaint and patch by me, review by Tom Lane and Alvaro Herrera.  
Backpatch to 9.5 where these variables were first introduced.  

M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/xlog.c
M src/backend/commands/vacuum.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/include/access/commit_ts.h
M src/include/access/transam.h
M src/include/catalog/pg_control.h

Code and docs review for cube kNN support.

commit   : 81ee726d87ec67c4f2846110c99f72e8a20dcd07    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Dec 2015 14:39:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Dec 2015 14:39:09 -0500    

Click here for diff

Commit 33bd250f6c4cc309f4eeb657da80f1e7743b3e5c could have done with  
some more review:  
  
Adjust coding so that compilers unfamiliar with elog/ereport don't complain  
about uninitialized values.  
  
Fix misuse of PG_GETARG_INT16 to retrieve arguments declared as "integer"  
at the SQL level.  (This was evidently copied from cube_ll_coord and  
cube_ur_coord, but those were wrong too.)  
  
Fix non-style-guide-conforming error messages.  
  
Fix underparenthesized if statements, which pgindent would have made a  
hash of, and remove some unnecessary parens elsewhere.  
  
Run pgindent over new code.  
  
Revise documentation: repeated accretion of more operators without any  
rethinking of the text already there had left things in a bit of a mess.  
Merge all the cube operators into one table and adjust surrounding text  
appropriately.  
  
David Rowley and Tom Lane  

M contrib/cube/cube.c
M contrib/cube/expected/cube.out
M contrib/cube/expected/cube_1.out
M contrib/cube/expected/cube_2.out
M contrib/cube/expected/cube_3.out
M doc/src/sgml/cube.sgml

Document brin_summarize_new_pages

commit   : ac443d1034d9888c543ae8147befc51cf4eb7839    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Dec 2015 15:28:19 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Dec 2015 15:28:19 -0300    

Click here for diff

Pointer out by Jeff Janes  

M doc/src/sgml/brin.sgml
M doc/src/sgml/func.sgml

Document the exponentiation operator as associating left to right.

commit   : 54aaafe95f65c95fd9ba085826af87d778c94613    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Dec 2015 12:09:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Dec 2015 12:09:00 -0500    

Click here for diff

Common mathematical convention is that exponentiation associates right to  
left.  We aren't going to change the parser for this, but we could note  
it in the operator's description.  (It's already noted in the operator  
precedence/associativity table, but users might not look there.)  
Per bug #13829 from Henrik Pauli.  

M doc/src/sgml/func.sgml

Fix omission of -X (--no-psqlrc) in some psql invocations.

commit   : 870df2b3b77414a536d6533566628f11f8f309ec    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Dec 2015 11:46:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Dec 2015 11:46:32 -0500    

Click here for diff

As of commit d5563d7df, psql -c no longer implies -X, but not all of  
our regression testing scripts had gotten that memo.  
  
To ensure consistency of results across different developers, make  
sure that *all* invocations of psql in all scripts in our tree  
use -X, even where this is not what previously happened.  
  
Michael Paquier and Tom Lane  

M contrib/sepgsql/test_sepgsql
M src/bin/pg_upgrade/test.sh
M src/test/locale/de_DE.ISO8859-1/runall
M src/test/locale/gr_GR.ISO8859-7/runall
M src/test/locale/koi8-r/runall
M src/test/locale/koi8-to-win1251/runall
M src/test/mb/mbregress.sh
M src/test/ssl/t/001_ssltests.pl
M src/tools/find_static

doc: pg_committs -> pg_commit_ts

commit   : 151c4ffe41a7a6fc76df373e7bfbbb59e8d694d6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Dec 2015 13:45:03 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Dec 2015 13:45:03 -0300    

Click here for diff

Reported by: Alain Laporte (#13836)  

M doc/src/sgml/ref/pg_resetxlog.sgml

Update documentation about pseudo-types.

commit   : 731dfc7d5f07fac2c3c72f47c29a947e363acee9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Dec 2015 11:04:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Dec 2015 11:04:42 -0500    

Click here for diff

Tone down an overly strong statement about which pseudo-types PLs are  
likely to allow.  Add "event_trigger" to the list, as well as  
"pg_ddl_command" in 9.5/HEAD.  Back-patch to 9.3 where event_trigger  
was added.  

M doc/src/sgml/datatype.sgml

Fix translation domain in pg_basebackup

commit   : fc995bfdbfa52ddc50a6737ae4cc37be39215dd8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Dec 2015 10:50:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Dec 2015 10:50:35 -0300    

Click here for diff

For some reason, we've been overlooking the fact that pg_receivexlog  
and pg_recvlogical are using wrong translation domains all along,  
so their output hasn't ever been translated.  The right domain is  
pg_basebackup, not their own executable names.  
  
Noticed by Ioseph Kim, who's been working on the Korean translation.  
  
Backpatch pg_receivexlog to 9.2 and pg_recvlogical to 9.4.  

M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/pg_recvlogical.c

Add forgotten CHECK_FOR_INTERRUPT calls in pgcrypto's crypt()

commit   : 743229a67e24aaee3f671bc5692100fe94c47436    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 27 Dec 2015 13:03:19 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 27 Dec 2015 13:03:19 -0300    

Click here for diff

Both Blowfish and DES implementations of crypt() can take arbitrarily  
long time, depending on the number of rounds specified by the caller;  
make sure they can be interrupted.  
  
Author: Andreas Karlsson  
Reviewer: Jeff Janes  
  
Backpatch to 9.1.  

M contrib/pgcrypto/crypt-blowfish.c
M contrib/pgcrypto/crypt-des.c

Include typmod when complaining about inherited column type mismatches.

commit   : fec1ad94dfc5ddacfda8d249bf4b3c739da8f7a1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Dec 2015 13:41:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Dec 2015 13:41:29 -0500    

Click here for diff

MergeAttributes() rejects cases where columns to be merged have the same  
type but different typmod, which is correct; but the error message it  
printed didn't show either typmod, which is unhelpful.  Changing this  
requires using format_type_with_typemod() in place of TypeNameToString(),  
which will have some minor side effects on the way some type names are  
printed, but on balance this is an improvement: the old code sometimes  
printed one type according to one set of rules and the other type according  
to the other set, which could be confusing in its own way.  
  
Oddly, there were no regression test cases covering any of this behavior,  
so add some.  
  
Complaint and fix by Amit Langote  

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

Fix brin_summarize_new_values() to check index type and ownership.

commit   : 3d2b31e30e2931b3edb5ab9d0eafca13e7bcffe5    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Dec 2015 12:56:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Dec 2015 12:56:09 -0500    

Click here for diff

brin_summarize_new_values() did not check that the passed OID was for  
an index at all, much less that it was a BRIN index, and would fail in  
obscure ways if it wasn't (possibly damaging data first?).  It also  
lacked any permissions test; by analogy to VACUUM, we should only allow  
the table's owner to summarize.  
  
Noted by Jeff Janes, fix by Michael Paquier and me  

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

Improve SECURITY LABEL tab completion

commit   : 8014c44e8275b2fedfc4740c911577c6f1668b56    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 25 Dec 2015 22:56:01 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 25 Dec 2015 22:56:01 +0900    

Click here for diff

Add DATABASE, EVENT TRIGGER, FOREIGN TABLE, ROLE, and TABLESPACE to  
tab completion for SECURITY LABEL.  
  
Kyotaro Horiguchi  

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

Improve the gin index scan performance in pg_trgm.

commit   : 25bfa7efd037a3c44d6a2989d18f55758090e8a9    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 25 Dec 2015 13:05:13 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 25 Dec 2015 13:05:13 +0300    

Click here for diff

Previous coding assumes too pessimistic upper bound of similarity  
in consistent method of GIN.  
  
Author: Fornaroli Christophe with comments by me.  

M contrib/pg_trgm/trgm_gin.c

Remove unnecessary row ordering dependency in pg_rewind test suite.

commit   : a9246fbf665327870370d1088bfc9efdfd2719ec    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Dec 2015 11:38:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Dec 2015 11:38:31 -0500    

Click here for diff

t/002_databases.pl was expecting to see a specific physical order of the  
rows in pg_database.  I broke that in HEAD with commit 01e386a325549b77,  
but I'd say it's a pretty fragile test methodology in any case, so fix  
it in 9.5 as well.  

M src/bin/pg_rewind/t/002_databases.pl

Docs: fix erroneously-given function name.

commit   : 71dd092c0177af14a00bbb18a8aebbed0d389f05    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Dec 2015 10:50:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Dec 2015 10:50:03 -0500    

Click here for diff

pg_replication_session_is_setup() exists nowhere; apparently this is  
meant to refer to pg_replication_origin_session_is_setup().  
  
Adrien Nayrat  

M doc/src/sgml/func.sgml

Fix factual and grammatical errors in comments for struct _tableInfo.

commit   : 96cd61a16958d3a64da697c3ef31eee5e10141a0    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Dec 2015 10:42:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Dec 2015 10:42:58 -0500    

Click here for diff

Amit Langote, further adjusted by me  

M src/bin/pg_dump/pg_dump.h

Docs typo fix.

commit   : bee172fcd586bccd3a3ba067592d639b7600aa04    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Dec 2015 10:23:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Dec 2015 10:23:44 -0500    

Click here for diff

Michael Paquier  

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

Avoid VACUUM FULL altogether in initdb.

commit   : 01e386a325549b7755739f31308de4be8eea110d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Dec 2015 20:09:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Dec 2015 20:09:01 -0500    

Click here for diff

Commit ed7b3b3811c5836a purported to remove initdb's use of VACUUM FULL,  
as had been agreed to in a pghackers discussion back in Dec 2014.  
But it missed this one ...  

M src/bin/initdb/initdb.c

Improve handling of password reuse in src/bin/scripts programs.

commit   : ff402ae11b4d33e0e46c2730f63033d3631b8010    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Dec 2015 15:45:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Dec 2015 15:45:43 -0500    

Click here for diff

This reverts most of commit 83dec5a71 in favor of having connectDatabase()  
store the possibly-reusable password in a static variable, similar to the  
coding we've had for a long time in pg_dump's version of that function.  
To avoid possible problems with unwanted password reuse, make callers  
specify whether it's reasonable to attempt to re-use the password.  
This is a wash for cases where re-use isn't needed, but it is far simpler  
for callers that do want that.  Functionally there should be no difference.  
  
Even though we're past RC1, it seems like a good idea to back-patch this  
into 9.5, like the prior commit.  Otherwise, if there are any third-party  
users of connectDatabase(), they'll have to deal with an API change in  
9.5 and then another one in 9.6.  
  
Michael Paquier  

M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createlang.c
M src/bin/scripts/createuser.c
M src/bin/scripts/droplang.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c

In pg_dump, remember connection passwords no matter how we got them.

commit   : 1aa41e3eae3746e05d0e23286ac740a9a6cee7df    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Dec 2015 14:25:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Dec 2015 14:25:31 -0500    

Click here for diff

When pg_dump prompts the user for a password, it remembers the password  
for possible re-use by parallel worker processes.  However, libpq might  
have extracted the password from a connection string originally passed  
as "dbname".  Since we don't record the original form of dbname but  
break it down to host/port/etc, the password gets lost.  Fix that by  
retrieving the actual password from the PGconn.  
  
(It strikes me that this whole approach is rather broken, as it will also  
lose other information such as options that might have been present in  
the connection string.  But we'll leave that problem for another day.)  
  
In passing, get rid of rather silly use of malloc() for small fixed-size  
arrays.  
  
Back-patch to 9.3 where parallel pg_dump was introduced.  
  
Report and fix by Zeus Kronion, adjusted a bit by Michael Paquier and me  

M src/bin/pg_dump/pg_backup_db.c

Read from the same worker repeatedly until it returns no tuple.

commit   : bc7fcab5e36b9597857fa7e3fa6d9ba54aaea167    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 23 Dec 2015 14:06:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 23 Dec 2015 14:06:52 -0500    

Click here for diff

The original coding read tuples from workers in round-robin fashion,  
but performance testing shows that it works much better to read enough  
to empty one queue before moving on to the next.  I believe the  
reason for this is that, with the old approach, we could easily wake  
up a worker repeatedly to write only one new tuple into the shm_mq  
each time.  With this approach, by the time the process gets scheduled,  
it has a decent chance of being able to fill the entire buffer in  
one go.  
  
Patch by me.  Dilip Kumar helped with performance testing.  

M src/backend/executor/nodeGather.c

Change Gather not to use a physical tlist.

commit   : 51d152f18e124cc07c293756cc16014ba218b2df    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 23 Dec 2015 13:39:42 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 23 Dec 2015 13:39:42 -0500    

Click here for diff

This should have been part of the original commit, but was missed.  
Pushing data between processes is expensive, so we definitely want  
to project away unneeded columns here, just as we do for other nodes  
like Sort and Hash that care about the volume of data.  

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

Remove unnecessary escaping in C character literals

commit   : 30c0c4bf12cc56a7a6c2b7f874e2cd4c95cd3491    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 Dec 2015 22:43:46 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 22 Dec 2015 22:43:46 -0500    

Click here for diff

'\"' is more commonly written simply as '"'.  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/read.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/varlena.c
M src/bin/pg_dump/dumputils.c
M src/interfaces/ecpg/preproc/output.c

Allow omitting one or both boundaries in an array slice specifier.

commit   : 6efbded6e4672c597a6f0dc0f09263e7db7369ff    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 Dec 2015 21:05:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 Dec 2015 21:05:16 -0500    

Click here for diff

Omitted boundaries represent the upper or lower limit of the corresponding  
array subscript.  This allows simpler specification of many common  
use-cases.  
  
(Revised version of commit 9246af6799819847faa33baf441251003acbb8fe)  
  
YUriy Zhuravlev  

M doc/src/sgml/array.sgml
M src/backend/executor/execQual.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_node.c
M src/backend/parser/parse_target.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/utils/array.h
M src/test/regress/expected/arrays.out
M src/test/regress/sql/arrays.sql

Comment improvements for abbreviated keys.

commit   : 0ba3f3bc65f1176250b942e14fd9e4975a5d3913    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 22 Dec 2015 13:57:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 22 Dec 2015 13:57:18 -0500    

Click here for diff

Peter Geoghegan and Robert Haas  

M src/backend/utils/sort/tuplesort.c
M src/include/utils/sortsupport.h

postgres_fdw: Consider requesting sorted data so we can do a merge join.

commit   : ccd8f97922944566d26c7d90eb67ab7848ee9905    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 22 Dec 2015 13:46:40 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 22 Dec 2015 13:46:40 -0500    

Click here for diff

When use_remote_estimate is enabled, consider adding ORDER BY to the  
query we sending to the remote server so that we can use that ordered  
data for a merge join.  Commit f18c944b6137329ac4a6b2dce5745c5dc21a8578  
arranges to push down the query pathkeys, which seems like the case  
mostly likely to be a win, but testing shows this can sometimes win,  
too.  
  
For a regular table, we know which indexes are present and therefore  
test whether the ordering provided by each such index is useful.  Here,  
we take the opposite approach: guess what orderings would be useful if  
they could be generated cheaply, and then ask the remote side what those  
will cost.  
  
Ashutosh Bapat, with very substantial cosmetic revisions by me.  Also  
reviewed by Rushabh Lathia.  

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/optimizer/path/pathkeys.c
M src/include/optimizer/paths.h

Fix calculation of space needed for parsed words in tab completion.

commit   : f5a4370aea3580f5f7f59a77e41fde62f2be12d8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Dec 2015 15:08:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Dec 2015 15:08:56 -0500    

Click here for diff

Yesterday in commit d854118c8, I had a serious brain fade leading me to  
underestimate the number of words that the tab-completion logic could  
divide a line into.  On input such as "(((((", each character will get  
seen as a separate word, which means we do indeed sometimes need more  
space for the words than for the original line.  Fix that.  

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

Make viewquery a copy in rewriteTargetView()

commit   : 6f8cb1e23485bd6d45e8865760436e1a5ce65a6d    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 21 Dec 2015 10:34:14 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 21 Dec 2015 10:34:14 -0500    

Click here for diff

Rather than expect the Query returned by get_view_query() to be  
read-only and then copy bits and pieces of it out, simply copy the  
entire structure when we get it.  This addresses an issue where  
AcquireRewriteLocks, which is called by acquireLocksOnSubLinks(),  
scribbles on the parsetree passed in, which was actually an entry  
in relcache, leading to segfaults with certain view definitions.  
This also future-proofs us a bit for anyone adding more code to this  
path.  
  
The acquireLocksOnSubLinks() was added in commit c3e0ddd40.  
  
Back-patch to 9.3 as that commit was.  

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

Remove silly completion for "DELETE FROM tabname ...".

commit   : 99ccb2309263183f0f3d838b79f3e07ad8cc6a63    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Dec 2015 18:29:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Dec 2015 18:29:51 -0500    

Click here for diff

psql offered USING, WHERE, and SET in this context, but SET is not a valid  
possibility here.  Seems to have been a thinko in commit f5ab0a14ea83eb6c  
which added DELETE's USING option.  

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

Teach psql's tab completion to consider the entire input string.

commit   : d854118c8df8c413d069f7e88bb01b9e18e4c8ed    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Dec 2015 13:28:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Dec 2015 13:28:11 -0500    

Click here for diff

Up to now, the tab completion logic has only examined the last few words  
of the current input line; "last few" being originally as few as four  
words, but lately up to nine words.  Furthermore, it only looked at what  
libreadline considers the current line of input, which made it rather  
myopic if you split your command across lines.  This was tolerable,  
sort of, so long as the match patterns were only designed to consider the  
last few words of input; but with the recent addition of HeadMatches()  
and Matches() matching rules, we really have to do better if we want  
those to behave sanely.  
  
Hence, change the code to break the entire line down into words, and to  
include any previous lines in the command buffer along with the active  
readline input buffer.  
  
This will be a little bit slower than the previous coding, but some  
measurements say that even a query of several thousand characters can be  
parsed in a hundred or so microseconds on modern machines; so it's really  
not going to be significant for interactive tab completion.  To reduce  
the cost some, I arranged to avoid the per-word malloc calls that used  
to occur: all the words are now kept in one malloc'd buffer.  

M src/bin/psql/input.c
M src/bin/psql/input.h
M src/bin/psql/mainloop.c
M src/bin/psql/tab-complete.c
M src/bin/psql/tab-complete.h

psql: Review of new help output strings

commit   : 69e7c44fc66a1d0dcc6021e696d57e200a189888    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 20 Dec 2015 11:50:04 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 20 Dec 2015 11:50:04 -0500    

Click here for diff

M src/bin/psql/describe.c
M src/bin/psql/help.c

Add missing COSTS OFF to EXPLAIN commands in rowsecurity.sql.

commit   : 654218138b819df66c1b90d39a12ca6a75b9ff65    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Dec 2015 16:55:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Dec 2015 16:55:14 -0500    

Click here for diff

Commit e5e11c8cc added a bunch of EXPLAIN statements without COSTS OFF  
to the regression tests.  This is contrary to project policy since it  
results in unnecessary platform dependencies in the output (it's just  
luck that we didn't get buildfarm failures from it).  Per gripe from  
Mike Wilson.  

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

Adopt a more compact, less error-prone notation for tab completion code.

commit   : d37b816dc9e8f976c8913296781e08cbd45c5af1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Dec 2015 16:03:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Dec 2015 16:03:14 -0500    

Click here for diff

Replace tests like  
  
    else if (pg_strcasecmp(prev4_wd, "CREATE") == 0 &&  
             pg_strcasecmp(prev3_wd, "TRIGGER") == 0 &&  
             (pg_strcasecmp(prev_wd, "BEFORE") == 0 ||  
              pg_strcasecmp(prev_wd, "AFTER") == 0))  
  
with new notation like this:  
  
    else if (TailMatches4("CREATE", "TRIGGER", MatchAny, "BEFORE|AFTER"))  
  
In addition, provide some macros COMPLETE_WITH_LISTn() to reduce the amount  
of clutter needed to specify a small number of predetermined completion  
alternatives.  
  
This makes the code substantially more compact: tab-complete.c gets over a  
thousand lines shorter in this patch, despite the addition of a couple of  
hundred lines of infrastructure for the new notations.  The new way of  
specifying match rules seems a whole lot more readable and less  
error-prone, too.  
  
There's a lot more that could be done now to make matching faster and more  
reliable; for example I suspect that most of the TailMatches() rules should  
now be Matches() rules.  That would allow them to be skipped after a single  
integer comparison if there aren't the right number of words on the line,  
and it would reduce the risk of unintended matches.  But for now, (mostly)  
refrain from reworking any match rules in favor of just converting what  
we've got into the new notation.  
  
Thomas Munro, reviewed by Michael Paquier, some adjustments by me  

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

Fix whitespace

commit   : 529fd74c090c6ea4237631522277441bc3ff657f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 19 Dec 2015 11:46:15 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 19 Dec 2015 11:46:15 -0500    

Click here for diff

M contrib/cube/cube–1.0–1.1.sql
M contrib/cube/cube–1.1.sql

Fix tab completion for ALTER ... TABLESPACE ... OWNED BY.

commit   : 130d94a7b868f5b6df512e5fde94a64e5e71178b    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 19 Dec 2015 17:37:11 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 19 Dec 2015 17:37:11 +0100    

Click here for diff

Previously the completion used the wrong word to match 'BY'. This was  
introduced brokenly, in b2de2a. While at it, also add completion of  
IN TABLESPACE ... OWNED BY and fix comments referencing nonexistent  
syntax.  
  
Reported-By: Michael Paquier  
Author: Michael Paquier and Andres Freund  
Discussion: CAB7nPqSHDdSwsJqX0d2XzjqOHr==HdWiubCi4L=Zs7YFTUne8w@mail.gmail.com  
Backpatch: 9.4, like the commit introducing the bug  

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

Revert 9246af6799819847faa33baf441251003acbb8fe because I miss too much. Patch is returned to commitfest process.

commit   : bbbd807097092c7f292872e7da02eee35d67e54b    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 18 Dec 2015 21:35:22 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 18 Dec 2015 21:35:22 +0300    

Click here for diff

M doc/src/sgml/array.sgml
M src/backend/executor/execQual.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_node.c
M src/backend/parser/parse_target.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/arrays.out
M src/test/regress/output/misc.source
M src/test/regress/sql/arrays.sql

pgbench: Change terminology from "threshold" to "parameter".

commit   : 3c7042a7d7871b47dae3c9777c8020e41dedee89    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Dec 2015 13:24:51 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Dec 2015 13:24:51 -0500    

Click here for diff

Per a recommendation from Tomas Vondra, it's more helpful to refer to  
the value that determines how skewed a Gaussian or exponential  
distribution is as a parameter rather than a threshold.  
  
Since it's not quite too late to get this right in 9.5, where it was  
introduced, back-patch this.  Most of the patch changes only comments  
and documentation, but a few pgbench messages are altered to match.  
  
Fabien Coelho, reviewed by Michael Paquier and by me.  

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

Remove duplicate word.

commit   : 6e7b335930200f71115fccd4903d04fe4de42021    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Dec 2015 12:43:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Dec 2015 12:43:52 -0500    

Click here for diff

Kyotaro Horiguchi  

M src/backend/replication/syncrep.c

Fix TupleQueueReaderNext not to ignore its nowait argument.

commit   : 2bdfcb52c5d1446a1f19cc8bf16d44911658bcac    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Dec 2015 12:37:43 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Dec 2015 12:37:43 -0500    

Click here for diff

This was a silly goof on my (rhaas's) part.  
  
Report and fix by Rushabh Lathia.  

M src/backend/executor/tqueue.c

Fix copy-and-paste error in logical decoding callback.

commit   : 4496226782c47e78b428babbcc16dec4f7329f2b    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Dec 2015 12:17:35 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Dec 2015 12:17:35 -0500    

Click here for diff

This could result in the error context misidentifying where the error  
actually occurred.  
  
Craig Ringer  

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

Fix typo in comment.

commit   : 9a51698bae86f748279ecedcae018925b5af5b2d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Dec 2015 12:03:15 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Dec 2015 12:03:15 -0500    

Click here for diff

Amit Langote  

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

Allow to omit boundaries in array subscript

commit   : 9246af6799819847faa33baf441251003acbb8fe    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 18 Dec 2015 15:18:58 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 18 Dec 2015 15:18:58 +0300    

Click here for diff

Allow to omiy lower or upper or both boundaries in array subscript  
for selecting slice of array.  
  
Author: YUriy Zhuravlev  

M doc/src/sgml/array.sgml
M src/backend/executor/execQual.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_node.c
M src/backend/parser/parse_target.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/arrays.out
M src/test/regress/output/misc.source
M src/test/regress/sql/arrays.sql

Cube extension kNN support

commit   : 33bd250f6c4cc309f4eeb657da80f1e7743b3e5c    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 18 Dec 2015 14:38:27 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 18 Dec 2015 14:38:27 +0300    

Click here for diff

Introduce distance operators over cubes:  
<#> taxicab distance  
<->  euclidean distance  
<=> chebyshev distance  
  
Also add kNN support of those distances in GiST opclass.  
  
Author: Stas Kelvich  

M contrib/cube/Makefile
A contrib/cube/cube–1.0–1.1.sql
R084 contrib/cube/cube–1.0.sql contrib/cube/cube–1.1.sql
M contrib/cube/cube.c
M contrib/cube/cube.control
M contrib/cube/cubedata.h
M contrib/cube/expected/cube.out
M contrib/cube/expected/cube_1.out
M contrib/cube/expected/cube_2.out
M contrib/cube/expected/cube_3.out
M contrib/cube/sql/cube.sql
M doc/src/sgml/cube.sgml

Remove unreferenced function declarations.

commit   : 3d0c50ffa0bdb683c28bfe0e79d23d87111da2aa    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Dec 2015 20:21:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Dec 2015 20:21:42 -0500    

Click here for diff

datapagemap_create() and datapagemap_destroy() were declared extern,  
but they don't actually exist anywhere.  Per YUriy Zhuravlev and  
Michael Paquier.  

M src/bin/pg_rewind/datapagemap.h

Use just one standalone-backend session for initdb's post-bootstrap steps.

commit   : c4a8812cf64b142685e39a69694c5276601f40e4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Dec 2015 19:38:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Dec 2015 19:38:21 -0500    

Click here for diff

Previously, each subroutine in initdb fired up its own standalone backend  
session.  Over time we'd grown as many as fifteen of these sessions,  
and the cumulative startup and shutdown work for them was getting pretty  
noticeable.  Combining things so that all these steps share a single  
backend session cuts a good 10% off the total runtime of initdb, more  
if you're not fsync'ing.  
  
The main stumbling block to doing this before was that some of the sessions  
were run with -j and some not.  The improved definition of -j mode  
implemented by my previous commit makes it possible to fix that by running  
all the post-bootstrap steps with -j; we just have to use double instead of  
single newlines to end command strings.  (This is only absolutely necessary  
around the VACUUM and CREATE DATABASE steps, since those can't be run in a  
transaction block.  But it seems best to make them all use double newlines  
so that the commands remain separate for error-reporting purposes.)  
  
A minor disadvantage is that since initdb can't tell how much of its  
output the backend has executed, we can no longer have the per-step  
progress reporting initdb used to print.  But things are fast enough  
nowadays that that's not really all that useful anyway.  
  
In passing, add more const decoration to some of the static arrays in  
initdb.c.  

M src/backend/utils/mb/conversion_procs/Makefile
M src/bin/initdb/initdb.c
M src/tools/msvc/Install.pm

Adjust behavior of single-user -j mode for better initdb error reporting.

commit   : 66d947b9d302f1fd6de3d156e6ec61f52e1dc2cb    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Dec 2015 19:34:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Dec 2015 19:34:15 -0500    

Click here for diff

Previously, -j caused the entire input file to be read in and executed as  
a single command string.  That's undesirable, not least because any error  
causes the entire file to be regurgitated as the "failing query".  Some  
experimentation suggests a better rule: end the command string when we see  
a semicolon immediately followed by two newlines, ie, an empty line after  
a query.  This serves nicely to break up the existing examples such as  
information_schema.sql and system_views.sql.  A limitation is that it's  
no longer possible to write such a sequence within a string literal or  
multiline comment in a file meant to be read with -j; but there are no  
instances of such a problem within the data currently used by initdb.  
(If someone does make such a mistake in future, it'll be obvious because  
they'll get an unterminated-literal or unterminated-comment syntax error.)  
Other than that, there shouldn't be any negative consequences; you're not  
forced to end statements that way, it's just a better idea in most cases.  
  
In passing, remove src/include/tcop/tcopdebug.h, which is dead code  
because it's not included anywhere, and hasn't been for more than  
ten years.  One of the debug-support symbols it purported to describe  
has been unreferenced for at least the same amount of time, and the  
other is removed by this commit on the grounds that it was useless:  
forcing -j mode all the time would have broken initdb.  The lack of  
complaints about that, or about the missing inclusion, shows that  
no one has tried to use TCOP_DONTUSENEWLINE in many years.  

M doc/src/sgml/ref/postgres-ref.sgml
M src/backend/catalog/information_schema.sql
M src/backend/catalog/system_views.sql
M src/backend/snowball/snowball.sql.in
M src/backend/snowball/snowball_func.sql.in
M src/backend/tcop/postgres.c
D src/include/tcop/tcopdebug.h

Fix improper initialization order for readline.

commit   : aee7705be5b75d8e7873a32c4a0dd0afe1ae5928    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Dec 2015 16:55:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Dec 2015 16:55:23 -0500    

Click here for diff

Turns out we must set rl_basic_word_break_characters *before* we call  
rl_initialize() the first time, because it will quietly copy that value  
elsewhere --- but only on the first call.  (Love these undocumented  
dependencies.)  I broke this yesterday in commit 2ec477dc8108339d;  
like that commit, back-patch to all active branches.  Per report from  
Pavel Stehule.  

M src/bin/psql/input.c

Rework internals of changing a type's ownership

commit   : 756e7b4c9db1fa713b886068643257c823baddaf    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 17 Dec 2015 14:25:41 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 17 Dec 2015 14:25:41 -0300    

Click here for diff

This is necessary so that REASSIGN OWNED does the right thing with  
composite types, to wit, that it also alters ownership of the type's  
pg_class entry -- previously, the pg_class entry remained owned by the  
original user, which caused later other failures such as the new owner's  
inability to use ALTER TYPE to rename an attribute of the affected  
composite.  Also, if the original owner is later dropped, the pg_class  
entry becomes owned by a non-existant user which is bogus.  
  
To fix, create a new routine AlterTypeOwner_oid which knows whether to  
pass the request to ATExecChangeOwner or deal with it directly, and use  
that in shdepReassignOwner rather than calling AlterTypeOwnerInternal  
directly.  AlterTypeOwnerInternal is now simpler in that it only  
modifies the pg_type entry and recurses to handle a possible array type;  
higher-level tasks are handled by either AlterTypeOwner directly or  
AlterTypeOwner_oid.  
  
I took the opportunity to add a few more objects to the test rig for  
REASSIGN OWNED, so that more cases are exercised.  Additional ones could  
be added for superuser-only-ownable objects (such as FDWs and event  
triggers) but I didn't want to push my luck by adding a new superuser to  
the tests on a backpatchable bug fix.  
  
Per bug #13666 reported by Chris Pacejo.  
  
Backpatch to 9.5.  
  
(I would back-patch this all the way back, except that it doesn't apply  
cleanly in 9.4 and earlier because 59367fdf9 wasn't backpatched.  If we  
decide that we need this in earlier branches too, we should backpatch  
both.)  

M src/backend/catalog/pg_shdepend.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/include/commands/typecmds.h
M src/test/regress/expected/dependency.out
M src/test/regress/sql/dependency.sql

Cope with Readline's failure to track SIGWINCH events outside of input.

commit   : 2ec477dc8108339dcb6bb944fa93d19cafb6fff7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Dec 2015 16:58:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Dec 2015 16:58:55 -0500    

Click here for diff

It emerges that libreadline doesn't notice terminal window size change  
events unless they occur while collecting input.  This is easy to stumble  
over if you resize the window while using a pager to look at query output,  
but it can be demonstrated without any pager involvement.  The symptom is  
that queries exceeding one line are misdisplayed during subsequent input  
cycles, because libreadline has the wrong idea of the screen dimensions.  
  
The safest, simplest way to fix this is to call rl_reset_screen_size()  
just before calling readline().  That causes an extra ioctl(TIOCGWINSZ)  
for every command; but since it only happens when reading from a tty, the  
performance impact should be negligible.  A more valid objection is that  
this still leaves a tiny window during entry to readline() wherein delivery  
of SIGWINCH will be missed; but the practical consequences of that are  
probably negligible.  In any case, there doesn't seem to be any good way to  
avoid the race, since readline exposes no functions that seem safe to call  
from a generic signal handler --- rl_reset_screen_size() certainly isn't.  
  
It turns out that we also need an explicit rl_initialize() call, else  
rl_reset_screen_size() dumps core when called before the first readline()  
call.  
  
rl_reset_screen_size() is not present in old versions of libreadline,  
so we need a configure test for that.  (rl_initialize() is present at  
least back to readline 4.0, so we won't bother with a test for it.)  
We would need a configure test anyway since libedit's emulation of  
libreadline doesn't currently include such a function.  Fortunately,  
libedit seems not to have any corresponding bug.  
  
Merlin Moncure, adjusted a bit by me  

M configure
M configure.in
M src/bin/psql/input.c
M src/include/pg_config.h.in

Speed up CREATE INDEX CONCURRENTLY's TID sort.

commit   : b648b70342fbe712383e8cd76dc8f7feaba9aaa3    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 16 Dec 2015 15:23:45 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 16 Dec 2015 15:23:45 -0500    

Click here for diff

Encode TIDs as 64-bit integers to speed up comparisons.  This seems to  
speed things up on all platforms, but is even more beneficial when  
8-byte integers are passed by value.  
  
Peter Geoghegan.  Design suggestions and review by Tom Lane.  Review  
also by Simon Riggs and by me.  

M src/backend/catalog/index.c

Mark CHECK constraints declared NOT VALID valid if created with table.

commit   : f27a6b15e6566fba7748d0d9a3fc5bcfd52c4a1b    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 16 Dec 2015 07:43:56 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 16 Dec 2015 07:43:56 -0500    

Click here for diff

FOREIGN KEY constraints have behaved this way for a long time, but for  
some reason the behavior of CHECK constraints has been inconsistent up  
until now.  
  
Amit Langote and Amul Sul, with assorted tweaks by me.  

M src/backend/catalog/heap.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Document use of Subject Alternative Names in SSL server certificates.

commit   : 0625dbb0b96e2ecd557eb5bcdc458679123951db    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Dec 2015 16:57:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Dec 2015 16:57:23 -0500    

Click here for diff

Commit acd08d764 did not bother with updating the documentation.  

M doc/src/sgml/libpq.sgml

Update 9.5 release notes through today.

commit   : bfc7f5dd5dc641b475c27b872d6df21c20c75af1    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Dec 2015 16:42:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Dec 2015 16:42:18 -0500    

Click here for diff

Also do another round of copy-editing, and fix up remaining FIXME items.  

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

Teach mdnblocks() not to create zero-length files.

commit   : 049469e7e7cfe0c69d30385952e2576b63230283    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Dec 2015 13:57:45 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Dec 2015 13:57:45 -0500    

Click here for diff

It's entirely surprising that mdnblocks() has the side effect of  
creating new files on disk, so let's make it not do that.  One  
consequence of the old behavior is that, if running on a damaged  
cluster that is missing a file, mdnblocks() can recreate the file  
and allow a subsequent _mdfd_getseg() for a higher segment to succeed.  
This happens because, while mdnblocks() stops when it finds a segment  
that is shorter than 1GB, _mdfd_getseg() has no such check, and thus  
the empty file created by mdnblocks() can allow it to continue its  
traversal and find higher-numbered segments which remain.  
  
It might be a good idea for _mdfd_getseg() to actually verify that  
each segment it finds is exactly 1GB before proceeding to the next  
one, but that would involve some additional system calls, so for  
now I'm just doing this much.  
  
Patch by me, per off-list analysis by Kevin Grittner and Rahila Syed.  
Review by Andres Freund.  

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

Move buffer I/O and content LWLocks out of the main tranche.

commit   : 6150a1b08a9fe7ead2b25240be46dddeae9d98e1    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Dec 2015 13:32:54 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Dec 2015 13:32:54 -0500    

Click here for diff

Move the content lock directly into the BufferDesc, so that locking and  
pinning a buffer touches only one cache line rather than two.  Adjust  
the definition of BufferDesc slightly so that this doesn't make the  
BufferDesc any larger than one cache line (at least on platforms where  
a spinlock is only 1 or 2 bytes).  
  
We can't fit the I/O locks into the BufferDesc and stay within one  
cache line, so move those to a completely separate tranche.  This  
leaves a relatively limited number of LWLocks in the main tranche, so  
increase the padding of those remaining locks to a full cache line,  
rather than allowing adjacent locks to share a cache line, hopefully  
reducing false sharing.  
  
Performance testing shows that these changes make little difference  
on laptop-class machines, but help significantly on larger servers,  
especially those with more than 2 sockets.  
  
Andres Freund, originally based on an earlier patch by Simon Riggs.  
Review and cosmetic adjustments (including heavy rewriting of the  
comments) by me.  

M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/buf_internals.h
M src/include/storage/lwlock.h
M src/tools/pgindent/typedefs.list

Provide a way to predefine LWLock tranche IDs.

commit   : 3fed417452b226d9bd85a3a54d7056b06eb14897    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Dec 2015 11:32:13 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Dec 2015 11:32:13 -0500    

Click here for diff

It's a bit cumbersome to use LWLockNewTrancheId(), because the returned  
value needs to be shared between backends so that each backend can call  
LWLockRegisterTranche() with the correct ID.  So, for built-in tranches,  
use a hard-coded value instead.  
  
This is motivated by an upcoming patch adding further built-in tranches.  
  
Andres Freund and Robert Haas  

M src/backend/access/transam/xlog.c
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h

Improve CREATE POLICY documentation

commit   : 43cd468cf01007f39312af05c4c92ceb6de8afd8    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 15 Dec 2015 10:08:09 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 15 Dec 2015 10:08:09 -0500    

Click here for diff

Clarify that SELECT policies are now applied when SELECT rights  
are required for a given query, even if the query is an UPDATE or  
DELETE query.  Pointed out by Noah.  
  
Additionally, note the risk regarding concurrently open transactions  
where a relation which controls access to the rows of another relation  
are updated and the rows of the primary relation are also being  
modified.  Pointed out by Peter Geoghegan.  
  
Back-patch to 9.5.  

M doc/src/sgml/ref/create_policy.sgml

Collect the global OR of hasRowSecurity flags for plancache

commit   : e5e11c8cca7ae298895430102217fa6d77cfb2a3    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 14 Dec 2015 20:05:43 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 14 Dec 2015 20:05:43 -0500    

Click here for diff

We carry around information about if a given query has row security or  
not to allow the plancache to use that information to invalidate a  
planned query in the event that the environment changes.  
  
Previously, the flag of one of the subqueries was simply being copied  
into place to indicate if the query overall included RLS components.  
That's wrong as we need the global OR of all subqueries.  Fix by  
changing the code to match how fireRIRules works, which is results  
in OR'ing all of the flags.  
  
Noted by Tom.  
  
Back-patch to 9.5 where RLS was introduced.  

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

Add missing cleanup logic in pg_rewind/t/005_same_timeline.pl test.

commit   : db81329eed6b1f54bbdd9049bcdba556f2b4737d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Dec 2015 19:22:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Dec 2015 19:22:50 -0500    

Click here for diff

Per Michael Paquier  

M src/bin/pg_rewind/t/005_same_timeline.pl

Add missing CHECK_FOR_INTERRUPTS in lseg_inside_poly

commit   : 0d8f3d5d11f7304c82ce1383bbb491ec6abcffc4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 14 Dec 2015 16:44:40 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 14 Dec 2015 16:44:40 -0300    

Click here for diff

Apparently, there are bugs in this code that cause it to loop endlessly.  
That bug still needs more research, but in the meantime it's clear that  
the loop is missing a check for interrupts so that it can be cancelled  
timely.  
  
Backpatch to 9.1 -- this has been missing since 49475aab8d0d.  

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

Remove xmlparse(document '') test

commit   : e2f1765ce0770e813971336bb4603099d24cbe57    
  
author   : Kevin Grittner <[email protected]>    
date     : Mon, 14 Dec 2015 11:37:26 -0600    
  
committer: Kevin Grittner <[email protected]>    
date     : Mon, 14 Dec 2015 11:37:26 -0600    

Click here for diff

This one test was behaving differently between the ubuntu fix for  
CVE-2015-7499 and the base "expected" file.  It's not worth having  
yet another version of the expected file for this test, so drop it.  
Perhaps at some point when all distros have settled down to the  
same behavior on this test, it can be restored.  
  
Problem found by me on libxml2 (2.9.1+dfsg1-3ubuntu4.6).  
Solution suggested by Tom Lane.  
Backpatch to 9.5, where the test was added.  

M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xml_2.out
M src/test/regress/sql/xml.sql

Fix out-of-memory error handling in ParameterDescription message processing.

commit   : 7b96bf445a42b1cb2a435854f9825c38253f79a2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 14 Dec 2015 18:19:10 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 14 Dec 2015 18:19:10 +0200    

Click here for diff

If libpq ran out of memory while constructing the result set, it would hang,  
waiting for more data from the server, which might never arrive. To fix,  
distinguish between out-of-memory error and not-enough-data cases, and give  
a proper error message back to the client on OOM.  
  
There are still similar issues in handling COPY start messages, but let's  
handle that as a separate patch.  
  
Michael Paquier, Amit Kapila and me. Backpatch to all supported versions.  

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

Fix bug in SetOffsetVacuumLimit() triggered by find_multixact_start() failure.

commit   : cca705a5d93446e1a9c775b94c7d5900986c0488    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 14 Dec 2015 11:34:16 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 14 Dec 2015 11:34:16 +0100    

Click here for diff

Previously, if find_multixact_start() failed, SetOffsetVacuumLimit() would  
install 0 into MultiXactState->offsetStopLimit if it previously succeeded.  
Luckily, there are no known cases where find_multixact_start() will return  
an error in 9.5 and above. But if it were to happen, for example due to  
filesystem permission issues, it'd be somewhat bad: GetNewMultiXactId()  
could continue allocating mxids even if close to a wraparound, or it could  
erroneously stop allocating mxids, even if no wraparound is looming.  The  
wrong value would be corrected the next time SetOffsetVacuumLimit() is  
called, or by a restart.  
  
Reported-By: Noah Misch, although this is not his preferred fix  
Discussion: [email protected]  
Backpatch: 9.5, where the bug was introduced as part of 4f627f  

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

Correct statement to actually be the intended assert statement.

commit   : 2a3544960eaa114d34e5e83ab19e180c8efcd299    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 14 Dec 2015 11:23:24 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 14 Dec 2015 11:23:24 +0100    

Click here for diff

e3f4cfc7 introduced a LWLockHeldByMe() call, without the corresponding  
Assert() surrounding it.  
  
Spotted by Coverity.  
  
Backpatch: 9.1+, like the previous commit  

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

Docs: document that psql's "\i -" means read from stdin.

commit   : 7bd149ce2aa6af8910604eb45cc202798f563781    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Dec 2015 23:42:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Dec 2015 23:42:54 -0500    

Click here for diff

This has worked that way for a long time, maybe always, but you would  
not have known it from the documentation.  Also back-patch the notes  
I added to HEAD earlier today about behavior of the "-f -" switch,  
which likewise have been valid for many releases.  

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

Code and docs review for multiple -c and -f options in psql.

commit   : fcbbf82d2b6caf7b156f2ec35b322e23caf1e99e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Dec 2015 14:52:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Dec 2015 14:52:07 -0500    

Click here for diff

Commit d5563d7df94488bf drew complaints from Coverity, which quite  
correctly complained that one copy of each -c or -f string was being  
leaked.  What's more, simple_action_list_append was allocating enough space  
for still a third copy of each string as part of the SimpleActionListCell,  
even though that coding method had been superseded by a separate strdup  
operation.  There were some other minor coding infelicities too.  The  
documentation needed more work as well, eg it forgot to explain that -c  
causes psql not to accept any interactive input.  

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

Consistently set all fields in pg_stat_replication to null instead of 0

commit   : a91bdf67c49ade2bdf6474607b64f9f0083db4a6    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 13 Dec 2015 16:53:38 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 13 Dec 2015 16:53:38 +0100    

Click here for diff

Previously the "sent" field would be set to 0 and all other xlog  
pointers be set to NULL if there were no valid values (such as when  
in a backup sending walsender).  

M src/backend/replication/walsender.c

Properly initialize write, flush and replay locations in walsender slots

commit   : 263c19572bd4947b4cf977d61db11b74b1745570    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 13 Dec 2015 16:40:37 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 13 Dec 2015 16:40:37 +0100    

Click here for diff

These would leak random xlog positions if a walsender used for backup would  
a walsender slot previously used by a replication walsender.  
  
In passing also fix a couple of cases where the xlog pointer is directly  
compared to zero instead of using XLogRecPtrIsInvalid, noted by  
Michael Paquier.  

M src/backend/replication/walsender.c

Doc: update external URLs for PostGIS project.

commit   : 6d96cd077bedcf822db7348bc564b44df8b2ab23    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 12 Dec 2015 20:02:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 12 Dec 2015 20:02:09 -0500    

Click here for diff

Paul Ramsey  

M doc/src/sgml/earthdistance.sgml
M doc/src/sgml/external-projects.sgml
M doc/src/sgml/release-8.4.sgml

doc: Add some markup

commit   : 19e7ca893808f5415f9024930c56e2c4b9c16b0b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 12 Dec 2015 11:31:28 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 12 Dec 2015 11:31:28 -0500    

Click here for diff

M doc/src/sgml/monitoring.sgml

Fix ALTER TABLE ... SET TABLESPACE for unlogged relations.

commit   : f54d0629ec8bc17de932c83fc9872c31bb8da68f    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 12 Dec 2015 14:12:35 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 12 Dec 2015 14:12:35 +0100    

Click here for diff

Changing the tablespace of an unlogged relation did not WAL log the  
creation and content of the init fork. Thus, after a standby is  
promoted, unlogged relation cannot be accessed anymore, with errors  
like:  
ERROR:  58P01: could not open file "pg_tblspc/...": No such file or directory  
Additionally the init fork was not synced to disk, independent of the  
configured wal_level, a relatively small durability risk.  
  
Investigation of that problem also brought to light that, even for  
permanent relations, the creation of !main forks was not WAL logged,  
i.e. no XLOG_SMGR_CREATE record were emitted. That mostly turns out not  
to be a problem, because these files were created when the actual  
relation data is copied; nonexistent files are not treated as an error  
condition during replay. But that doesn't work for empty files, and  
generally feels a bit haphazard. Luckily, outside init and main forks,  
empty forks don't occur often or are not a problem.  
  
Add the required WAL logging and syncing to disk.  
  
Reported-By: Michael Paquier  
Author: Michael Paquier and Andres Freund  
Discussion: [email protected]  
Backpatch: 9.1, where unlogged relations were introduced  

M src/backend/commands/tablecmds.c

Add an expected-file to match behavior of latest libxml2.

commit   : 085423e3e326da1b52f41aa86126f2a064a7db25    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 19:08:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 19:08:40 -0500    

Click here for diff

Recent releases of libxml2 do not provide error context reports for errors  
detected at the very end of the input string.  This appears to be a bug, or  
at least an infelicity, introduced by the fix for libxml2's CVE-2015-7499.  
We can hope that this behavioral change will get undone before too long;  
but the security patch is likely to spread a lot faster/further than any  
follow-on cleanup, which means this behavior is likely to be present in the  
wild for some time to come.  As a stopgap, add a variant regression test  
expected-file that matches what you get with a libxml2 that acts this way.  

A src/test/regress/expected/xml_2.out

pg_rewind: Don't error if the two clusters are already on the same timeline

commit   : 6b34e5563849edc12896bf5754e8fe7b88012697    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 3 Dec 2015 22:21:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 3 Dec 2015 22:21:16 -0500    

Click here for diff

This previously resulted in an error and a nonzero exit status, but  
after discussion this should rather be a noop with a zero exit status.  

M src/bin/pg_rewind/pg_rewind.c
A src/bin/pg_rewind/t/005_same_timeline.pl

For REASSIGN OWNED for foreign user mappings

commit   : 8c1615531f4945e5af78ddf1d43af11b6d7b48fd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 11 Dec 2015 18:39:09 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 11 Dec 2015 18:39:09 -0300    

Click here for diff

As reported in bug #13809 by Alexander Ashurkov, the code for REASSIGN  
OWNED hadn't gotten word about user mappings.  Deal with them in the  
same way default ACLs do, which is to ignore them altogether; they are  
handled just fine by DROP OWNED.  The other foreign object cases are  
already handled correctly by both commands.  
  
Also add a REASSIGN OWNED statement to foreign_data test to exercise the  
foreign data objects.  (The changes are just before the "cleanup" phase,  
so it shouldn't remove any existing live test.)  
  
Reported by Alexander Ashurkov, then independently by Jaime Casanova.  

M src/backend/catalog/pg_shdepend.c
M src/test/regress/expected/foreign_data.out
M src/test/regress/sql/foreign_data.sql

Install our "missing" script where PGXS builds can find it.

commit   : dccf8e9e608824ce15d3b2d7ee63afbf1147c5e9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 16:14:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 16:14:27 -0500    

Click here for diff

This allows sane behavior in a PGXS build done on a machine where build  
tools such as bison are missing.  
  
Jim Nasby  

M config/Makefile

Handle policies during DROP OWNED BY

commit   : 833728d4c8832f1d37e7aeaa723c8bc4045df32e    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 11 Dec 2015 16:12:25 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 11 Dec 2015 16:12:25 -0500    

Click here for diff

DROP OWNED BY handled GRANT-based ACLs but was not removing roles from  
policies.  Fix that by having DROP OWNED BY remove the role specified  
from the list of roles the policy (or policies) apply to, or the entire  
policy (or policies) if it only applied to the role specified.  
  
As with ACLs, the DROP OWNED BY caller must have permission to modify  
the policy or a WARNING is thrown and no change is made to the policy.  

M src/backend/catalog/pg_shdepend.c
M src/backend/commands/policy.c
M src/include/commands/policy.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Get rid of the planner's LateralJoinInfo data structure.

commit   : 4fcf48450d38e28e69e629c779a7866183d8ea41    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 15:52:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 15:52:16 -0500    

Click here for diff

I originally modeled this data structure on SpecialJoinInfo, but after  
commit acfcd45cacb6df23 that looks like a pretty poor decision.  
All we really need is relid sets identifying laterally-referenced rels;  
and most of the time, what we want to know about includes indirect lateral  
references, a case the LateralJoinInfo data was unsuited to compute with  
any efficiency.  The previous commit redefined RelOptInfo.lateral_relids  
as the transitive closure of lateral references, so that it easily supports  
checking indirect references.  For the places where we really do want just  
direct references, add a new RelOptInfo field direct_lateral_relids, which  
is easily set up as a copy of lateral_relids before we perform the  
transitive closure calculation.  Then we can just drop lateral_info_list  
and LateralJoinInfo and the supporting code.  This makes the planner's  
handling of lateral references noticeably more efficient, and shorter too.  
  
Such a change can't be back-patched into stable branches for fear of  
breaking extensions that might be looking at the planner's data structures;  
but it seems not too late to push it into 9.5, so I've done so.  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/var.c
M src/backend/rewrite/rewriteManip.c
M src/include/nodes/nodes.h
M src/include/nodes/relation.h

Handle dependencies properly in ALTER POLICY

commit   : ed8bec915ec570bd90d86710392fe0c181fd08fe    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 11 Dec 2015 15:43:03 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 11 Dec 2015 15:43:03 -0500    

Click here for diff

ALTER POLICY hadn't fully considered partial policy alternation  
(eg: change just the roles on the policy, or just change one of  
the expressions) when rebuilding the dependencies.  Instead, it  
would happily remove all dependencies which existed for the  
policy and then only recreate the dependencies for the objects  
referred to in the specific ALTER POLICY command.  
  
Correct that by extracting and building the dependencies for all  
objects referenced by the policy, regardless of if they were  
provided as part of the ALTER POLICY command or were already in  
place as part of the pre-existing policy.  

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

Still more fixes for planner's handling of LATERAL references.

commit   : acfcd45cacb6df23edba4cb3753a2be594238a99    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 14:22:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 14:22:20 -0500    

Click here for diff

More fuzz testing by Andreas Seltenreich exposed that the planner did not  
cope well with chains of lateral references.  If relation X references Y  
laterally, and Y references Z laterally, then we will have to scan X on the  
inside of a nestloop with Z, so for all intents and purposes X is laterally  
dependent on Z too.  The planner did not understand this and would generate  
intermediate joins that could not be used.  While that was usually harmless  
except for wasting some planning cycles, under the right circumstances it  
would lead to "failed to build any N-way joins" or "could not devise a  
query plan" planner failures.  
  
To fix that, convert the existing per-relation lateral_relids and  
lateral_referencers relid sets into their transitive closures; that is,  
they now show all relations on which a rel is directly or indirectly  
laterally dependent.  This not only fixes the chained-reference problem  
but allows some of the relevant tests to be made substantially simpler  
and faster, since they can be reduced to simple bitmap manipulations  
instead of searches of the LateralJoinInfo list.  
  
Also, when a PlaceHolderVar that is due to be evaluated at a join contains  
lateral references, we should treat those references as indirect lateral  
dependencies of each of the join's base relations.  This prevents us from  
trying to join any individual base relations to the lateral reference  
source before the join is formed, which again cannot work.  
  
Andreas' testing also exposed another oversight in the "dangerous  
PlaceHolderVar" test added in commit 85e5e222b1dd02f1.  Simply rejecting  
unsafe join paths in joinpath.c is insufficient, because in some cases  
we will end up rejecting *all* possible paths for a particular join, again  
leading to "could not devise a query plan" failures.  The restriction has  
to be known also to join_is_legal and its cohort functions, so that they  
will not select a join for which that will happen.  I chose to move the  
supporting logic into joinrels.c where the latter functions are.  
  
Back-patch to 9.3 where LATERAL support was introduced.  

M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Fix commit timestamp initialization

commit   : 69e7235c93e2965cc0e17186bd044e4c54997c19    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 11 Dec 2015 14:30:43 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 11 Dec 2015 14:30:43 -0300    

Click here for diff

This module needs explicit initialization in order to replay WAL records  
in recovery, but we had broken this recently following changes to make  
other (stranger) scenarios work correctly.  To fix, rework the  
initialization sequence so that it always takes place before WAL replay  
commences for both master and standby.  
  
I could have gone for a more localized fix that just added a "startup"  
call for the master server, but it seemed better to restructure the  
existing callers as well so that the whole thing made more sense.  As a  
drawback, there is more control logic in xlog.c now than previously, but  
doing otherwise meant passing down the ControlFile flag, which seemed  
uglier as a whole.  
  
This also meant adding a check to not re-execute ActivateCommitTs if it  
had already been called.  
  
Reported by Fujii Masao.  
  
Backpatch to 9.5.  

M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/xlog.c
M src/include/access/commit_ts.h

Improve some messages

commit   : a351705d8a7fbbc98c2449786d2ddfa845f21b6a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Dec 2015 22:05:27 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Dec 2015 22:05:27 -0500    

Click here for diff

M src/backend/access/transam/commit_ts.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/policy.c
M src/backend/commands/user.c
M src/backend/executor/nodeCustom.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/object_address.out

Improve ALTER POLICY tab completion.

commit   : 8b469bd7c4dc3649c74b746545210b435df319cb    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 10 Dec 2015 12:28:46 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 10 Dec 2015 12:28:46 -0500    

Click here for diff

Complete "ALTER POLICY" with a policy name, as we do for DROP POLICY.  
And, complete "ALTER POLICY polname ON" with a table name that has such  
a policy, as we do for DROP POLICY, rather than with any table name  
at all.  
  
Masahiko Sawada  

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

Fix typo.

commit   : 348bcd864530b4860d0fd0ffe8532f590a5779f7    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 10 Dec 2015 11:13:24 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 10 Dec 2015 11:13:24 -0500    

Click here for diff

Etsuro Fujita  

M doc/src/sgml/fdwhandler.sgml

Fix ON CONFLICT UPDATE bug breaking AFTER UPDATE triggers.

commit   : 84ac126ee728ede5b6370d60dd2b1c299f49ed2f    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 10 Dec 2015 16:26:45 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 10 Dec 2015 16:26:45 +0100    

Click here for diff

ExecOnConflictUpdate() passed t_ctid of the to-be-updated tuple to  
ExecUpdate(). That's problematic primarily because of two reason: First  
and foremost t_ctid could point to a different tuple. Secondly, and  
that's what triggered the complaint by Stanislav, t_ctid is changed by  
heap_update() to point to the new tuple version.  The behavior of AFTER  
UPDATE triggers was therefore broken, with NEW.* and OLD.* tuples  
spuriously identical within AFTER UPDATE triggers.  
  
To fix both issues, pass a pointer to t_self of a on-stack HeapTuple  
instead.  
  
Fixing this bug lead to one change in regression tests, which previously  
failed due to the first issue mentioned above. There's a reasonable  
expectation that test fails, as it updates one row repeatedly within one  
INSERT ... ON CONFLICT statement. That is only possible if the second  
update is triggered via ON CONFLICT ... SET, ON CONFLICT ... WHERE, or  
by a WITH CHECK expression, as those are executed after  
ExecOnConflictUpdate() does a visibility check. That could easily be  
prohibited, but given it's allowed for plain UPDATEs and a rare corner  
case, it doesn't seem worthwhile.  
  
Reported-By: Stanislav Grozev  
Author: Andres Freund and Peter Geoghegan  
Discussion: CAA78GVqy1+LisN-8DygekD_Ldfy=BJLarSpjGhytOsgkpMavfQ@mail.gmail.com  
Backpatch: 9.5, where ON CONFLICT was introduced  

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

Fix bug leading to restoring unlogged relations from empty files.

commit   : e3f4cfc7aa33f40b2b283676c9f0d5bf7ef08ccd    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 10 Dec 2015 16:25:12 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 10 Dec 2015 16:25:12 +0100    

Click here for diff

At the end of crash recovery, unlogged relations are reset to the empty  
state, using their init fork as the template. The init fork is copied to  
the main fork without going through shared buffers. Unfortunately WAL  
replay so far has not necessarily flushed writes from shared buffers to  
disk at that point. In normal crash recovery, and before the  
introduction of 'fast promotions' in fd4ced523 / 9.3, the  
END_OF_RECOVERY checkpoint flushes the buffers out in time. But with  
fast promotions that's not the case anymore.  
  
To fix, force WAL writes targeting the init fork to be flushed  
immediately (using the new FlushOneBuffer() function). In 9.5+ that  
flush can centrally be triggered from the code dealing with restoring  
full page writes (XLogReadBufferForRedoExtended), in earlier releases  
that responsibility is in the hands of XLOG_HEAP_NEWPAGE's replay  
function.  
  
Backpatch to 9.1, even if this currently is only known to trigger in  
9.3+. Flushing earlier is more robust, and it is advantageous to keep  
the branches similar.  
  
Typical symptoms of this bug are errors like  
'ERROR:  index "..." contains unexpected zero page at block 0'  
shortly after promoting a node.  
  
Reported-By: Thom Brown  
Author: Andres Freund and Michael Paquier  
Discussion: [email protected]  
Backpatch: 9.1-  

M src/backend/access/transam/xlogutils.c
M src/backend/storage/buffer/bufmgr.c
M src/include/storage/bufmgr.h

Accept flex > 2.5.x on Windows, too.

commit   : 9c779c49e39372c21214ad2dc5864dd78caee82d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Dec 2015 10:19:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Dec 2015 10:19:13 -0500    

Click here for diff

Commit 32f15d05c fixed this in configure, but missed the similar check  
in the MSVC scripts.  
  
Michael Paquier, per report from Victor Wagner  

M src/tools/msvc/pgflex.pl

Remove redundant sentence.

commit   : c00239ea6a0612cd7d1cd604ffc5b6f73ef9fb09    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 9 Dec 2015 14:11:58 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 9 Dec 2015 14:11:58 -0500    

Click here for diff

Peter Geoghegan  

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

Allow EXPLAIN (ANALYZE, VERBOSE) to display per-worker statistics.

commit   : b287df70e4080350aa471ecca428be145581dd4d    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 9 Dec 2015 13:18:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 9 Dec 2015 13:18:09 -0500    

Click here for diff

The original parallel sequential scan commit included only very limited  
changes to the EXPLAIN output.  Aggregated totals from all workers were  
displayed, but there was no way to see what each individual worker did  
or to distinguish the effort made by the workers from the effort made by  
the leader.  
  
Per a gripe by Thom Brown (and maybe others).  Patch by me, reviewed  
by Amit Kapila.  

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

Improve performance in freeing memory contexts

commit   : 25c539233044c235e97fd7c9dc600fb5f08fe065    
  
author   : Kevin Grittner <[email protected]>    
date     : Tue, 8 Dec 2015 17:32:49 -0600    
  
committer: Kevin Grittner <[email protected]>    
date     : Tue, 8 Dec 2015 17:32:49 -0600    

Click here for diff

The single linked list of memory contexts could result in O(N^2)  
performance to free a set of contexts if they were not freed in  
reverse order of creation.  In many cases the reverse order was  
used, but there were some significant exceptions that caused real-  
world performance problems.  Rather than requiring all callers to  
care about the order in which contexts were freed, and hunting down  
and changing all existing cases where the wrong order was used, we  
add one pointer per memory context so that the implementation  
details are not so visible.  
  
Jan Wieck  

M src/backend/utils/mmgr/mcxt.c
M src/include/nodes/memnodes.h

Make failure to open psql's --log-file fatal.

commit   : 521f0458dcd7bb28636250cdfce9b1a3020cff4c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Dec 2015 17:14:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Dec 2015 17:14:46 -0500    

Click here for diff

Commit 344cdff2c made failure to open the target of --output fatal.  
For consistency, the --log-file switch should behave similarly.  
Like the previous commit, back-patch to 9.5 but no further.  
  
Daniel Verite  

M src/bin/psql/startup.c

Avoid odd portability problem in TestLib.pm's slurp_file function.

commit   : 938d797b84467ebbaed432da72d1d7f7bb266110    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Dec 2015 16:58:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Dec 2015 16:58:05 -0500    

Click here for diff

For unclear reasons, this function doesn't always read the expected data  
in some old Perl versions.  Rewriting it to avoid use of ARGV seems to  
dodge the problem, and this version is clearer anyway if you ask me.  
  
In passing, also improve error message in adjacent append_to_file function.  

M src/test/perl/TestLib.pm

psql: Support multiple -c and -f options, and allow mixing them.

commit   : d5563d7df94488bf0ab52ac0678e8a07e5b8297e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Dec 2015 14:04:08 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Dec 2015 14:04:08 -0500    

Click here for diff

To support this, we must reconcile some historical anomalies in the  
behavior of -c.  In particular, as a backward-incompatibility, -c no  
longer implies --no-psqlrc.  
  
Pavel Stehule (code) and Catalin Iacob (documentation).  Review by  
Michael Paquier and myself.  Proposed behavior per Tom Lane.  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/startup.c
M src/test/perl/PostgresNode.pm

Allow foreign and custom joins to handle EvalPlanQual rechecks.

commit   : 385f337c9f39b21dca96ca4770552a10a6d5af24    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Dec 2015 12:31:03 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Dec 2015 12:31:03 -0500    

Click here for diff

Commit e7cb7ee14555cc9c5773e2c102efd6371f6f2005 provided basic  
infrastructure for allowing a foreign data wrapper or custom scan  
provider to replace a join of one or more tables with a scan.  
However, this infrastructure failed to take into account the need  
for possible EvalPlanQual rechecks, and ExecScanFetch would fail  
an assertion (or just overwrite memory) if such a check was attempted  
for a plan containing a pushed-down join.  To fix, adjust the EPQ  
machinery to skip some processing steps when scanrelid == 0, making  
those the responsibility of scan's recheck method, which also has  
the responsibility in this case of correctly populating the relevant  
slot.  
  
To allow foreign scans to gain control in the right place to make  
use of this new facility, add a new, optional RecheckForeignScan  
method.  Also, allow a foreign scan to have a child plan, which can  
be used to correctly populate the slot (or perhaps for something  
else, but this is the only use currently envisioned).  
  
KaiGai Kohei, reviewed by Robert Haas, Etsuro Fujita, and Kyotaro  
Horiguchi.  

M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/fdwhandler.sgml
M src/backend/executor/execScan.c
M src/backend/executor/nodeForeignscan.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/include/foreign/fdwapi.h
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/planmain.h

commit   : edca44b1525b3d591263d032dc4fe500ea771e0e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Dec 2015 18:56:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Dec 2015 18:56:14 -0500    

Click here for diff

While convincing myself that commit 7e19db0c09719d79 would solve both of  
the problems recently reported by Andreas Seltenreich, I realized that  
add_paths_to_joinrel's handling of LATERAL restrictions could be made  
noticeably simpler and faster if we were to retain the minimum possible  
parameterization for each joinrel (that is, the set of relids supplying  
unsatisfied lateral references in it).  We already retain that for  
baserels, in RelOptInfo.lateral_relids, so we can use that field for  
joinrels too.  
  
I re-pgindent'd the files touched here, which affects some unrelated  
comments.  
  
This is, I believe, just a minor optimization not a bug fix, so no  
back-patch.  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/relation.h

PostgresNode: wrap correctly around port number range end

commit   : 7ac5d9b31637b1856c7ac9cb625bcca694a2790a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 7 Dec 2015 20:06:21 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 7 Dec 2015 20:06:21 -0300    

Click here for diff

Per note from Tom Lane  

M src/test/perl/PostgresNode.pm

Fix another oversight in checking if a join with LATERAL refs is legal.

commit   : 7e19db0c09719d7919a8fdd96a1fffe7efd2df93    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Dec 2015 17:41:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Dec 2015 17:41:45 -0500    

Click here for diff

It was possible for the planner to decide to join a LATERAL subquery to  
the outer side of an outer join before the outer join itself is completed.  
Normally that's fine because of the associativity rules, but it doesn't  
work if the subquery contains a lateral reference to the inner side of the  
outer join.  In such a situation the outer join *must* be done first.  
join_is_legal() missed this consideration and would allow the join to be  
attempted, but the actual path-building code correctly decided that no  
valid join path could be made, sometimes leading to planner errors such as  
"failed to build any N-way joins".  
  
Per report from Andreas Seltenreich.  Back-patch to 9.3 where LATERAL  
support was added.  

M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/util/relnode.c
M src/include/optimizer/pathnode.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Cleanup some problems in new Perl test code

commit   : 9821492ee417a5910a60f3d1f2ed24c062eab4e0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 7 Dec 2015 19:25:31 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 7 Dec 2015 19:25:31 -0300    

Click here for diff

Noted by Tom Lane:  
- PostgresNode had a BEGIN block which created files, contrary to  
  perlmod suggestions to do that only on INIT blocks.  
- Assign ports randomly rather than starting from 90600.  
  
Noted by Noah Misch:  
- Change use of no-longer-set PGPORT environment variable to $node->port  
- Don't start a server in pg_controldata test  
- PostgresNode was reading the PID file incorrectly; test the right  
  thing, and chomp the line we read from the PID file.  
- Remove an unused $devnull variable  
- Use 'pg_ctl kill' instead of "kill" directly, for Windos portability.  
- Make server log names more informative.  
  
Author: Michael Paquier  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/test/perl/PostgresNode.pm

Update xindex.sgml for recent additions to GIST opclass API.

commit   : b0cfb02cec9650492365c6a9eca2dfce3671096d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Dec 2015 12:42:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Dec 2015 12:42:32 -0500    

Click here for diff

Commit d04c8ed9044ec added another support function to the GIST API,  
but overlooked mentioning it in xindex.sgml's summary of index support  
functions.  
  
Anastasia Lubennikova  

M doc/src/sgml/xindex.sgml

Create TestLib.pm's tempdir underneath tmp_check/, not out in the open.

commit   : db0723631ef1460e9e795c6d13abb19da403a3f1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Dec 2015 13:23:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Dec 2015 13:23:48 -0500    

Click here for diff

This way, existing .gitignore entries and makefile clean actions will  
automatically apply to the tempdir, should it survive a TAP test run  
(which can happen if the user control-C's out of the run, for example).  
  
Michael Paquier, per a complaint from me  

M src/test/perl/TestLib.pm

Instruct Coverity using an assertion.

commit   : d4b686af0b8ff2d2557b4fec7e5938abb9249167    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 5 Dec 2015 03:04:17 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 5 Dec 2015 03:04:17 -0500    

Click here for diff

This should make Coverity deduce that plperl_call_perl_func() does not  
dereference NULL argtypes.  Back-patch to 9.5, where the affected code  
was introduced.  
  
Michael Paquier  

M src/pl/plperl/plperl.c

Further improve documentation of the role-dropping process.

commit   : 63acfb79ab53d3833ad035728fb67a6c3018778f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Dec 2015 14:44:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Dec 2015 14:44:13 -0500    

Click here for diff

In commit 1ea0c73c2 I added a section to user-manag.sgml about how to drop  
roles that own objects; but as pointed out by Stephen Frost, I neglected  
that shared objects (databases or tablespaces) may need special treatment.  
Fix that.  Back-patch to supported versions, like the previous patch.  

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

Further tweak commit_timestamp behavior

commit   : 820ddb2c2f162ef1b086d870e9da0702834b6f32    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 3 Dec 2015 19:22:31 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 3 Dec 2015 19:22:31 -0300    

Click here for diff

As pointed out by Fujii Masao, we weren't quite there on a standby  
behaving sanely: first because we were failing to acquire the correct  
state in the case where no XLOG_PARAMETER_CHANGE message was sent  
(because a checkpoint had already happened after the setting was changed  
in the master, and then the standby was restarted); and second because  
promoting the standby with the feature enabled failed to activate it if  
the master had the feature disabled.  
  
This patch fixes both those misbehaviors hopefully without  
re-introducing any old problems.  
  
Also change the hint emitted in a standby together with the error  
message about the feature being disabled, to make it point out that the  
place to chance the setting is the master.  Otherwise, if the setting is  
already enabled in the standby, it is very confusing to have it say that  
the setting must be enabled ...  
  
Authors: Álvaro Herrera, Petr Jelínek.  
Backpatch to 9.5.  

M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/xlog.c
M src/include/access/commit_ts.h

Clean up some psql issues around handling of the query output file.

commit   : 344cdff2c1541e7a1249299a33723aabeafa0b0c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Dec 2015 14:28:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Dec 2015 14:28:58 -0500    

Click here for diff

Formerly, if "psql -o foo" failed to open the output file "foo", it would  
print an error message but then carry on as though -o had not been  
specified at all.  This seems contrary to expectation: a program that  
cannot open its output file normally fails altogether.  Make psql do  
exit(1) after reporting the error.  
  
If "\o foo" failed to open "foo", it would print an error message but then  
reset the output file to stdout, as if the argument had been omitted.  
This is likewise pretty surprising behavior.  Make it keep the previous  
output state, instead.  
  
psql keeps SIGPIPE interrupts disabled when it is writing to a pipe, either  
a pipe specified by -o/\o or a transient pipe opened for purposes such as  
using a pager on query output.  The logic for this was too simple and could  
sometimes re-enable SIGPIPE when a -o pipe was still active, thus possibly  
leading to an unexpected psql crash later.  
  
Fixing the last point required getting rid of the kluge in PrintQueryTuples  
and ExecQueryUsingCursor whereby they'd transiently change the global  
queryFout state, but that seems like good cleanup anyway.  
  
Back-patch to 9.5 but not further; these are minor-enough issues that  
changing the behavior in stable branches doesn't seem appropriate.  

M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/copy.c
M src/bin/psql/print.c
M src/bin/psql/print.h
M src/bin/psql/startup.c

doc: Add serial comma

commit   : f15b820a5c60b10f3ac1b2fdb37d534ecb0a4bf8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 3 Dec 2015 10:24:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 3 Dec 2015 10:24:16 -0500    

Click here for diff

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

psql: Improve spelling

commit   : 77a7bb3da2479833c200a96b028fbfbe4312a201    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 3 Dec 2015 10:23:59 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 3 Dec 2015 10:23:59 -0500    

Click here for diff

M src/bin/psql/command.c

doc: Fix markup and improve placeholder names

commit   : 9ff1a11a2d9797f5d48fc1994faa40f738ba9b7e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 3 Dec 2015 10:20:54 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 3 Dec 2015 10:20:54 -0500    

Click here for diff

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

Fix broken subroutine call in TestLib

commit   : a2983cfd9d64d352c68431010b2525daf2b8bc79    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 2 Dec 2015 23:16:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 2 Dec 2015 23:16:22 -0300    

Click here for diff

Michael Paquier  

M src/test/perl/TestLib.pm

Fix behavior of printTable() and friends with externally-invoked pager.

commit   : d8ff060ecd5fc2dd20021743518d376a11a0bfd8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Dec 2015 18:20:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Dec 2015 18:20:33 -0500    

Click here for diff

The formatting modes that depend on knowledge of the terminal window width  
did not work right when printing a query result that's been fetched in  
sections (as a result of FETCH_SIZE).  ExecQueryUsingCursor() would force  
use of the pager as soon as there's more than one result section, and then  
print.c would see an output file pointer that's not stdout and incorrectly  
conclude that the terminal window width isn't relevant.  
  
This has been broken all along for non-expanded "wrapped" output format,  
and as of 9.5 the issue affects expanded mode as well.  The problem also  
caused "\pset expanded auto" mode to invariably *not* switch to expanded  
output in a segmented result, which seems to me to be exactly backwards.  
  
To fix, we need to pass down an "is_pager" flag to inform the print.c  
subroutines that some calling level has already replaced stdout with a  
pager pipe, so they should (a) not do that again and (b) nonetheless honor  
the window size.  (Notably, this makes the first is_pager test in  
print_aligned_text() not be dead code anymore.)  
  
This patch is a bit invasive because there are so many existing calls of  
printQuery()/printTable(), but fortunately all but a couple can just pass  
"false" for the added parameter.  
  
Back-patch to 9.5 but no further.  Given the lack of field complaints,  
it's not clear that we should change the behavior in stable branches.  
Also, the API change for printQuery()/printTable() might possibly break  
third-party code, again something we don't like to do in stable branches.  
However, it's not quite too late to do this in 9.5, and with the larger  
scope of the problem there, it seems worth doing.  

M src/bin/psql/common.c
M src/bin/psql/describe.c
M src/bin/psql/large_obj.c
M src/bin/psql/print.c
M src/bin/psql/print.h
M src/bin/scripts/createlang.c
M src/bin/scripts/droplang.c

Refactor Perl test code

commit   : 1caef31d9e550408d0cbc5788a422dcb69736df5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 2 Dec 2015 18:46:16 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 2 Dec 2015 18:46:16 -0300    

Click here for diff

The original code was a bit clunky; make it more amenable for further  
reuse by creating a new Perl package PostgresNode, which is an  
object-oriented representation of a single server, with some support  
routines such as init, start, stop, psql.  This serves as a better basis  
on which to build further test code, and enables writing tests that use  
more than one server without too much complication.  
  
This commit modifies a lot of the existing test files, mostly to remove  
explicit calls to system commands (pg_ctl) replacing them with method  
calls of a PostgresNode object.  The result is quite a bit more  
straightforward.  
  
Also move some initialization code to BEGIN and INIT blocks instead of  
having it straight in as top-level code.  
  
This commit also introduces package RecursiveCopy so that we can copy  
whole directories without having to depend on packages that may not be  
present on vanilla Perl 5.8 installations.  
  
I also ran perltidy on the modified files, which changes some code sites  
that are not otherwise touched by this patch.  I tried to avoid this,  
but it ended up being more trouble than it's worth.  
  
Authors: Michael Paquier, Álvaro Herrera  
Review: Noah Misch  

M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/011_clusterdb_all.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/030_createlang.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/050_dropdb.pl
M src/bin/scripts/t/060_droplang.pl
M src/bin/scripts/t/070_dropuser.pl
M src/bin/scripts/t/080_pg_isready.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/091_reindexdb_all.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/t/101_vacuumdb_all.pl
M src/bin/scripts/t/102_vacuumdb_stages.pl
A src/test/perl/PostgresNode.pm
A src/test/perl/RecursiveCopy.pm
M src/test/perl/TestLib.pm
M src/test/ssl/ServerSetup.pm
M src/test/ssl/t/001_ssltests.pl

Add handling for GatherPath to print_path.

commit   : c7485a82c3e29103757db75bb9ff8dac597387dc    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 2 Dec 2015 08:19:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 2 Dec 2015 08:19:50 -0500    

Click here for diff

Peter Geoghegan  

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

Make gincostestimate() cope with hypothetical GIN indexes.

commit   : 7fb008c5ee59b04005a8ee6c1006249f729e2b03    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 16:24:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 16:24:34 -0500    

Click here for diff

We tried to fetch statistics data from the index metapage, which does not  
work if the index isn't actually present.  If the index is hypothetical,  
instead extrapolate some plausible internal statistics based on the index  
page count provided by the index-advisor plugin.  
  
There was already some code in gincostestimate() to invent internal stats  
in this way, but since it was only meant as a stopgap for pre-9.1 GIN  
indexes that hadn't been vacuumed since upgrading, it was pretty crude.  
If we want it to support index advisors, we should try a little harder.  
A small amount of testing says that it's better to estimate the entry pages  
as 90% of the index, not 100%.  Also, estimating the number of entries  
(keys) as equal to the heap tuple count could be wildly wrong in either  
direction.  Instead, let's estimate 100 entries per entry page.  
  
Perhaps someday somebody will want the index advisor to be able to provide  
these numbers more directly, but for the moment this should serve.  
  
Problem report and initial patch by Julien Rouhaud; modified by me to  
invent less-bogus internal statistics.  Back-patch to all supported  
branches, since we've supported index advisors since 9.0.  

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

Further tweaking of print_aligned_vertical().

commit   : 95708e1d8e38bc1f7f6ee02c38dd86dd53b9663c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 14:47:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 14:47:13 -0500    

Click here for diff

Don't force the data width to extend all the way to the right margin if it  
doesn't need to.  This reverts the behavior in non-wrapping cases to be  
what it was in 9.4.  Also, make the logic that ensures the data line width  
is at least equal to the record-header line width a little less obscure.  
  
In passing, avoid possible calculation of log10(0).  Probably that's  
harmless, given the lack of field complaints, but it seems risky:  
conversion of NaN to an integer isn't well defined.  

M src/bin/psql/print.c
M src/test/regress/expected/psql.out

Use "g" not "f" format in ecpg's PGTYPESnumeric_from_double().

commit   : db4a5cfc76206db82d0b929d96c53de229ef1aa4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 11:42:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 11:42:25 -0500    

Click here for diff

The previous coding could overrun the provided buffer size for a very large  
input, or lose precision for a very small input.  Adopt the methodology  
that's been in use in the equivalent backend code for a long time.  
  
Per private report from Bas van Schaik.  Back-patch to all supported  
branches.  

M src/interfaces/ecpg/pgtypeslib/numeric.c

Further adjustment to psql's print_aligned_vertical() function.

commit   : 2287b874546931e2f33cddcafff2bde58459da1b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 11:07:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 11:07:29 -0500    

Click here for diff

We should ignore output_columns unless it's greater than zero.  
A zero means we couldn't get any information from ioctl(TIOCGWINSZ);  
in that case the expected behavior is to print the data at native width,  
not to wrap it at the smallest possible value.  print_aligned_text()  
gets this consideration right, but print_aligned_vertical() lost track  
of this detail somewhere along the line.  

M src/bin/psql/print.c

Use pg_rewind when target timeline was switched

commit   : e50cda78404d6400b1326a996a4fabb144871151    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 1 Dec 2015 18:56:44 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 1 Dec 2015 18:56:44 +0300    

Click here for diff

Allow pg_rewind to work when target timeline was switched. Now  
user can return promoted standby to old master.  
  
Target timeline history becomes a global variable. Index  
in target timeline history is used in function interfaces instead of  
specifying TLI directly. Thus, SimpleXLogPageRead() can easily start  
reading XLOGs from next timeline when current timeline ends.  
  
Author: Alexander Korotkov  
Review: Michael Paquier  

M doc/src/sgml/ref/pg_rewind.sgml
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h

Rework wrap-width calculation in psql's print_aligned_vertical() function.

commit   : 0e0776bc99553ff229e0d536ed8c78ab9db62464    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Nov 2015 17:53:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Nov 2015 17:53:32 -0500    

Click here for diff

This area was rather heavily whacked around in 6513633b9 and follow-on  
commits, and it was showing it, because the logic to calculate the  
allowable data width in wrapped expanded mode had only the vaguest  
relationship to the logic that was actually printing the data.  It was  
not very close to being right about the conditions requiring overhead  
columns to be added.  Aside from being wrong, it was pretty unreadable  
and under-commented.  Rewrite it so it corresponds to what the printing  
code actually does.  
  
In passing, remove a couple of dead tests in the printing logic, too.  
  
Per a complaint from Jeff Janes, though this doesn't look much like his  
patch because it fixes a number of other corner-case bogosities too.  
One such fix that's visible in the regression test results is that  
although the code was attempting to enforce a minimum data width of  
3 columns, it sometimes left less space than that available.  

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

Fix obsolete comment.

commit   : 3690dc6b03e7f3da9ddccf1d48b9314a37654a41    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 30 Nov 2015 12:54:11 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 30 Nov 2015 12:54:11 -0500    

Click here for diff

It's amazing how fast things become obsolete these days.  
  
Amit Langote  

M src/backend/executor/nodeGather.c

Avoid caching expression state trees for domain constraints across queries.

commit   : ec7eef6b1103f92aea94aa79aabd8e0e87973010    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Nov 2015 18:18:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Nov 2015 18:18:42 -0500    

Click here for diff

In commit 8abb3cda0ddc00a0ab98977a1633a95b97068d4e I attempted to cache  
the expression state trees constructed for domain CHECK constraints for  
the life of the backend (assuming the domain's constraints don't get  
redefined).  However, this turns out not to work very well, because  
execQual.c will run those state trees with ecxt_per_query_memory pointing  
to a query-lifespan context, and in some situations we'll end up with  
pointers into that context getting stored into the state trees.  This  
happens in particular with SQL-language functions, as reported by  
Emre Hasegeli, but there are many other cases.  
  
To fix, keep only the expression plan trees for domain CHECK constraints  
in the typcache's data structure, and revert to performing ExecInitExpr  
(at least) once per query to set up expression state trees in the query's  
context.  
  
Eventually it'd be nice to undo this, but that will require some careful  
thought about memory management for expression state trees, and it seems  
far too late for any such redesign in 9.5.  This way is still much more  
efficient than what happened before 8abb3cda0.  

M src/backend/utils/cache/typcache.c
M src/include/utils/typcache.h
M src/test/regress/expected/domain.out
M src/test/regress/sql/domain.sql

Avoid doing encoding conversions by double-conversion via MULE_INTERNAL.

commit   : 8d32717b6bfaeda5b88b338dae728b47da19f4bb    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Nov 2015 13:42:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Nov 2015 13:42:27 -0500    

Click here for diff

Previously, we did many conversions for Cyrillic and Central European  
single-byte encodings by converting to a related MULE_INTERNAL coding  
scheme before converting to the destination.  This seems unnecessarily  
inefficient.  Moreover, if the conversion encounters an untranslatable  
character, the error message will confusingly complain about failure  
to convert to or from MULE_INTERNAL, rather than the user-visible  
encodings.  Worse still, this approach results in some completely  
unnecessary conversion failures; there are cases where the chosen  
MULE subset lacks characters that exist in both of the user-visible  
encodings, causing a conversion failure that need not occur.  
  
This patch fixes the first two of those deficiencies by introducing  
a new local2local() conversion support subroutine for direct conversion  
between any two single-byte character sets, and adding new conversion  
tables where needed.  However, I generated the new conversion tables by  
testing PG 9.5's behavior, so that the actual conversion behavior is  
bug-compatible with previous releases; the only user-visible behavior  
change is that the error messages for conversion failures are saner.  
Changes in the conversion behavior will probably ensue after discussion.  
  
Interestingly, although this approach requires more tables, the .so files  
actually end up smaller (at least on my x86_64 machine); the tables are  
smaller than the management code needed for double conversion.  
  
Per a complaint from Albe Laurenz.  

M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
M src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
M src/include/mb/pg_wchar.h

Update UCS_to_GB18030.pl with info about origin of the reference file.

commit   : 5afdfc9cbb29ffc6f6b557a06495672d3c09f688    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Nov 2015 17:31:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Nov 2015 17:31:26 -0500    

Click here for diff

M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/gb18030_to_utf8.map
M src/backend/utils/mb/Unicode/utf8_to_gb18030.map

Auto-generate file header comments in Unicode mapping files.

commit   : e17dab53ea301031bf41d27e0799b940484c7bb0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Nov 2015 16:50:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Nov 2015 16:50:47 -0500    

Click here for diff

Some of the Unicode/*.map files had identification comments added to them,  
evidently by hand.  Others did not.  Modify the generating scripts to  
produce these comments automatically, and update the generated files that  
lacked them.  
  
This is just minor cleanup as a by-product of trying to verify that the  
*.map files can indeed be reproduced from authoritative data.  There are a  
depressingly large number that fail to reproduce from the claimed sources.  
I have not touched those in this commit, except for the JIS 2004-related  
files which required only a single comment update to match.  
  
Since this only affects comments, no need to consider a back-patch.  

M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/big5_to_utf8.map
M src/backend/utils/mb/Unicode/euc_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/koi8u_to_utf8.map
M src/backend/utils/mb/Unicode/shift_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/sjis_to_utf8.map
M src/backend/utils/mb/Unicode/utf8_to_big5.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jis_2004.map
M src/backend/utils/mb/Unicode/utf8_to_euc_tw.map
M src/backend/utils/mb/Unicode/utf8_to_gbk.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_10.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_13.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_14.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_15.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_16.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_2.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_3.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_4.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_5.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_6.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_7.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_8.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_9.map
M src/backend/utils/mb/Unicode/utf8_to_koi8r.map
M src/backend/utils/mb/Unicode/utf8_to_koi8u.map
M src/backend/utils/mb/Unicode/utf8_to_shift_jis_2004.map
M src/backend/utils/mb/Unicode/utf8_to_win1250.map
M src/backend/utils/mb/Unicode/utf8_to_win1251.map
M src/backend/utils/mb/Unicode/utf8_to_win1252.map
M src/backend/utils/mb/Unicode/utf8_to_win1253.map
M src/backend/utils/mb/Unicode/utf8_to_win1254.map
M src/backend/utils/mb/Unicode/utf8_to_win1255.map
M src/backend/utils/mb/Unicode/utf8_to_win1256.map
M src/backend/utils/mb/Unicode/utf8_to_win1257.map
M src/backend/utils/mb/Unicode/utf8_to_win1258.map
M src/backend/utils/mb/Unicode/utf8_to_win866.map
M src/backend/utils/mb/Unicode/utf8_to_win874.map
M src/backend/utils/mb/Unicode/win1250_to_utf8.map
M src/backend/utils/mb/Unicode/win1251_to_utf8.map
M src/backend/utils/mb/Unicode/win1252_to_utf8.map
M src/backend/utils/mb/Unicode/win1253_to_utf8.map
M src/backend/utils/mb/Unicode/win1254_to_utf8.map
M src/backend/utils/mb/Unicode/win1255_to_utf8.map
M src/backend/utils/mb/Unicode/win1256_to_utf8.map
M src/backend/utils/mb/Unicode/win1257_to_utf8.map
M src/backend/utils/mb/Unicode/win1258_to_utf8.map
M src/backend/utils/mb/Unicode/win866_to_utf8.map
M src/backend/utils/mb/Unicode/win874_to_utf8.map

Improve PQhost() to return useful data for default Unix-socket connections.

commit   : 40cb21f70b4ef2721c38be6628298fb21fa7d2d2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Nov 2015 14:13:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Nov 2015 14:13:53 -0500    

Click here for diff

Previously, if no host information had been specified at connection time,  
PQhost() would return NULL (unless you are on Windows, in which case you  
got "localhost").  This is an unhelpful definition for a couple of reasons:  
it can cause corner-case crashes in applications (cf commit c5ef8ce53d),  
and there's no well-defined way for applications to find out the socket  
directory path that's actually in use.  As an example of the latter  
problem, psql substituted DEFAULT_PGSOCKET_DIR for NULL in a couple of  
places, but this is subtly wrong because it's conceivable that psql is  
using a libpq shared library that was built with a different setting.  
  
Hence, change PQhost() to return DEFAULT_PGSOCKET_DIR when appropriate,  
and strip out the now-dead substitutions in psql.  (There is still one  
remaining reference to DEFAULT_PGSOCKET_DIR in psql, in prompt.c, which  
I don't see a nice way to get rid of.  But it only controls a prompt  
abbreviation decision, so it seems noncritical.)  
  
Also update the docs for PQhost, which had never previously mentioned  
the possibility of a socket directory path being returned.  In passing  
fix the outright-incorrect code comment about PGconn.pgunixsocket.  

M doc/src/sgml/libpq.sgml
M src/bin/psql/command.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h

COPY (INSERT/UPDATE/DELETE .. RETURNING ..)

commit   : 92e38182d7c8947a4ebbc1123b44f1245e232e85    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 27 Nov 2015 19:11:22 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 27 Nov 2015 19:11:22 +0300    

Click here for diff

Attached is a patch for being able to do COPY (query) without a CTE.  
  
Author: Marko Tiikkaja  
Review: Michael Paquier  

M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/parser/gram.y
M src/bin/psql/copy.c
M src/include/nodes/parsenodes.h
A src/test/regress/expected/copydml.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/copydml.sql

Fix failure to consider failure cases in GetComboCommandId().

commit   : 0da3a9bef7ad36dc640aebf2d0482e18f21561f6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Nov 2015 13:23:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Nov 2015 13:23:02 -0500    

Click here for diff

Failure to initially palloc the comboCids array, or to realloc it bigger  
when needed, left combocid's data structures in an inconsistent state that  
would cause trouble if the top transaction continues to execute.  Noted  
while examining a user complaint about the amount of memory used for this.  
(There's not much we can do about that, but it does point up that repalloc  
failure has a non-negligible chance of occurring here.)  
  
In HEAD/9.5, also avoid possible invocation of memcpy() with a null pointer  
in SerializeComboCIDState; cf commit 13bba0227.  

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

Be more paranoid about null return values from libpq status functions.

commit   : c5ef8ce53d37e276d70593ff0f4b06dd119cd3ff    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Nov 2015 17:31:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Nov 2015 17:31:53 -0500    

Click here for diff

PQhost() can return NULL in non-error situations, namely when a Unix-socket  
connection has been selected by default.  That behavior is a tad debatable  
perhaps, but for the moment we should make sure that psql copes with it.  
Unfortunately, do_connect() failed to: it could pass a NULL pointer to  
strcmp(), resulting in crashes on most platforms.  This was reported as a  
security issue by ChenQin of Topsec Security Team, but the consensus of  
the security list is that it's just a garden-variety bug with no security  
implications.  
  
For paranoia's sake, I made the keep_password test not trust PQuser or  
PQport either, even though I believe those will never return NULL given  
a valid PGconn.  
  
Back-patch to all supported branches.  

M src/bin/psql/command.c

Improve div_var_fast(), mostly by making comments better.

commit   : 46166197c3b3748c3266c694d7c2f5a312ea928e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Nov 2015 16:05:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Nov 2015 16:05:57 -0500    

Click here for diff

The integer overflow situation in div_var_fast() is a great deal more  
complicated than the pre-existing comments would suggest.  Moreover, the  
comments were also flat out incorrect as to the precise statement of the  
maxdiv loop invariant.  Upon clarifying that, it becomes apparent that the  
way in which we updated maxdiv after a carry propagation pass was overly  
slow, complex, and conservative: we can just reset it to one, which is much  
easier and also reduces the number of times carry propagation occurs.  
Fix that and improve the relevant comments.  
  
Since this is mostly a comment fix, with only a rather marginal performance  
boost, no need for back-patch.  
  
Tom Lane and Dean Rasheed  

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

Add forgotten file in commit d6061f83a166b015657fda8623c704fcb86930e9

commit   : 0271e27c1089f104236a7fe3b3fca52e5359ae56    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 25 Nov 2015 16:59:07 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 25 Nov 2015 16:59:07 +0300    

Click here for diff

A contrib/pageinspect/pageinspect–1.3–1.4.sql

Improve pageinspect module

commit   : d6061f83a166b015657fda8623c704fcb86930e9    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 25 Nov 2015 16:31:55 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 25 Nov 2015 16:31:55 +0300    

Click here for diff

Now pageinspect can show data stored in the heap tuple.  
  
Nikolay Shaplov  

M contrib/pageinspect/Makefile
M contrib/pageinspect/heapfuncs.c
R067 contrib/pageinspect/pageinspect–1.3.sql contrib/pageinspect/pageinspect–1.4.sql
M contrib/pageinspect/pageinspect.control
M doc/src/sgml/pageinspect.sgml

pg_upgrade: fix CopyFile() on Windows to fail on file existence

commit   : 13b30c16f3164ee70599adee251256bd069fa0e4    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 24 Nov 2015 17:18:28 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 24 Nov 2015 17:18:28 -0500    

Click here for diff

Also fix getErrorText() to return the right error string on failure.  
This behavior now matches that of other operating systems.  
  
Report by Noah Misch  
  
Backpatch through 9.1  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/util.c
M src/bin/pg_upgrade/version.c

doc: Some improvements on CREATE POLICY and ALTER POLICY documentation

commit   : cbd96eff251bf92e88a13ef00df07c6caae0d411    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Nov 2015 21:36:57 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Nov 2015 21:36:57 -0500    

Click here for diff

M doc/src/sgml/ref/alter_policy.sgml
M doc/src/sgml/ref/create_policy.sgml

Clarify pg_rewind connection requirements.

commit   : d00352573a1d5cf685397d5776c36b625c3f0c79    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 23 Nov 2015 19:27:01 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 23 Nov 2015 19:27:01 +0300    

Click here for diff

Per http://www.postgresql.org/message-id/flat/[email protected]  
Pavel Luzanov <[email protected]>  

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

doc: Add more documentation about wal_retrieve_retry_interval

commit   : 2ef7a985fb9077aabeb480a23732c4d6ddb89ce5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Nov 2015 09:13:44 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Nov 2015 09:13:44 -0500    

Click here for diff

from Michael Paquier  

M doc/src/sgml/config.sgml

Adopt the GNU convention for handling tar-archive members exceeding 8GB.

commit   : 00cdd83521cfdaaff0f566ebeadecc2cad4d51cf    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Nov 2015 20:21:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Nov 2015 20:21:31 -0500    

Click here for diff

The POSIX standard for tar headers requires archive member sizes to be  
printed in octal with at most 11 digits, limiting the representable file  
size to 8GB.  However, GNU tar and apparently most other modern tars  
support a convention in which oversized values can be stored in base-256,  
allowing any practical file to be a tar member.  Adopt this convention  
to remove two limitations:  
* pg_dump with -Ft output format failed if the contents of any one table  
exceeded 8GB.  
* pg_basebackup failed if the data directory contained any file exceeding  
8GB.  (This would be a fatal problem for installations configured with a  
table segment size of 8GB or more, and it has also been seen to fail when  
large core dump files exist in the data directory.)  
  
File sizes under 8GB are still printed in octal, so that no compatibility  
issues are created except in cases that would have failed entirely before.  
  
In addition, this patch fixes several bugs in the same area:  
  
* In 9.3 and later, we'd defined tarCreateHeader's file-size argument as  
size_t, which meant that on 32-bit machines it would write a corrupt tar  
header for file sizes between 4GB and 8GB, even though no error was raised.  
This broke both "pg_dump -Ft" and pg_basebackup for such cases.  
  
* pg_restore from a tar archive would fail on tables of size between 4GB  
and 8GB, on machines where either "size_t" or "unsigned long" is 32 bits.  
This happened even with an archive file not affected by the previous bug.  
  
* pg_basebackup would fail if there were files of size between 4GB and 8GB,  
even on 64-bit machines.  
  
* In 9.3 and later, "pg_basebackup -Ft" failed entirely, for any file size,  
on 64-bit big-endian machines.  
  
In view of these potential data-loss bugs, back-patch to all supported  
branches, even though removal of the documented 8GB limit might otherwise  
be considered a new feature rather than a bug fix.  

M doc/src/sgml/ref/pg_dump.sgml
M src/backend/replication/basebackup.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_dump/pg_backup_tar.c
M src/include/pgtar.h
M src/port/tar.c

Fix handling of inherited check constraints in ALTER COLUMN TYPE (again).

commit   : 074c5cfbfb4923158be9ccdb77420d6522d77538    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Nov 2015 14:55:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Nov 2015 14:55:28 -0500    

Click here for diff

The previous way of reconstructing check constraints was to do a separate  
"ALTER TABLE ONLY tab ADD CONSTRAINT" for each table in an inheritance  
hierarchy.  However, that way has no hope of reconstructing the check  
constraints' own inheritance properties correctly, as pointed out in  
bug #13779 from Jan Dirk Zijlstra.  What we should do instead is to do  
a regular "ALTER TABLE", allowing recursion, at the topmost table that  
has a particular constraint, and then suppress the work queue entries  
for inherited instances of the constraint.  
  
Annoyingly, we'd tried to fix this behavior before, in commit 5ed6546cf,  
but we failed to notice that it wasn't reconstructing the pg_constraint  
field values correctly.  
  
As long as I'm touching pg_get_constraintdef_worker anyway, tweak it to  
always schema-qualify the target table name; this seems like useful backup  
to the protections installed by commit 5f173040.  
  
In HEAD/9.5, get rid of get_constraint_relation_oids, which is now unused.  
(I could alternatively have modified it to also return conislocal, but that  
seemed like a pretty single-purpose API, so let's not pretend it has some  
other use.)  It's unused in the back branches as well, but I left it in  
place just in case some third-party code has decided to use it.  
  
In HEAD/9.5, also rename pg_get_constraintdef_string to  
pg_get_constraintdef_command, as the previous name did nothing to explain  
what that entry point did differently from others (and its comment was  
equally useless).  Again, that change doesn't seem like material for  
back-patching.  
  
I did a bit of re-pgindenting in tablecmds.c in HEAD/9.5, as well.  
  
Otherwise, back-patch to all supported branches.  

M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/pg_constraint.h
M src/include/utils/ruleutils.h
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Avoid server crash when worker registration fails at execution time.

commit   : 6c878a7553680579f287e4659592c0b874fb2377    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 20 Nov 2015 13:03:39 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 20 Nov 2015 13:03:39 -0500    

Click here for diff

The previous coding attempts to destroy the DSM in this case, but  
child nodes might have stored data there and still be holding onto  
pointers in this case.  So don't do that.  
  
Also, free the reader array instead of leaking it.  
  
Extracted from two different patch versions both by Amit Kapila.  

M src/backend/executor/nodeGather.c

Fix typo in comment.

commit   : 74d0d5f3ebed9d817ec353fb17eedb343a0ab5b4    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 19 Nov 2015 16:45:39 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 19 Nov 2015 16:45:39 -0500    

Click here for diff

Amit Langote  

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

Remove numbers from incorrectly-numbered list.

commit   : fea2b642fdb1bbe0f4b1bd0a763c370dfc6fb97c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 19 Nov 2015 14:59:01 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 19 Nov 2015 14:59:01 -0500    

Click here for diff

Reported by Andres Freund.  

M src/backend/catalog/namespace.c

Dodge a macro-name conflict with Perl.

commit   : 68c1d7d42e553682f1d2723e623b6a3a4b02c75f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Nov 2015 14:54:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Nov 2015 14:54:05 -0500    

Click here for diff

Some versions of Perl export a macro named HS_KEY.  This creates a  
conflict in contrib/hstore_plperl against hstore's macro of the same  
name.  The most future-proof solution seems to be to rename our macro;  
I chose HSTORE_KEY.  For consistency, rename HS_VAL and related macros  
similarly.  
  
Back-patch to 9.5.  contrib/hstore_plperl doesn't exist before that  
so there is no need to worry about the conflict in older releases.  
  
Per reports from Marco Atzeri and Mike Blackwell.  

M contrib/hstore/hstore.h
M contrib/hstore/hstore_compat.c
M contrib/hstore/hstore_gin.c
M contrib/hstore/hstore_gist.c
M contrib/hstore/hstore_io.c
M contrib/hstore/hstore_op.c
M contrib/hstore_plperl/hstore_plperl.c
M contrib/hstore_plpython/hstore_plpython.c

doc: Clarify some things on pg_receivexlog reference page

commit   : db135e834a28180e9151f12c694b07d8fc3c41a8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Nov 2015 14:19:04 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Nov 2015 14:19:04 -0500    

Click here for diff

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

Fix thinko: errmsg -> ereport.

commit   : 9be3a4e24dc777e31f6358907ebefac841ea2632    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Nov 2015 14:16:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Nov 2015 14:16:39 -0500    

Click here for diff

Silly mistake in my commit 09cecdf285ea9f51, reported by Erik Rijkers.  
  
The fact that the buildfarm didn't find this implies that we are not  
testing Perl builds that lack MULTIPLICITY, which is a bit disturbing  
from a coverage standpoint.  Until today I'd have said nobody cared  
about such configurations anymore; but maybe not.  

M src/pl/plperl/plperl.c

Make ALTER .. SET SCHEMA do nothing, instead of throwing an ERROR.

commit   : bc4996e61b98d41eacf991c18508b7a2305a68c6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 19 Nov 2015 10:49:25 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 19 Nov 2015 10:49:25 -0500    

Click here for diff

This was already true for CREATE EXTENSION, but historically has not  
been true for other object types.  Therefore, this is a backward  
incompatibility.  Per discussion on pgsql-hackers, everyone seems to  
agree that the new behavior is better.  
  
Marti Raudsepp, reviewed by Haribabu Kommi and myself  

M src/backend/catalog/namespace.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/alter.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/include/catalog/namespace.h
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_generic.sql
M src/test/regress/sql/alter_table.sql

fix a perl typo

commit   : f11c557e92c50d3d613d1173c15feb5310ba4744    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 19 Nov 2015 02:42:02 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 19 Nov 2015 02:42:02 -0500    

Click here for diff

M src/tools/msvc/vcregress.pl

Update docs for vcregress.pl bincheck changes

commit   : c2d5657c0f6f8ae9894205551354eca796f8b11c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 18 Nov 2015 23:32:16 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 18 Nov 2015 23:32:16 -0500    

Click here for diff

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

Improve vcregress.pl's handling of tap tests for client programs

commit   : d835dd6685246f0737ca42ab68242210681bb220    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 18 Nov 2015 22:47:41 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 18 Nov 2015 22:47:41 -0500    

Click here for diff

The target is now named 'bincheck' rather than 'tapcheck' so that it  
reflects what is checked instead of the test mechanism. Some of the  
logic is improved, making it easier to add further sets of TAP based  
tests in future. Also, the environment setting logic is imrpoved.  
  
As discussed on -hackers a couple of months ago.  

M src/tools/msvc/vcregress.pl

Fix incomplete set_foreignscan_references handling for fdw_recheck_quals

commit   : 7907a949abf100b5a1e1def1184ba1e6fc8b9fd7    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 18 Nov 2015 21:17:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 18 Nov 2015 21:17:50 -0500    

Click here for diff

KaiGai Kohei  

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

Remove function names from some elog() calls in heapam.c.

commit   : d3c8ac114f1183e54315e64ef697c6588823c4dd    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 19 Nov 2015 01:25:58 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 19 Nov 2015 01:25:58 +0100    

Click here for diff

At least one of the names was, due to a function renaming late in the  
development of ON CONFLICT, wrong. Since including function names in  
error messages is against the message style guide anyway, remove them  
from the messages.  
  
Discussion: CAM3SWZT8paz=usgMVHm0XOETkQvzjRtAUthATnmaHQQY0obnGw@mail.gmail.com  
Backpatch: 9.5, where ON CONFLICT was introduced  

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

Improve ON CONFLICT documentation.

commit   : edf68b2ed51cb8a1c9fdf7eb13f9b2c883eb5399    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 10 Nov 2015 00:02:49 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 10 Nov 2015 00:02:49 +0100    

Click here for diff

Author: Peter Geoghegan and Andres Freund  
Discussion: CAM3SWZScpWzQ-7EJC77vwqzZ1GO8GNmURQ1QqDQ3wRn7AbW1Cg@mail.gmail.com  
Backpatch: 9.5, where ON CONFLICT was introduced  

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

Accept flex > 2.5.x in configure.

commit   : 32f15d05c80044335f97347b5406f6736c06a033    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Nov 2015 17:45:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Nov 2015 17:45:05 -0500    

Click here for diff

Per buildfarm member anchovy, 2.6.0 exists in the wild now.  
Hopefully it works with Postgres; if not, we'll have to do something  
about that, but in any case claiming it's "too old" is pretty silly.  

M config/programs.m4
M configure

Make a comment more precise.

commit   : e073490457176805bc31b8f7c7829ce1b71a6e76    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 18 Nov 2015 15:19:19 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 18 Nov 2015 15:19:19 -0500    

Click here for diff

Remote expressions now also matter to make_foreignscan()  
  
Noted by Etsuro Fujita.  

M contrib/postgres_fdw/postgres_fdw.c

Avoid aggregating worker instrumentation multiple times.

commit   : 166b61a88ef8e9fb97eba7b7ab8062e214c93af8    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 18 Nov 2015 12:35:25 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 18 Nov 2015 12:35:25 -0500    

Click here for diff

Amit Kapila, per design ideas from me.  

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

Fix dumb bug in tqueue.c

commit   : adeee974866085db84b860c1f397dd7c6b136a0a    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 18 Nov 2015 08:25:33 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 18 Nov 2015 08:25:33 -0500    

Click here for diff

When I wrote this code originally, the intention was to recompute the  
remapinfo only when the tupledesc changes.  This presumably only  
happens once per query, but I copied the design pattern from other  
DestReceivers.  However, due to a silly oversight on my part,  
tqueue->tupledesc never got set, leading to recomputation for every  
tuple.  
  
This should improve the performance of parallel scans that return a  
significant number of tuples.  
  
Report by Amit Kapila; patch by me, reviewed by him.  

M src/backend/executor/tqueue.c

Fix possible internal overflow in numeric division.

commit   : 5f10b7a604c87fc61a2c20a56552301f74c9bd5f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Nov 2015 15:46:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Nov 2015 15:46:47 -0500    

Click here for diff

div_var_fast() postpones propagating carries in the same way as mul_var(),  
so it has the same corner-case overflow risk we fixed in 246693e5ae8a36f0,  
namely that the size of the carries has to be accounted for when setting  
the threshold for executing a carry propagation step.  We've not devised  
a test case illustrating the brokenness, but the required fix seems clear  
enough.  Like the previous fix, back-patch to all active branches.  
  
Dean Rasheed  

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

Message style fix

commit   : c5ec4064120c12c7b8cd4772d0b9f571f5dd40b4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 17 Nov 2015 06:53:07 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 17 Nov 2015 06:53:07 -0500    

Click here for diff

from Euler Taveira  

M src/backend/commands/copy.c
M src/test/regress/expected/rowsecurity.out

Improve message

commit   : 5be5b5029f26b1723382bac185fcfa993a763234    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 16 Nov 2015 22:26:32 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 16 Nov 2015 22:26:32 -0500    

Click here for diff

M src/bin/scripts/vacuumdb.c

Message improvements

commit   : 5db837d3f22960c2fdc11b390ecf3984b3e0c49e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 16 Nov 2015 21:16:42 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 16 Nov 2015 21:16:42 -0500    

Click here for diff

M src/backend/access/transam/parallel.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/copy.c
M src/backend/commands/extension.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/libpq/auth.c
M src/backend/libpq/pqcomm.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_relation.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/rls.c
M src/port/win32error.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/insert_conflict.out
M src/test/regress/expected/join.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/rowsecurity.out

doc: Fix commas and improve spacing

commit   : 53264c7b1e0c9be7bc05289372265c768869f818    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 16 Nov 2015 18:59:55 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 16 Nov 2015 18:59:55 -0500    

Click here for diff

M doc/src/sgml/queries.sgml

Remove volatile qualifiers from bufmgr.c and freelist.c

commit   : e93b62985f9c69dcb6f0747450809fff64b78a6e    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 16 Nov 2015 18:50:06 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 16 Nov 2015 18:50:06 -0500    

Click here for diff

Prior to commit 0709b7ee72e4bc71ad07b7120acd117265ab51d0, access to  
variables within a spinlock-protected critical section had to be done  
through a volatile pointer, but that should no longer be necessary.  
  
Review by Andres Freund  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/include/storage/buf_internals.h

Speed up ruleutils' name de-duplication code, and fix overlength-name case.

commit   : 8004953b5a2449c26c4e082771276b2f8629d153    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Nov 2015 13:45:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Nov 2015 13:45:17 -0500    

Click here for diff

Since commit 11e131854f8231a21613f834c40fe9d046926387, ruleutils.c has  
attempted to ensure that each RTE in a query or plan tree has a unique  
alias name.  However, the code that was added for this could be quite slow,  
even as bad as O(N^3) if N identical RTE names must be replaced, as noted  
by Jeff Janes.  Improve matters by building a transient hash table within  
set_rtable_names.  The hash table in itself reduces the cost of detecting a  
duplicate from O(N) to O(1), and we can save another factor of N by storing  
the number of de-duplicated names already created for each entry, so that  
we don't have to re-try names already created.  This way is probably a bit  
slower overall for small range tables, but almost by definition, such cases  
should not be a performance problem.  
  
In principle the same problem applies to the column-name-de-duplication  
code; but in practice that seems to be less of a problem, first because  
N is limited since we don't support extremely wide tables, and second  
because duplicate column names within an RTE are fairly rare, so that in  
practice the cost is more like O(N^2) not O(N^3).  It would be very much  
messier to fix the column-name code, so for now I've left that alone.  
  
An independent problem in the same area was that the de-duplication code  
paid no attention to the identifier length limit, and would happily produce  
identifiers that were longer than NAMEDATALEN and wouldn't be unique after  
truncation to NAMEDATALEN.  This could result in dump/reload failures, or  
perhaps even views that silently behaved differently than before.  We can  
fix that by shortening the base name as needed.  Fix it for both the  
relation and column name cases.  
  
In passing, check for interrupts in set_rtable_names, just in case it's  
still slow enough to be an issue.  
  
Back-patch to 9.3 where this code was introduced.  

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

Remove accidentally-committed debugging code.

commit   : 179c97bf587df710f98aa3ce2d95f503b0757e15    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 15 Nov 2015 18:07:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 15 Nov 2015 18:07:57 -0500    

Click here for diff

Amit Kapila  

M src/backend/executor/tqueue.c

Fix ruleutils.c's dumping of whole-row Vars in ROW() and VALUES() contexts.

commit   : 7745bc352a82bd588be986479c7aabc3b076a375    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Nov 2015 14:41:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Nov 2015 14:41:09 -0500    

Click here for diff

Normally ruleutils prints a whole-row Var as "foo.*".  We already knew that  
that doesn't work at top level of a SELECT list, because the parser would  
treat the "*" as a directive to expand the reference into separate columns,  
not a whole-row Var.  However, Joshua Yanovski points out in bug #13776  
that the same thing happens at top level of a ROW() construct; and some  
nosing around in the parser shows that the same is true in VALUES().  
Hence, apply the same workaround already devised for the SELECT-list case,  
namely to add a forced cast to the appropriate rowtype in these cases.  
(The alternative of just printing "foo" was rejected because it is  
difficult to avoid ambiguity against plain columns named "foo".)  
  
Back-patch to all supported branches.  

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

Improve type numeric's calculations for ln(), log(), exp(), pow().

commit   : 7d9a4737c268f61fb8800957631f12d3f13be218    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Nov 2015 14:55:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Nov 2015 14:55:38 -0500    

Click here for diff

Set the "rscales" for intermediate-result calculations to ensure that  
suitable numbers of significant digits are maintained throughout.  The  
previous coding hadn't thought this through in any detail, and as a result  
could deliver results with many inaccurate digits, or in the worst cases  
even fail with divide-by-zero errors as a result of losing all nonzero  
digits of intermediate results.  
  
In exp_var(), get rid entirely of the logic that separated the calculation  
into integer and fractional parts: that was neither accurate nor  
particularly fast.  The existing range-reduction method of dividing by 2^n  
can be applied across the full input range instead of only 0..1, as long as  
we are careful to set an appropriate rscale for each step.  
  
Also fix the logic in mul_var() for shortening the calculation when the  
caller asks for fewer output digits than an exact calculation would  
require.  This bug doesn't affect simple multiplications since that code  
path asks for an exact result, but it does contribute to accuracy issues  
in the transcendental math functions.  
  
In passing, improve performance of mul_var() a bit by forcing the shorter  
input to be on the left, thus reducing the number of iterations of the  
outer loop and probably also reducing the number of carry-propagation  
steps needed.  
  
This is arguably a bug fix, but in view of the lack of field complaints,  
it does not seem worth the risk of back-patching.  
  
Dean Rasheed  

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

Fix spelling error in postgresql.conf

commit   : e57646e96284d4bad79f87a5c1dfbcd8f5434020    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 14 Nov 2015 14:00:17 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 14 Nov 2015 14:00:17 -0500    

Click here for diff

Report by Greg Clough  

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

pg_upgrade: properly detect file copy failure on Windows

commit   : 025106e314627f5aacdf72fca52ba0ed985d696e    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 14 Nov 2015 11:47:12 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 14 Nov 2015 11:47:12 -0500    

Click here for diff

Previously, file copy failures were ignored on Windows due to an  
incorrect return value check.  
  
Report by Manu Joye  
  
Backpatch through 9.1  

M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/pg_upgrade.h

Correct sepgsql docs with regard to RLS

commit   : 42aa1c032e3520d608a1e89abbf36409b022d4b7    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 13 Nov 2015 11:06:38 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 13 Nov 2015 11:06:38 -0500    

Click here for diff

The sepgsql docs included a comment that PG doesn't support RLS.  That  
is only true for versions prior to 9.5.  
  
Update the docs for 9.5 and master to say that PG supports RLS but that  
sepgsql does not yet.  
  
Pointed out by Heikki.  
  
Back-patch to 9.5  

M doc/src/sgml/sepgsql.sgml

vacuumdb: don't prompt for passwords over and over

commit   : 83dec5a712af251af15effbf781ddaedc3bf6b3b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 12 Nov 2015 18:05:23 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 12 Nov 2015 18:05:23 -0300    

Click here for diff

Having the script prompt for passwords over and over was a preexisting  
problem when it processed multiple databases or when it processed  
multiple analyze stages, but the parallel mode introduced in commit  
a179232047 made it worse.  
  
Fix the annoyance by keeping a copy of the password used by the first  
connection that requires one.  Since users can (currently) only have a  
single password, there's no need for more complex arrangements (such as  
remembering one password per database).  
  
Per bug #13741 reported by Eric Brown.  Patch authored and  
cross-reviewed by Haribabu Kommi and Michael Paquier, slightly tweaked  
by Álvaro Herrera.  
  
Discussion: http://www.postgresql.org/message-id/[email protected]  
Backpatch to 9.5, where parallel vacuumdb was introduced.  

M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createlang.c
M src/bin/scripts/createuser.c
M src/bin/scripts/droplang.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c

Move each SLRU's lwlocks to a separate tranche.

commit   : fe702a7b3f9f2bc5bf6d173166d7d55226af82c8    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 12 Nov 2015 14:59:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 12 Nov 2015 14:59:09 -0500    

Click here for diff

This makes it significantly easier to identify these lwlocks in  
LWLOCK_STATS or Trace_lwlocks output.  It's also arguably better  
from a modularity standpoint, since lwlock.c no longer needs to  
know anything about the LWLock needs of the higher-level SLRU  
facility.  
  
Ildus Kurbangaliev, reviewd by Álvaro Herrera and by me.  

M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/commands/async.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/include/access/slru.h

Fix unwanted flushing of libpq's input buffer when socket EOF is seen.

commit   : c405918858c09d4264ffc5a3c73d57dc3efb0213    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Nov 2015 13:03:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Nov 2015 13:03:52 -0500    

Click here for diff

In commit 210eb9b743c0645d I centralized libpq's logic for closing down  
the backend communication socket, and made the new pqDropConnection  
routine always reset the I/O buffers to empty.  Many of the call sites  
previously had not had such code, and while that amounted to an oversight  
in some cases, there was one place where it was intentional and necessary  
*not* to flush the input buffer: pqReadData should never cause that to  
happen, since we probably still want to process whatever data we read.  
  
This is the true cause of the problem Robert was attempting to fix in  
c3e7c24a1d60dc6a, namely that libpq no longer reported the backend's final  
ERROR message before reporting "server closed the connection unexpectedly".  
But that only accidentally fixed it, by invoking parseInput before the  
input buffer got flushed; and very likely there are timing scenarios  
where we'd still lose the message before processing it.  
  
To fix, pass a flag to pqDropConnection to tell it whether to flush the  
input buffer or not.  On review I think flushing is actually correct for  
every other call site.  
  
Back-patch to 9.3 where the problem was introduced.  In HEAD, also improve  
the comments added by c3e7c24a1d60dc6a.  

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

libpq: Notice errors a backend may have sent just before dying.

commit   : c3e7c24a1d60dc6ad56e2a0723399f1570c54224    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 12 Nov 2015 09:12:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 12 Nov 2015 09:12:18 -0500    

Click here for diff

At least since the introduction of Hot Standby, the backend has  
sometimes sent fatal errors even when no client query was in  
progress, assuming that the client would receive it.  However,  
pqHandleSendFailure was not in sync with this assumption, and  
only tries to catch notices and notifies.  Add a parseInput call  
to the loop there to fix.  
  
Andres Freund suggested the fix.  Comments are by me.  
Reviewed by Michael Paquier.  

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

Make idle backends exit if the postmaster dies.

commit   : ac1d7945f866b1928c2554c0f80fd52d7f977772    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 12 Nov 2015 09:00:33 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 12 Nov 2015 09:00:33 -0500    

Click here for diff

Letting backends continue to run if the postmaster has exited prevents  
PostgreSQL from being restarted, which in many environments is  
catastrophic.  Worse, if some other backend crashes, we no longer have  
any protection against shared memory corruption.  So, arrange for them  
to exit instead.  We don't want to expend many cycles on this, but  
including postmaster death in the set of things that we wait for when  
a backend is idle seems cheap enough.  
  
Rajeev Rastogi and Robert Haas  

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

Provide readfuncs support for custom scans.

commit   : a05dc4d7fd57d4ae084c1f0801973e5c1a1aa26e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 12 Nov 2015 07:40:31 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 12 Nov 2015 07:40:31 -0500    

Click here for diff

Commit a0d9f6e434bb56f7e5441b7988f3982feead33b3 added this support for  
all other plan node types; this fills in the gap.  
  
Since TextOutCustomScan complicates this and is pretty well useless,  
remove it.  
  
KaiGai Kohei, with some modifications by me.  

M doc/src/sgml/custom-scan.sgml
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/nodes/plannodes.h

Do a round of copy-editing on the 9.5 release notes.

commit   : 39b9978d9cac34ad799a5fa3ff3846f3e0372b0a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Nov 2015 19:19:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Nov 2015 19:19:14 -0500    

Click here for diff

Also fill in the previously empty "major enhancements" list.  YMMV as to  
which items should make the cut, but it's past time we had something more  
than a placeholder here.  
  
(I meant to get this done before beta2 was wrapped, but got distracted by  
PDF build problems.  Better late than never.)  

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

commit   : 6404751ce91fb02999e46700a1ac62b3c6319abf    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Nov 2015 17:13:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Nov 2015 17:13:38 -0500    

Click here for diff

These were discussed in three different sections of the manual, which  
unsurprisingly had diverged over time; and the descriptions of individual  
variables lacked stylistic consistency even within each section (and  
frequently weren't in very good English anyway).  Clean up the mess, and  
remove some of the redundant information in hopes that future additions  
will be less likely to re-introduce inconsistency.  For instance I see  
no need for maintenance.sgml to include its very own list of all the  
autovacuum storage parameters, especially since that list was already  
incomplete.  

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

Be more noisy about "wrong number of nailed relations" initfile problems.

commit   : da3751c8ea6f833d8e69fbdd168d29d328674398    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Nov 2015 13:39:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Nov 2015 13:39:21 -0500    

Click here for diff

In commit 5d1ff6bd559ea8df1b7302e245e690b01b9a4fa4 I added some logic to  
relcache.c to try to ensure that the regression tests would fail if we  
made a mistake about which relations belong in the relcache init files.  
I'm quite sure I tested that, but I must have done so only for the  
non-shared-catalog case, because a report from Adam Brightwell showed that  
the regression tests still pass just fine if we bollix the shared-catalog  
init file in the way this code was supposed to catch.  The reason is that  
that file gets loaded before we do client authentication, so the WARNING  
is not sent to the client, only to the postmaster log, where it's far too  
easily missed.  
  
The least Rube Goldbergian answer to this is to put an Assert(false)  
after the elog(WARNING).  That will certainly get developers' attention,  
while not breaking production builds' ability to recover from corner  
cases with similar symptoms.  
  
Since this is only of interest to developers, there seems no need for  
a back-patch, even though the previous commit went into all branches.  

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

Generate parallel sequential scan plans in simple cases.

commit   : 80558c1f5aa109d08db0fbd76a6d370f900628a8    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 11 Nov 2015 09:02:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 11 Nov 2015 09:02:52 -0500    

Click here for diff

Add a new flag, consider_parallel, to each RelOptInfo, indicating  
whether a plan for that relation could conceivably be run inside of  
a parallel worker.  Right now, we're pretty conservative: for example,  
it might be possible to defer applying a parallel-restricted qual  
in a worker, and later do it in the leader, but right now we just  
don't try to parallelize access to that relation.  That's probably  
the right decision in most cases, anyway.  
  
Using the new flag, generate parallel sequential scan plans for plain  
baserels, meaning that we now have parallel sequential scan in  
PostgreSQL.  The logic here is pretty unsophisticated right now: the  
costing model probably isn't right in detail, and we can't push joins  
beneath Gather nodes, so the number of plans that can actually benefit  
from this is pretty limited right now.  Lots more work is needed.  
Nevertheless, it seems time to enable this functionality so that all  
this code can actually be tested easily by users and developers.  
  
Note that, if you wish to test this functionality, it will be  
necessary to set max_parallel_degree to a value greater than the  
default of 0.  Once a few more loose ends have been tidied up here, we  
might want to consider changing the default value of this GUC, but  
I'm leaving it alone for now.  
  
Along the way, fix a bug in cost_gather: the previous coding thought  
that a Gather node's transfer overhead should be costed on the basis of  
the relation size rather than the number of tuples that actually need  
to be passed off to the leader.  
  
Patch by me, reviewed in earlier versions by Amit Kapila.  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/relnode.c
M src/backend/utils/cache/lsyscache.c
M src/include/nodes/relation.h
M src/include/optimizer/clauses.h
M src/include/utils/lsyscache.h

Make sequential scans parallel-aware.

commit   : f0661c4e8c44c0ec7acd4ea7c82e85b265447398    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 11 Nov 2015 08:57:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 11 Nov 2015 08:57:52 -0500    

Click here for diff

In addition, this path fills in a number of missing bits and pieces in  
the parallel infrastructure.  Paths and plans now have a parallel_aware  
flag indicating whether whatever parallel-aware logic they have should  
be engaged.  It is believed that we will need this flag for a number of  
path/plan types, not just sequential scans, which is why the flag is  
generic rather than part of the SeqScan structures specifically.  
Also, execParallel.c now gives parallel nodes a chance to initialize  
their PlanState nodes from the DSM during parallel worker startup.  
  
Amit Kapila, with a fair amount of adjustment by me.  Review of previous  
patch versions by Haribabu Kommi and others.  

M src/backend/commands/explain.c
M src/backend/executor/execAmi.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeSeqscan.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/include/executor/nodeSeqscan.h
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h

Add outfuncs.c support for GatherPath.

commit   : f764ecd81b2a8a1e9000d43a73ca5eec8e8008bc    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 11 Nov 2015 06:29:03 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 11 Nov 2015 06:29:03 -0500    

Click here for diff

I dunno how commit 3bd909b220930f21d6e15833a17947be749e7fde missed  
this, but it evidently did.  

M src/backend/nodes/outfuncs.c

Docs: fix misleading example.

commit   : 7b6fb76349fccc38f0ef96166f207c6acd21968c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Nov 2015 22:11:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Nov 2015 22:11:39 -0500    

Click here for diff

Commit 8457d0beca731bf0 introduced an example which, while not incorrect,  
failed to exhibit the behavior it meant to describe, as a result of omitting  
an E'' prefix that needed to be there.  Noticed and fixed by Peter Geoghegan.  
  
I (tgl) failed to resist the temptation to wordsmith nearby text a bit  
while at it.  

M doc/src/sgml/datatype.sgml

Add missing "static" qualifier.

commit   : b05ae27e9a57a1c8f1f44720c23c4828106b7205    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Nov 2015 18:24:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Nov 2015 18:24:18 -0500    

Click here for diff

Per buildfarm member pademelon.  

M src/backend/executor/nodeGather.c

Improve our workaround for 'TeX capacity exceeded' in building PDF files.

commit   : 944b41fc00600b74f518005ac314cc222bf6abd5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Nov 2015 15:59:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Nov 2015 15:59:59 -0500    

Click here for diff

In commit a5ec86a7c787832d28d5e50400ec96a5190f2555 I wrote a quick hack  
that reduced the number of TeX string pool entries created while converting  
our documentation to PDF form.  That held the fort for awhile, but as of  
HEAD we're back up against the same limitation.  It turns out that the  
original coding of \FlowObjectSetup actually results in *three* string pool  
entries being generated for every "flow object" (that is, potential  
cross-reference target) in the documentation, and my previous hack only got  
rid of one of them.  With a little more care, we can reduce the string  
count to one per flow object plus one per actually-cross-referenced flow  
object (about 115000 + 5000 as of current HEAD); that should work until  
the documentation volume roughly doubles from where it is today.  
  
As a not-incidental side benefit, this change also causes pdfjadetex to  
stop emitting unreferenced hyperlink anchors (bookmarks) into the PDF file.  
It had been making one willy-nilly for every flow object; now it's just one  
per actually-cross-referenced object.  This results in close to a 2X  
savings in PDF file size.  We will still want to run the output through  
"jpdftweak" to get it to be compressed; but we no longer need removal of  
unreferenced bookmarks, so we might be able to find a quicker tool for  
that step.  
  
Although the failure only affects HEAD and US-format output at the moment,  
9.5 cannot be more than a few pages short of failing likewise, so it  
will inevitably fail after a few rounds of minor-version release notes.  
I don't have a lot of faith that we'll never hit the limit in the older  
branches; and anyway it would be nice to get rid of jpdftweak across the  
board.  Therefore, back-patch to all supported branches.  

M doc/src/sgml/jadetex.cfg

Comment update.

commit   : 5c90a2ffddd2504a7441e80a22ba0fe8d484291a    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 9 Nov 2015 13:48:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 9 Nov 2015 13:48:50 -0500    

Click here for diff

Adjust to account for 5fc4c26db5120bd90348b6ee3101fcddfdf54800.  
  
Etsuro Fujita  

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

Fix rebasing mistake in nodeGather.c

commit   : bf3d0156311f0d8fa7705d8de0d07c4e0298051a    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 9 Nov 2015 10:49:24 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 9 Nov 2015 10:49:24 -0500    

Click here for diff

The patches committed as 6e71dd7ce9766582da453f493bc371d64977282f  
and 3a1f8611f2582df0a16bcd35caed2e1526387643 were developed in  
parallel but dependent on each other in a way that I failed to  
notice.  
  
This patch to fix the problem was prepared by Amit Kapila.  

M src/backend/executor/nodeGather.c

Add a dummy return statement to TupleQueueRemap.

commit   : 89ff5c7f7512a919e76407b4f8269e5b0b39dd2b    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 9 Nov 2015 10:45:32 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 9 Nov 2015 10:45:32 -0500    

Click here for diff

This is unreachable for multiple reasons, but per Amit Kapila the  
Windows compiler he is using still thinks we can get there.  

M src/backend/executor/tqueue.c

Add paragraph about ON CONFLICT interaction with partitioning.

commit   : c31f1dc55992bc8b2c35c0ff99795547d4df323a    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 9 Nov 2015 05:08:56 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 9 Nov 2015 05:08:56 +0100    

Click here for diff

Author: Peter Geoghegan and Andres Freund  
Discussion: CAM3SWZScpWzQ-7EJC77vwqzZ1GO8GNmURQ1QqDQ3wRn7AbW1Cg@mail.gmail.com,  
    CAHGQGwFUCWwSU7dtc2aRdRk73ztyr_jY5cPOyts+K8xKJ92X4Q@mail.gmail.com  
Backpatch: 9.5, where UPSERT was introduced  

M doc/src/sgml/ddl.sgml

Set replication origin when decoding commit records.

commit   : f3a764b0dac77451d20ee00d2f5916447a5c4346    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 8 Nov 2015 23:01:53 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 8 Nov 2015 23:01:53 +0100    

Click here for diff

By accident the replication origin was not set properly in  
DecodeCommit(). That's bad because the origin is passed to the output  
plugins origin filter, and accessible from the output plugin via  
ReorderBufferTXN->origin_id.  Accessing the origin of individual changes  
worked before the fix, which is why this wasn't notices earlier.  
  
Reported-By: Craig Ringer  
Author: Craig Ringer  
Discussion: CAMsr+YFhBJLp=qfSz3-J+0P1zLkE8zNXM2otycn20QRMx380gw@mail.gmail.com  
Backpatch: 9.5, where replication origins where introduced  

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

Don't connect() to a wildcard address in test_postmaster_connection().

commit   : fed19f312c72778ce7dcbb0670871b22bd06ff85    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 8 Nov 2015 17:28:53 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 8 Nov 2015 17:28:53 -0500    

Click here for diff

At least OpenBSD, NetBSD, and Windows don't support it.  This repairs  
pg_ctl for listen_addresses='0.0.0.0' and listen_addresses='::'.  Since  
pg_ctl prefers to test a Unix-domain socket, Windows users are most  
likely to need this change.  Back-patch to 9.1 (all supported versions).  
This could change pg_ctl interaction with loopback-interface firewall  
rules.  Therefore, in 9.4 and earlier (released branches), activate the  
change only on known-affected platforms.  
  
Reported (bug #13611) and designed by Kondo Yuta.  

M src/bin/pg_ctl/pg_ctl.c

Remove set-but-not-used variables.

commit   : fba60e573e092991dde4f757b88384ab1ec6a0ce    
  
author   : Robert Haas <[email protected]>    
date     : Sat, 7 Nov 2015 20:25:32 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Sat, 7 Nov 2015 20:25:32 -0500    

Click here for diff

Reported by both Peter Eisentraunt and Kevin Grittner.  

M src/backend/executor/tqueue.c

Update 9.5 release notes through today.

commit   : ad9fad7b68c4209db7d73f59a538ffe619c07872    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Nov 2015 17:09:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Nov 2015 17:09:04 -0500    

Click here for diff

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

Add "xid <> xid" and "xid <> int4" operators.

commit   : c5e86ea932794051d2fe3bd26ce4c03981b0b826    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Nov 2015 16:40:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Nov 2015 16:40:15 -0500    

Click here for diff

The corresponding "=" operators have been there a long time, and not  
having their negators is a bit of a nuisance.  
  
Michael Paquier  

M src/backend/utils/adt/xid.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h
M src/test/regress/expected/opr_sanity.out

Rename PQsslAttributes() to PQsslAttributeNames(), and const-ify fully.

commit   : 9042f583429ef880665dd36b7bcad45ba62dea7b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Nov 2015 16:13:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Nov 2015 16:13:49 -0500    

Click here for diff

Per discussion, the original name was a bit misleading, and  
PQsslAttributeNames() seems more apropos.  It's not quite too late to  
change this in 9.5, so let's change it while we can.  
  
Also, make sure that the pointer array is const, not only the pointed-to  
strings.  
  
Minor documentation wordsmithing while at it.  
  
Lars Kanis, slight adjustments by me  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/release-9.5.sgml
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/libpq-fe.h

Fix enforcement of restrictions inside regexp lookaround constraints.

commit   : a43b4ab1111ca5e5f40a2ddd8e56bf999b9fdad9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Nov 2015 12:43:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Nov 2015 12:43:24 -0500    

Click here for diff

Lookahead and lookbehind constraints aren't allowed to contain backrefs,  
and parentheses within them are always considered non-capturing.  Or so  
says the manual.  But the regexp parser forgot about these rules once  
inside a parenthesized subexpression, so that constructs like (\w)(?=(\1))  
were accepted (but then not correctly executed --- a case like this acted  
like (\w)(?=\w), without any enforcement that the two \w's match the same  
text).  And in (?=((foo))) the innermost parentheses would be counted as  
capturing parentheses, though no text would ever be captured for them.  
  
To fix, properly pass down the "type" argument to the recursive invocation  
of parse().  
  
Back-patch to all supported branches; it was agreed that silent  
misexecution of such patterns is worse than throwing an error, even though  
new errors in minor releases are generally not desirable.  

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

Try to convince gcc that TupleQueueRemap never falls off the end.

commit   : 8d7396e5092f1bc6433a38ccabaf88c8c681de11    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Nov 2015 23:04:21 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Nov 2015 23:04:21 -0500    

Click here for diff

Without this, MacOS gcc version 4.2.1 isn't convinced.  

M src/backend/executor/tqueue.c

When completing ALTER INDEX .. SET, add an equals sign also.

commit   : af9773cf4cac235a32341b11864c4a0a9a22b6c1    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Nov 2015 22:59:47 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Nov 2015 22:59:47 -0500    

Click here for diff

Jeff Janes  

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

Modify tqueue infrastructure to support transient record types.

commit   : 6e71dd7ce9766582da453f493bc371d64977282f    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Nov 2015 16:58:45 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Nov 2015 16:58:45 -0500    

Click here for diff

Commit 4a4e6893aa080b9094dadbe0e65f8a75fee41ac6, which introduced this  
mechanism, failed to account for the fact that the RECORD pseudo-type  
uses transient typmods that are only meaningful within a single  
backend.  Transferring such tuples without modification between two  
cooperating backends does not work.  This commit installs a system  
for passing the tuple descriptors over the same shm_mq being used to  
send the tuples themselves.  The two sides might not assign the same  
transient typmod to any given tuple descriptor, so we must also  
substitute the appropriate receiver-side typmod for the one used by  
the sender.  That adds some CPU overhead, but still seems better than  
being unable to pass records between cooperating parallel processes.  
  
Along the way, move the logic for handling multiple tuple queues from  
tqueue.c to nodeGather.c; tqueue.c now provides a TupleQueueReader,  
which reads from a single queue, rather than a TupleQueueFunnel, which  
potentially reads from multiple queues.  This change was suggested  
previously as a way to make sure that nodeGather.c rather than tqueue.c  
had policy control over the order in which to read from queues, but  
it wasn't clear to me until now how good an idea it was.  typmod  
mapping needs to be performed separately for each queue, and it is  
much simpler if the tqueue.c code handles that and leaves multiplexing  
multiple queues to higher layers of the stack.  

M src/backend/executor/nodeGather.c
M src/backend/executor/tqueue.c
M src/include/executor/tqueue.h
M src/include/nodes/execnodes.h
M src/tools/pgindent/typedefs.list

Remove unnecessary cast in previous commit.

commit   : cbb82e370da8e80aa9667ffbb395cabb0529ea00    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Nov 2015 12:17:31 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Nov 2015 12:17:31 -0500    

Click here for diff

Noted by Kyotaro Horiguchi, who also reviewed the previous patch, but  
I failed to notice his review before committing.  

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

Add sort support routine for the UUID data type.

commit   : a76ef15d9fc9207a0758e8d6f6700dc8c931a934    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Nov 2015 12:10:42 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Nov 2015 12:10:42 -0500    

Click here for diff

This introduces a simple encoding scheme to produce abbreviated keys:  
pack as many bytes of each UUID as will fit into a Datum.  On  
little-endian machines, a byteswap is also performed; the abbreviated  
comparator can therefore just consist of a simple 3-way unsigned integer  
comparison.  
  
The purpose of this change is to speed up sorting data on a column  
of type UUID.  
  
Peter Geoghegan  

M src/backend/utils/adt/uuid.c
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h

Set include_realm=1 default in parse_hba_line

commit   : 5644419b3de418f81e4461cbaa06c5d4b5da0800    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 Nov 2015 11:18:27 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 Nov 2015 11:18:27 -0500    

Click here for diff

With include_realm=1 being set down in parse_hba_auth_opt, if multiple  
options are passed on the pg_hba line, such as:  
  
host all     all    0.0.0.0/0    gss include_realm=0 krb_realm=XYZ.COM  
  
We would mistakenly reset include_realm back to 1.  Instead, we need to  
set include_realm=1 up in parse_hba_line, prior to parsing any of the  
additional options.  
  
Discovered by Jeff McCormick during testing.  
  
Bug introduced by 9a08841.  
  
Back-patch to 9.5  

M src/backend/libpq/hba.c

pg_size_pretty: Format negative values similar to positive ones.

commit   : 8a1fab36aba7506fcf4559c4ef95fcacdd0b439a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Nov 2015 11:03:02 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Nov 2015 11:03:02 -0500    

Click here for diff

Previously, negative values were always displayed in bytes, regardless  
of how large they were.  
  
Adrian Vondendriesch, reviewed by Julien Rouhaud and myself  

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

Document interaction of bgworkers with LISTEN/NOTIFY.

commit   : dde5f09fad3ac188a155e21667f76825f43a28c8    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Nov 2015 00:31:03 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Nov 2015 00:31:03 -0500    

Click here for diff

Thomas Munro and Robert Haas, reviewed by Haribabu Kommi  

M doc/src/sgml/bgworker.sgml

Fix erroneous hash calculations in gin_extract_jsonb_path().

commit   : b23af458755ed90ae9164857e59d034bad75a672    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 Nov 2015 18:15:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 Nov 2015 18:15:48 -0500    

Click here for diff

The jsonb_path_ops code calculated hash values inconsistently in some cases  
involving nested arrays and objects.  This would result in queries possibly  
not finding entries that they should find, when using a jsonb_path_ops GIN  
index for the search.  The problem cases involve JSONB values that contain  
both scalars and sub-objects at the same nesting level, for example an  
array containing both scalars and sub-arrays.  To fix, reset the current  
stack->hash after processing each value or sub-object, not before; and  
don't try to be cute about the outermost level's initial hash.  
  
Correcting this means that existing jsonb_path_ops indexes may now be  
inconsistent with the new hash calculation code.  The symptom is the same  
--- searches not finding entries they should find --- but the specific  
rows affected are likely to be different.  Users will need to REINDEX  
jsonb_path_ops indexes to make sure that all searches work as expected.  
  
Per bug #13756 from Daniel Cheng.  Back-patch to 9.4 where the faulty  
logic was introduced.  

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

Fix memory leaks in PL/Python.

commit   : 8c75ad436f75fc629b61f601ba884c8f9313c9af    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 Nov 2015 13:52:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 Nov 2015 13:52:30 -0500    

Click here for diff

Previously, plpython was in the habit of allocating a lot of stuff in  
TopMemoryContext, and it was very slipshod about making sure that stuff  
got cleaned up; in particular, use of TopMemoryContext as fn_mcxt for  
function calls represents an unfixable leak, since we generally don't  
know what the called function might have allocated in fn_mcxt.  This  
results in session-lifespan leakage in certain usage scenarios, as for  
example in a case reported by Ed Behn back in July.  
  
To fix, get rid of all the retail allocations in TopMemoryContext.  
All long-lived allocations are now made in sub-contexts that are  
associated with specific objects (either pl/python procedures, or  
Python-visible objects such as cursors and plans).  We can clean these  
up when the associated object is deleted.  
  
I went so far as to get rid of PLy_malloc completely.  There were a  
couple of places where it could still have been used safely, but on  
the whole it was just an invitation to bad coding.  
  
Haribabu Kommi, based on a draft patch by Heikki Linnakangas;  
some further work by me  

M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_cursorobject.h
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_main.h
M src/pl/plpython/plpy_planobject.c
M src/pl/plpython/plpy_planobject.h
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/plpy_procedure.h
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_subxactobject.c
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/plpy_typeio.h
M src/pl/plpython/plpy_util.c
M src/pl/plpython/plpy_util.h

Pass extra data to bgworkers, and use this to fix parallel contexts.

commit   : 64b2e7ad917a9a7814904d0f6dbde52cefbcfa00    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 5 Nov 2015 12:05:38 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 5 Nov 2015 12:05:38 -0500    

Click here for diff

Up until now, the total amount of data that could be passed to a  
background worker at startup was one datum, which can be a small as  
4 bytes on some systems.  That's enough to pass a dsm_handle or an  
array index, but not much else.  Add a bgw_extra flag to the  
BackgroundWorker struct, allowing up to 128 bytes to be passed to  
a new worker on any platform.  
  
Use this to fix a problem I recently discovered with the parallel  
context machinery added in 9.5: the master assigns each worker an  
array index, and each worker subsequently assigns itself an array  
index, and there's nothing to guarantee that the two sets of indexes  
match, leading to chaos.  
  
Normally, I would not back-patch the change to add bgw_extra, since it  
is basically a feature addition.  However, since 9.5 is still in beta  
and there seems to be no other sensible way to repair the broken  
parallel context machinery, back-patch to 9.5.  Existing background  
worker code can ignore the bgw_extra field without a problem, but  
might need to be recompiled since the structure size has changed.  
  
Report and patch by me.  Review by Amit Kapila.  

M doc/src/sgml/bgworker.sgml
M src/backend/access/transam/parallel.c
M src/backend/postmaster/bgworker.c
M src/include/postmaster/bgworker.h

Improve implementation of GEQO's init_tour() function.

commit   : 59464bd6f928ad0da30502cbe9b54baec9ca2c69    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 Nov 2015 10:46:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 Nov 2015 10:46:14 -0500    

Click here for diff

Rather than filling a temporary array and then copying values to the  
output array, we can generate the required random permutation in-place  
using the Fisher-Yates shuffle algorithm.  This is shorter as well as  
more efficient than before.  It's pretty unlikely that anyone would  
notice a speed improvement, but shorter code is better.  
  
Nathan Wagner, edited a bit by me  

M src/backend/optimizer/geqo/geqo_recombination.c

Update spelling of COPY options

commit   : 7bd099d511d66b55fedced9920357cc5c36811c7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 Nov 2015 21:01:26 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 Nov 2015 21:01:26 -0500    

Click here for diff

The preferred spelling was changed from FORCE QUOTE to FORCE_QUOTE and  
the like, but some code was still referring to the old spellings.  

M src/backend/commands/copy.c
M src/test/regress/expected/copy2.out

Add regression tests for remote execution of extension operators/functions.

commit   : b9f117d6cd3c79780b0c0e57068f0837f7493aa6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 4 Nov 2015 12:03:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 4 Nov 2015 12:03:30 -0500    

Click here for diff

Rather than relying on other extensions to be available for installation,  
let's just add some test objects to the postgres_fdw extension itself  
within the regression script.  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql

Allow postgres_fdw to ship extension funcs/operators for remote execution.

commit   : d89494166351e1fdac77d87c6af500401deb2422    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Nov 2015 18:42:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Nov 2015 18:42:02 -0500    

Click here for diff

The user can whitelist specified extension(s) in the foreign server's  
options, whereupon we will treat immutable functions and operators of those  
extensions as candidates to be sent for remote execution.  
  
Whitelisting an extension in this way basically promises that the extension  
exists on the remote server and behaves compatibly with the local instance.  
We have no way to prove that formally, so we have to rely on the user to  
get it right.  But this seems like something that people can usually get  
right in practice.  
  
We might in future allow functions and operators to be whitelisted  
individually, but extension granularity is a very convenient special case,  
so it got done first.  
  
The patch as-committed lacks any regression tests, which is unfortunate,  
but introducing dependencies on other extensions for testing purposes  
would break "make installcheck" scenarios, which is worse.  I have some  
ideas about klugy ways around that, but it seems like material for a  
separate patch.  For the moment, leave the problem open.  
  
Paul Ramsey, hacked up a bit more by me  

M contrib/postgres_fdw/Makefile
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
A contrib/postgres_fdw/shippable.c
M doc/src/sgml/postgres-fdw.sgml
M src/backend/utils/adt/format_type.c
M src/include/utils/builtins.h

Improve comments about abbreviation abort.

commit   : ee44cb7566ffafc0144535e1f966f5e3bb7d384b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 3 Nov 2015 14:11:49 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 3 Nov 2015 14:11:49 -0500    

Click here for diff

Peter Geoghegan  

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

postgres_fdw: Add ORDER BY to some remote SQL queries.

commit   : f18c944b6137329ac4a6b2dce5745c5dc21a8578    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 3 Nov 2015 12:46:06 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 3 Nov 2015 12:46:06 -0500    

Click here for diff

If the join problem's entire ORDER BY clause can be pushed to the  
remote server, consider a path that adds this ORDER BY clause.  If  
use_remote_estimate is on, we cost this path using an additional  
remote EXPLAIN.  If not, we just estimate that the path costs 20%  
more, which is intended to be large enough that we won't request a  
remote sort when it's not helpful, but small enough that we'll have  
the remote side do the sort when in doubt.  In some cases, the remote  
sort might actually be free, because the remote query plan might  
happen to produce output that is ordered the way we need, but without  
remote estimates we have no way of knowing that.  
  
It might also be useful to request sorted output from the remote side  
if it enables an efficient merge join, but this patch doesn't attempt  
to handle that case.  
  
Ashutosh Bapat with revisions by me.  Also reviewed by Fabrízio de Royes  
Mello and Jeevan Chalke.  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql

Remove obsolete advice about doubling backslashes in regex escapes.

commit   : fc0b8935213cda555d2b3af2ed08da28ed120e31    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Nov 2015 11:57:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Nov 2015 11:57:56 -0500    

Click here for diff

Standard-conforming literals have been the default for long enough that  
it no longer seems necessary to go out of our way to tell people to write  
regex escapes illegibly.  

M doc/src/sgml/func.sgml

Code + docs review for unicode linestyle patch.

commit   : a69b0b2c14c614c129e89ae96d6f624375531760    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Nov 2015 11:49:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Nov 2015 11:49:21 -0500    

Click here for diff

Fix some brain fade in commit a2dabf0e1dda93c8: erroneous variable names  
in docs, rearrangements that made sentences less clear not more so,  
undocumented and poorly-chosen-anyway API behaviors of subroutines,  
bad grammar in error messages, copy-and-paste faults.  
  
Albe Laurenz and Tom Lane  

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

shm_mq: Third attempt at fixing nowait behavior in shm_mq_receive.

commit   : 4efe26cbd3ef0d85656bf00ac9e5bd41cc8a2a36    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 3 Nov 2015 09:12:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 3 Nov 2015 09:12:52 -0500    

Click here for diff

Commit a1480ec1d3bacb9acb08ec09f22bc25bc033115b purported to fix the  
problems with commit b2ccb5f4e6c81305386edb34daf7d1d1e1ee112a, but it  
didn't completely fix them.  The problem is that the checks were  
performed in the wrong order, leading to a race condition.  If the  
sender attached, sent a message, and detached after the receiver  
called shm_mq_get_sender and before the receiver called  
shm_mq_counterparty_gone, we'd incorrectly return SHM_MQ_DETACHED  
before all messages were read.  Repair by reversing the order of  
operations, and add a long comment explaining why this new logic is  
(hopefully) correct.  

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

Correct tiny inaccuracy in strxfrm cache comment.

commit   : 0279f62fdca7ff19ef34a836f5201935dc7f627c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 3 Nov 2015 08:32:22 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 3 Nov 2015 08:32:22 -0500    

Click here for diff

Peter Geoghegan  

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

Remove some more dead Alpha-specific code.

commit   : 620ac88d6fd39c01bd25c90491333f088d186151    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Nov 2015 19:37:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Nov 2015 19:37:51 -0500    

Click here for diff

M src/backend/storage/ipc/Makefile
M src/backend/utils/adt/Makefile

Fix problems with ParamListInfo serialization mechanism.

commit   : 1efc7e538204646fec0f790b683012ed9bd8a99f    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 2 Nov 2015 18:11:29 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 2 Nov 2015 18:11:29 -0500    

Click here for diff

Commit d1b7c1ffe72e86932b5395f29e006c3f503bc53d introduced a mechanism  
for serializing a ParamListInfo structure to be passed to a parallel  
worker.  However, this mechanism failed to handle external expanded  
values, as pointed out by Noah Misch.  Repair.  
  
Moreover, plpgsql_param_fetch requires adjustment because the  
serialization mechanism needs it to skip evaluating unused parameters  
just as we would do when it is called from copyParamList, but params  
== estate->paramLI in that case.  To fix, make the bms_is_member test  
in that function unconditional.  
  
Finally, have setup_param_list set a new ParamListInfo field,  
paramMask, to the parameters actually used in the expression, so that  
we don't try to fetch those that are not needed when serializing a  
parameter list.  This isn't necessary for correctness, but it makes  
the performance of the parallel executor code comparable to what we  
do for cases involving cursors.  
  
Design suggestions and extensive review by Noah Misch.  Patch by me.  

M src/backend/commands/prepare.c
M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/backend/nodes/params.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/datum.c
M src/include/nodes/params.h
M src/pl/plpgsql/src/pl_exec.c

Add RMV to list of commands taking AE lock.

commit   : bf25fb2f93c95e946c5e382eb82ad08ae9d95bd9    
  
author   : Kevin Grittner <[email protected]>    
date     : Mon, 2 Nov 2015 06:23:10 -0600    
  
committer: Kevin Grittner <[email protected]>    
date     : Mon, 2 Nov 2015 06:23:10 -0600    

Click here for diff

Backpatch to 9.3, where it was initially omitted.  
  
Craig Ringer, with minor adjustment by Kevin Grittner  

M doc/src/sgml/mvcc.sgml

Fix serialization anomalies due to race conditions on INSERT.

commit   : 585e2a3b1a57cd7f763a9203e77563c729d6104e    
  
author   : Kevin Grittner <[email protected]>    
date     : Sat, 31 Oct 2015 14:43:34 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Sat, 31 Oct 2015 14:43:34 -0500    

Click here for diff

On insert the CheckForSerializableConflictIn() test was performed  
before the page(s) which were going to be modified had been locked  
(with an exclusive buffer content lock).  If another process  
acquired a relation SIReadLock on the heap and scanned to a page on  
which an insert was going to occur before the page was so locked,  
a rw-conflict would be missed, which could allow a serialization  
anomaly to be missed.  The window between the check and the page  
lock was small, so the bug was generally not noticed unless there  
was high concurrency with multiple processes inserting into the  
same table.  
  
This was reported by Peter Bailis as bug #11732, by Sean Chittenden  
as bug #13667, and by others.  
  
The race condition was eliminated in heap_insert() by moving the  
check down below the acquisition of the buffer lock, which had been  
the very next statement.  Because of the loop locking and unlocking  
multiple buffers in heap_multi_insert() a check was added after all  
inserts were completed.  The check before the start of the inserts  
was left because it might avoid a large amount of work to detect a  
serialization anomaly before performing the all of the inserts and  
the related WAL logging.  
  
While investigating this bug, other SSI bugs which were even harder  
to hit in practice were noticed and fixed, an unnecessary check  
(covered by another check, so redundant) was removed from  
heap_update(), and comments were improved.  
  
Back-patch to all supported branches.  
  
Kevin Grittner and Thomas Munro  

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

Implement lookbehind constraints in our regular-expression engine.

commit   : 12c9a04008870c283931d6b3b648ee21bbc2cfda    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Oct 2015 19:14:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Oct 2015 19:14:19 -0400    

Click here for diff

A lookbehind constraint is like a lookahead constraint in that it consumes  
no text; but it checks for existence (or nonexistence) of a match *ending*  
at the current point in the string, rather than one *starting* at the  
current point.  This is a long-requested feature since it exists in many  
other regex libraries, but Henry Spencer had never got around to  
implementing it in the code we use.  
  
Just making it work is actually pretty trivial; but naive copying of the  
logic for lookahead constraints leads to code that often spends O(N^2) time  
to scan an N-character string, because we have to run the match engine  
from string start to the current probe point each time the constraint is  
checked.  In typical use-cases a lookbehind constraint will be written at  
the start of the regex and hence will need to be checked at every character  
--- so O(N^2) work overall.  To fix that, I introduced a third copy of the  
core DFA matching loop, paralleling the existing longest() and shortest()  
loops.  This version, matchuntil(), can suspend and resume matching given  
a couple of pointers' worth of storage space.  So we need only run it  
across the string once, stopping at each interesting probe point and then  
resuming to advance to the next one.  
  
I also put in an optimization that simplifies one-character lookahead and  
lookbehind constraints, such as "(?=x)" or "(?<!\w)", into AHEAD and BEHIND  
constraints, which already existed in the engine.  This avoids the overhead  
of the LACON machinery entirely for these rather common cases.  
  
The net result is that lookbehind constraints run a factor of three or so  
slower than Perl's for multi-character constraints, but faster than Perl's  
for one-character constraints ... and they work fine for variable-length  
constraints, which Perl gives up on entirely.  So that's not bad from a  
competitive perspective, and there's room for further optimization if  
anyone cares.  (In reality, raw scan rate across a large input string is  
probably not that big a deal for Postgres usage anyway; so I'm happy if  
it's linear.)  

M doc/src/sgml/func.sgml
M src/backend/regex/README
M src/backend/regex/re_syntax.n
M src/backend/regex/regc_lex.c
M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c
M src/backend/regex/rege_dfa.c
M src/backend/regex/regexec.c
M src/backend/regex/regexport.c
M src/backend/regex/regprefix.c
M src/include/regex/regex.h
M src/include/regex/regguts.h
M src/test/regress/expected/regex.out
M src/test/regress/sql/regex.sql

doc: security_barrier option is a Boolean, not a string.

commit   : c5057b2b34813ca114bc808cb56b7a7fcde64393    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 30 Oct 2015 12:18:55 +0100    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 30 Oct 2015 12:18:55 +0100    

Click here for diff

Mistake introduced by commit 5bd91e3a835b5d5499fee5f49fc7c0c776fe63dd.  
  
Hari Babu  

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

Update parallel executor support to reuse the same DSM.

commit   : 3a1f8611f2582df0a16bcd35caed2e1526387643    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 30 Oct 2015 10:43:00 +0100    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 30 Oct 2015 10:43:00 +0100    

Click here for diff

Commit b0b0d84b3d663a148022e900ebfc164284a95f55 purported to make it  
possible to relaunch workers using the same parallel context, but it had  
an unpleasant race condition: we might reinitialize after the workers  
have sent their last control message but before they have dettached the  
DSM, leaving to crashes.  Repair by introducing a new ParallelContext  
operation, ReinitializeParallelDSM.  
  
Adjust execParallel.c to use this new support, so that we can rescan a  
Gather node by relaunching workers but without needing to recreate the  
DSM.  
  
Amit Kapila, with some adjustments by me.  Extracted from latest parallel  
sequential scan patch.  

M src/backend/access/transam/README.parallel
M src/backend/access/transam/parallel.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeGather.c
M src/include/access/parallel.h
M src/include/executor/execParallel.h

Fix typo in bgworker.c

commit   : c6baec92fc48387da8164d50f5699a7162267718    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 30 Oct 2015 10:35:33 +0100    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 30 Oct 2015 10:35:33 +0100    

Click here for diff

M src/backend/postmaster/bgworker.c

Docs: add example clarifying use of nested JSON containment.

commit   : 23937a4253490bf0c06aef0b8658270176f52de4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Oct 2015 18:54:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Oct 2015 18:54:35 -0400    

Click here for diff

Show how this can be used in practice to make queries simpler and more  
flexible.  Also, draw an explicit contrast to the existence operator,  
which doesn't work that way.  
  
Peter Geoghegan and Tom Lane  

M doc/src/sgml/json.sgml

Remove some remains from Alpha support removal

commit   : c5130e8ee09e5ae605f3aa944a31dd9021c1d3dd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 29 Oct 2015 16:40:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Oct 2015 16:40:14 -0400    

Click here for diff

M src/template/freebsd

Message style improvements

commit   : a8d585c0915939a42acdb529d8e0eb832935d45f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Oct 2015 20:23:53 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Oct 2015 20:23:53 -0400    

Click here for diff

Message style, plurals, quoting, spelling, consistency with similar  
messages  

M contrib/test_decoding/expected/binary.out
M src/backend/access/transam/multixact.c
M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/copy.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/vacuumlazy.c
M src/backend/executor/execMain.c
M src/backend/parser/parse_clause.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/misc.c
M src/bin/psql/command.c
M src/test/modules/test_rls_hooks/expected/test_rls_hooks.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/matview.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/updatable_views.out

Add missing serial comma, for consistency.

commit   : d45565162494c75eae91481eda17dc0c8ecab5db    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Oct 2015 12:19:14 +0100    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Oct 2015 12:19:14 +0100    

Click here for diff

Amit Langote, per Etsuro Fujita  

M src/backend/commands/tablecmds.c

Fix incorrect message in ATWrongRelkindError.

commit   : 9dcce7123e1b0012fcf7f8b8761b34aebb66986d    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Oct 2015 11:44:47 +0100    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Oct 2015 11:44:47 +0100    

Click here for diff

Mistake introduced by commit 3bf3ab8c563699138be02f9dc305b7b77a724307.  
  
Etsuro Fujita  

M src/backend/commands/tablecmds.c

Fix secondary expected output for commit_ts test

commit   : dbe6f434ee1852f08c011065467a6cfc5ce10864    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 23:02:04 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 23:02:04 -0300    

Click here for diff

Per red wall in buildfarm  

M src/test/modules/commit_ts/expected/commit_timestamp_1.out

Make Gather node projection-capable.

commit   : 8538a6307049590ddb5ba127b2ecac6308844d60    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Oct 2015 00:27:58 +0100    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Oct 2015 00:27:58 +0100    

Click here for diff

The original Gather code failed to mark a Gather node as not able to  
do projection, but it couldn't, even though it did call initialize its  
projection info via ExecAssignProjectionInfo.  There doesn't seem to  
be any good reason for this node not to have projection capability,  
so clean things up so that it does.  Without this, plans using Gather  
nodes might need to carry extra Result nodes to do projection.  

M src/backend/executor/nodeGather.c
M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/execnodes.h

Document BRIN's inclusion opclass framework

commit   : c15898c1d5d53602de097905a90f3dd176e8e7fd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 19:03:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 19:03:15 -0300    

Click here for diff

Backpatch to 9.5 -- this should have been part of b0b7be61337, but we  
didn't have 38b03caebc5de either at the time.  
  
Author: Emre Hasegeli  
Revised by: Ian Barwick  
Discussion:  
 http://www.postgresql.org/message-id/CAE2gYzyB39Q9up_-TO6FKhH44pcAM1x6n_Cuj15qKoLoFihUVg@mail.gmail.com  
 http://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/brin.sgml

Fix BRIN free space computations

commit   : 21a4e4a4c9fe417e2462b6f90f6b0e49e32ceba6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 18:17:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 18:17:55 -0300    

Click here for diff

A bug in the original free space computation made it possible to  
return a page which wasn't actually able to fit the item.  Since the  
insertion code isn't prepared to deal with PageAddItem failing, a PANIC  
resulted ("failed to add BRIN tuple [to new page]").  Add a macro to  
encapsulate the correct computation, and use it in  
brin_getinsertbuffer's callers before calling that routine, to raise an  
early error.  
  
I became aware of the possiblity of a problem in this area while working  
on ccc4c074994d734.  There's no archived discussion about it, but it's  
easy to reproduce a problem in the unpatched code with something like  
  
CREATE TABLE t (a text);  
CREATE INDEX ti ON t USING brin (a) WITH (pages_per_range=1);  
  
for length in `seq 8000 8196`  
do  
	psql -f - <<EOF  
TRUNCATE TABLE t;  
INSERT INTO t VALUES ('z'), (repeat('a', $length));  
EOF  
done  
  
Backpatch to 9.5, where BRIN was introduced.  

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

Cleanup commit timestamp module activaction, again

commit   : 531d21b75ff6b18ea8638c736a05326ebd519f49    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 15:06:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 15:06:50 -0300    

Click here for diff

Further tweak commit_ts.c so that on a standby the state is completely  
consistent with what that in the master, rather than behaving  
differently in the cases that the settings differ.  Now in standby and  
master the module should always be active or inactive in lockstep.  
  
Author: Petr Jelínek, with some further tweaks by Álvaro Herrera.  
  
Backpatch to 9.5, where commit timestamps were introduced.  
  
Discussion: http://www.postgresql.org/message-id/[email protected]  

M src/backend/access/transam/commit_ts.c
M src/backend/commands/vacuum.c
M src/include/access/commit_ts.h

Measure string lengths only once

commit   : 0cd836a4e818f049716e47fe81bf5d4800509c57    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 13:20:40 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 13:20:40 -0300    

Click here for diff

Bernd Helmle complained that CreateReplicationSlot() was assigning the  
same value to the same variable twice, so we could remove one of them.  
Code inspection reveals that we can actually remove both assignments:  
according to the author the assignment was there for beauty of the  
strlen line only, and another possible fix to that is to put the strlen  
in its own line, so do that.  
  
To be consistent within the file, refactor all duplicated strlen()  
calls, which is what we do elsewhere in the backend anyway.  In  
basebackup.c, snprintf already returns the right length; no need for  
strlen afterwards.  
  
Backpatch to 9.4, where replication slots were introduced, to keep code  
identical.  Some of this is older, but the patch doesn't apply cleanly  
and it's only of cosmetic value anyway.  
  
Discussion: http://www.postgresql.org/message-id/[email protected]  

M src/backend/replication/basebackup.c
M src/backend/replication/walsender.c

shm_mq: Repair breakage from previous commit.

commit   : a1480ec1d3bacb9acb08ec09f22bc25bc033115b    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 22:01:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 22:01:11 -0400    

Click here for diff

If the counterparty writes some data into the queue and then detaches,  
it's wrong to return SHM_MQ_DETACHED right away.  If we do that, we  
fail to read whatever was written.  

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

Add two missing cases to ATWrongRelkindError.

commit   : 872101bede26444324059ba0f27c3b1c8b8140f6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 17:00:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 17:00:53 -0400    

Click here for diff

This way, we produce a better error message if someone tries to do  
something like ALTER INDEX .. ALTER COLUMN .. SET STORAGE.  
  
Amit Langote  

M src/backend/commands/tablecmds.c

shm_mq: Fix failure to notice a dead counterparty when nowait is used.

commit   : b2ccb5f4e6c81305386edb34daf7d1d1e1ee112a    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 16:33:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 16:33:30 -0400    

Click here for diff

The shm_mq mechanism was intended to optionally notice when the process  
on the other end of the queue fails to attach to the queue.  It does  
this by allowing the user to pass a BackgroundWorkerHandle; if the  
background worker in question is launched and dies without attaching  
to the queue, then we know it never will.  This logic works OK in  
blocking mode, but when called with nowait = true we fail to notice  
that this has happened due to an asymmetry in the logic.  Repair.  
  
Reported off-list by Rushabh Lathia.  Patch by me.  

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

Fix typos in comments.

commit   : 31ba62ce32940146b6c818e9bf30b2555797c43d    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 14:51:49 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 14:51:49 -0400    

Click here for diff

CharSyam  

M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/executor/nodeGather.c
M src/backend/parser/parse_utilcmd.c

doc: Add advice on updating checkpoint_segments to max_wal_size

commit   : 8f2977b3ec2fbb98ee36045d4e2be81ca4c293e0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Oct 2015 13:59:58 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Oct 2015 13:59:58 -0400    

Click here for diff

with suggestion from Michael Paquier  

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

Remove redundant CREATEUSER/NOCREATEUSER options in CREATE ROLE et al.

commit   : d371bebd3d16949171282c8252dfd6f82d2e7378    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Oct 2015 09:33:51 -0700    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Oct 2015 09:33:51 -0700    

Click here for diff

Once upon a time we did not have a separate CREATEROLE privilege, and  
CREATEUSER effectively meant SUPERUSER.  When we invented CREATEROLE  
(in 8.1) we also added SUPERUSER so as to have a less confusing keyword  
for this role property.  However, we left CREATEUSER in place as a  
deprecated synonym for SUPERUSER, because of backwards-compatibility  
concerns.  It's still there and is still confusing people, as for example  
in bug #13694 from Justin Catterson.  9.6 will be ten years or so later,  
which surely ought to be long enough to end the deprecation and just  
remove these old keywords.  Hence, do so.  

M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/alter_user.sgml
M doc/src/sgml/ref/create_group.sgml
M doc/src/sgml/ref/create_role.sgml
M doc/src/sgml/ref/create_user.sgml
M src/backend/parser/gram.y
M src/backend/utils/mb/conversion_procs/regress_prolog
M src/bin/psql/tab-complete.c
M src/test/regress/expected/conversion.out
M src/test/regress/sql/conversion.sql

commit   : bde39eed0cafb82bc94c40e95d96b5cf47b6f719    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 10:49:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 10:49:20 -0400    

Click here for diff

Commit 816e336f12ecabdc834d4cc31bcf966b2dd323dc added the wrong error  
check to async.c; sending restrictions is restricted to the leader,  
not altogether unsafe.  
  
Commit 3bd909b220930f21d6e15833a17947be749e7fde added ExecShutdownNode  
to traverse the planstate tree and call shutdown functions, but made  
a Gather node, the only node that actually has such a function, abort  
the tree traversal, which is wrong.  

M src/backend/commands/async.c
M src/backend/executor/execProcnode.c

Add header comments to execParallel.c and nodeGather.c.

commit   : 1a219fa15bf802d69621e71c43d1a09515bcdc50    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 10:37:24 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 10:37:24 -0400    

Click here for diff

Patch by me, per a note from Simon Riggs.  Reviewed by Amit Kapila  
and Amit Langote.  

M src/backend/executor/execParallel.c
M src/backend/executor/nodeGather.c

doc: Improve markup and fine-tune replication protocol documentation

commit   : e4a618aa1ec420f40198e89ef1afd7a4e8cfcecf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Oct 2015 22:31:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Oct 2015 22:31:56 -0400    

Click here for diff

M doc/src/sgml/protocol.sgml

Fix incorrect translation of minus-infinity datetimes for json/jsonb.

commit   : d4355425831fe8f6a68095393e3628cb30d06b3f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Oct 2015 11:06:24 -0700    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Oct 2015 11:06:24 -0700    

Click here for diff

Commit bda76c1c8cfb1d11751ba6be88f0242850481733 caused both plus and  
minus infinity to be rendered as "infinity", which is not only wrong  
but inconsistent with the pre-9.4 behavior of to_json().  Fix that by  
duplicating the coding in date_out/timestamp_out/timestamptz_out more  
closely.  Per bug #13687 from Stepan Perlov.  Back-patch to 9.4, like  
the previous commit.  
  
In passing, also re-pgindent json.c, since it had gotten a bit messed up by  
recent patches (and I was already annoyed by indentation-related problems  
in back-patching this fix ...)  

M src/backend/utils/adt/date.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

doc: Move documentation of max_wal_size to better position

commit   : 984ae04a2c35e4cd0066ef2e2fb364299ff51c36    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Oct 2015 13:33:39 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Oct 2015 13:33:39 -0400    

Click here for diff

M doc/src/sgml/config.sgml

Fix incorrect comment in plannodes.h

commit   : a1c466c5dd75002eb482b10fd0cafef7c6e3f697    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 11:11:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 11:11:35 -0400    

Click here for diff

Etsuro Fujita  

M src/include/nodes/plannodes.h

Remove duplicate word.

commit   : dc486fb96968a519cc6e0d90654b46738026ee5c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 10:29:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 10:29:19 -0400    

Click here for diff

Amit Langote  

M src/backend/executor/execIndexing.c

Tab complete CREATE EXTENSION .. VERSION.

commit   : 7c0b49cd03fdb6bbedada6c5e6439cb4cd6872c3    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 10:27:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 10:27:20 -0400    

Click here for diff

Jeff Janes  

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

Put back ssl_renegotiation_limit parameter, but only allow 0.

commit   : 84ef9c596e0ef7476cd995349767204022610466    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 09:56:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 09:56:04 -0400    

Click here for diff

Per a report from Shay Rojansky, Npgsql sends ssl_renegotiation_limit=0  
in the startup packet because it does not support renegotiation; other  
clients which have not attempted to support renegotiation might well  
behave similarly.  The recent removal of this parameter forces them to  
break compatibility with either current PostgreSQL versions, or  
previous ones.  Per discussion, the best solution is to accept the  
parameter but only allow a value of 0.  
  
Shay Rojansky, edited a little by me.  

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

Be a bit more rigorous about how we cache strcoll and strxfrm results.

commit   : 5be94a9eb15a03d8dbc4a5b52760c8776eb3525e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 09:27:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 09:27:50 -0400    

Click here for diff

Commit 0e57b4d8bd9674adaf5747421b3255b85e385534 contained some clever  
logic that attempted to make sure that we couldn't get confused about  
whether the last thing we cached was a strcoll() result or a strxfrm()  
result, but it wasn't quite clever enough, because we can perform  
further abbreviations after having already performed some comparisons.  
Introduce an explicit flag in the hopes of making this watertight.  
  
Peter Geoghegan, reviewed by me.  

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

Remove obsolete comment.

commit   : d53f808e7eacca1036f9f6b5a271a6269949445d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 09:15:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 09:15:13 -0400    

Click here for diff

Peter Geoghegan  

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

Eschew "RESET statement_timeout" in tests.

commit   : 8e3b4d9d40244c037bbc6e182ea3fabb9347d482    
  
author   : Noah Misch <[email protected]>    
date     : Tue, 20 Oct 2015 00:37:22 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Tue, 20 Oct 2015 00:37:22 -0400    

Click here for diff

Instead, use transaction abort.  Given an unlucky bout of latency, the  
timeout would cancel the RESET itself.  Buildfarm members gharial,  
lapwing, mereswine, shearwater, and sungazer witness that.  Back-patch  
to 9.1 (all supported versions).  The query_canceled test still could  
timeout before entering its subtransaction; for whatever reason, that  
has yet to happen on the buildfarm.  

M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/prepared_xacts.out
M src/test/regress/expected/prepared_xacts_1.out
M src/test/regress/sql/plpgsql.sql
M src/test/regress/sql/prepared_xacts.sql

Fix incorrect handling of lookahead constraints in pg_regprefix().

commit   : 9f1e642d50b30ec5c9604b6095073012a9a73e93    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Oct 2015 13:54:53 -0700    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Oct 2015 13:54:53 -0700    

Click here for diff

pg_regprefix was doing nothing with lookahead constraints, which would  
be fine if it were the right kind of nothing, but it isn't: we have to  
terminate our search for a fixed prefix, not just pretend the LACON arc  
isn't there.  Otherwise, if the current state has both a LACON outarc and a  
single plain-color outarc, we'd falsely conclude that the color represents  
an addition to the fixed prefix, and generate an extracted index condition  
that restricts the indexscan too much.  (See added regression test case.)  
  
Terminating the search is conservative: we could traverse the LACON arc  
(thus assuming that the constraint can be satisfied at runtime) and then  
examine the outarcs of the linked-to state.  But that would be a lot more  
work than it seems worth, because writing a LACON followed by a single  
plain character is a pretty silly thing to do.  
  
This makes a difference only in rather contrived cases, but it's a bug,  
so back-patch to all supported branches.  

M src/backend/regex/regprefix.c
M src/test/regress/expected/regex.out
M src/test/regress/sql/regex.sql

Add a C API for parallel heap scans.

commit   : ee7ca559fcf404f9a3bd99da85c8f4ea9fbc2e92    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 17:25:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 17:25:02 -0400    

Click here for diff

Using this API, one backend can set up a ParallelHeapScanDesc to  
which multiple backends can then attach.  Each tuple in the relation  
will be returned to exactly one of the scanning backends.  Only  
forward scans are supported, and rescans must be carefully  
coordinated.  
  
This is not exposed to the planner or executor yet.  
  
The original version of this code was written by me.  Amit Kapila  
reviewed it, tested it, and improved it, including adding support for  
synchronized scans, per review comments from Jeff Davis.  Extensive  
testing of this and related patches was performed by Haribabu Kommi.  
Final cleanup of this patch by me.  

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

Allow a parallel context to relaunch workers.

commit   : b0b0d84b3d663a148022e900ebfc164284a95f55    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 17:18:05 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 17:18:05 -0400    

Click here for diff

This may allow some callers to avoid the overhead involved in tearing  
down a parallel context and then setting up a new one, which means  
releasing the DSM and then allocating and populating a new one.  I  
suspect we'll want to revise the Gather node to make use of this new  
capability, but even if not it may be useful elsewhere and requires  
very little additional code.  

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

Miscellaneous cleanup of regular-expression compiler.

commit   : afdfcd3f7617c9b7be5966d66ddabdc2e92eb99b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 15:52:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 15:52:12 -0400    

Click here for diff

Revert our previous addition of "all" flags to copyins() and copyouts();  
they're no longer needed, and were never anything but an unsightly hack.  
  
Improve a couple of infelicities in the REG_DEBUG code for dumping  
the NFA data structure, including adding code to count the total  
number of states and arcs.  
  
Add a couple of missed error checks.  
  
Add some more documentation in the README file, and some regression tests  
illustrating cases that exceeded the state-count limit and/or took  
unreasonable amounts of time before this set of patches.  
  
Back-patch to all supported branches.  

M src/backend/regex/README
M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c
M src/test/regress/expected/regex.out
M src/test/regress/sql/regex.sql

Improve memory-usage accounting in regular-expression compiler.

commit   : 538b3b8b359fa77cb7e1507113efb788b4e159c9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 15:36:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 15:36:16 -0400    

Click here for diff

This code previously counted the number of NFA states it created, and  
complained if a limit was exceeded, so as to prevent bizarre regex patterns  
from consuming unreasonable time or memory.  That's fine as far as it went,  
but the code paid no attention to how many arcs linked those states.  Since  
regexes can be contrived that have O(N) states but will need O(N^2) arcs  
after fixempties() processing, it was still possible to blow out memory,  
and take a long time doing it too.  To fix, modify the bookkeeping to count  
space used by both states and arcs.  
  
I did not bother with including the "color map" in the accounting; it  
can only grow to a few megabytes, which is not a lot in comparison to  
what we're allowing for states+arcs (about 150MB on 64-bit machines  
or half that on 32-bit machines).  
  
Looking at some of the larger real-world regexes captured in the Tcl  
regression test suite suggests that the most that is likely to be needed  
for regexes found in the wild is under 10MB, so I believe that the current  
limit has enough headroom to make it okay to keep it as a hard-wired limit.  
  
In connection with this, redefine REG_ETOOBIG as meaning "regular  
expression is too complex"; the previous wording of "nfa has too many  
states" was already somewhat inapropos because of the error code's use  
for stack depth overrun, and it was not very user-friendly either.  
  
Back-patch to all supported branches.  

M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c
M src/include/regex/regerrs.h
M src/include/regex/regex.h
M src/include/regex/regguts.h

Improve performance of pullback/pushfwd in regular-expression compiler.

commit   : 6a7153661d66a00a03ff117c24fa49480b0699c8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 15:11:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 15:11:49 -0400    

Click here for diff

The previous coding would create a new intermediate state every time it  
wanted to interchange the ordering of two constraint arcs.  Certain regex  
features such as \Y can generate large numbers of parallel constraint arcs,  
and if we needed to reorder the results of that, we created unreasonable  
numbers of intermediate states.  To improve matters, keep a list of  
already-created intermediate states associated with the state currently  
being considered by the outer loop; we can re-use such states to place all  
the new arcs leading to the same destination or source.  
  
I also took the trouble to redefine push() and pull() to have a less risky  
API: they no longer delete any state or arc that the caller might possibly  
have a pointer to, except for the specifically-passed constraint arc.  
This reduces the risk of re-introducing the same type of error seen in  
the failed patch for CVE-2007-4772.  
  
Back-patch to all supported branches.  

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

Improve performance of fixempties() pass in regular-expression compiler.

commit   : f5b7d103bc4a97a64f9e8ca83192a96767d9a34c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 14:58:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 14:58:10 -0400    

Click here for diff

The previous coding took something like O(N^4) time to fully process a  
chain of N EMPTY arcs.  We can't really do much better than O(N^2) because  
we have to insert about that many arcs, but we can do lots better than  
what's there now.  The win comes partly from using mergeins() to amortize  
de-duplication of arcs across multiple source states, and partly from  
exploiting knowledge of the ordering of arcs for each state to avoid  
looking at arcs we don't need to consider during the scan.  We do have  
to be a bit careful of the possible reordering of arcs introduced by  
the sort-merge coding of the previous commit, but that's not hard to  
deal with.  
  
Back-patch to all supported branches.  

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

Fix O(N^2) performance problems in regular-expression compiler.

commit   : 579840ca05e73ac23a3c2616f050333ba853fb34    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 14:43:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 14:43:17 -0400    

Click here for diff

Change the singly-linked in-arc and out-arc lists to be doubly-linked,  
so that arc deletion is constant time rather than having worst-case time  
proportional to the number of other arcs on the connected states.  
  
Modify the bulk arc transfer operations copyins(), copyouts(), moveins(),  
moveouts() so that they use a sort-and-merge algorithm whenever there's  
more than a small number of arcs to be copied or moved.  The previous  
method is O(N^2) in the number of arcs involved, because it performs  
duplicate checking independently for each copied arc.  The new method may  
change the ordering of existing arcs for the destination state, but nothing  
really cares about that.  
  
Provide another bulk arc copying method mergeins(), which is unused as  
of this commit but is needed for the next one.  It basically is like  
copyins(), but the source arcs might not all come from the same state.  
  
Replace the O(N^2) bubble-sort algorithm used in carcsort() with a qsort()  
call.  
  
These changes greatly improve the performance of regex compilation for  
large or complex regexes, at the cost of extra space for arc storage during  
compilation.  The original tradeoff was probably fine when it was made, but  
now we care more about speed and less about memory consumption.  
  
Back-patch to all supported branches.  

M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c
M src/include/regex/regguts.h

Fix regular-expression compiler to handle loops of constraint arcs.

commit   : 48789c5d23a7f382e3cb721547d5e0af7aaa4585    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 14:14:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 14:14:40 -0400    

Click here for diff

It's possible to construct regular expressions that contain loops of  
constraint arcs (that is, ^ $ AHEAD BEHIND or LACON arcs).  There's no use  
in fully traversing such a loop at execution, since you'd just end up in  
the same NFA state without having consumed any input.  Worse, such a loop  
leads to infinite looping in the pullback/pushfwd stage of compilation,  
because we keep pushing or pulling the same constraints around the loop  
in a vain attempt to move them to the pre or post state.  Such looping was  
previously recognized in CVE-2007-4772; but the fix only handled the case  
of trivial single-state loops (that is, a constraint arc leading back to  
its source state) ... and not only that, it was incorrect even for that  
case, because it broke the admittedly-not-very-clearly-stated API contract  
of the pull() and push() subroutines.  The first two regression test cases  
added by this commit exhibit patterns that result in assertion failures  
because of that (though there seem to be no ill effects in non-assert  
builds).  The other new test cases exhibit multi-state constraint loops;  
in an unpatched build they will run until the NFA state-count limit is  
exceeded.  
  
To fix, remove the code added for CVE-2007-4772, and instead create a  
general-purpose constraint-loop-breaking phase of regex compilation that  
executes before we do pullback/pushfwd.  Since we never need to traverse  
a constraint loop fully, we can just break the loop at any chosen spot,  
if we add clone states that can replicate any sequence of arc transitions  
that would've traversed just part of the loop.  
  
Also add some commentary clarifying why we have to have all these  
machinations in the first place.  
  
This class of problems has been known for some time --- we had a report  
from Marc Mamin about two years ago, for example, and there are related  
complaints in the Tcl bug tracker.  I had discussed a fix of this kind  
off-list with Henry Spencer, but didn't get around to doing something  
about it until the issue was rediscovered by Greg Stark recently.  
  
Back-patch to all supported branches.  

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

Remove volatile qualifiers from proc.c and procarray.c

commit   : d53e3d5fe0b97ebcec5340dc4f44faf2b1a5d52f    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 14:20:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 14:20:36 -0400    

Click here for diff

Prior to commit 0709b7ee72e4bc71ad07b7120acd117265ab51d0, access to  
variables within a spinlock-protected critical section had to be done  
through a volatile pointer, but that should no longer be necessary.  
  
Michael Paquier  

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

Remove volatile qualifiers from dynahash.c, shmem.c, and sinvaladt.c

commit   : 430008b5a7ac395ab3057377104148e80718045c    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 14:12:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 14:12:20 -0400    

Click here for diff

Prior to commit 0709b7ee72e4bc71ad07b7120acd117265ab51d0, access to  
variables within a spinlock-protected critical section had to be done  
through a volatile pointer, but that should no longer be necessary.  
  
Thomas Munro  

M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/utils/hash/dynahash.c

Remove cautions about using volatile from spin.h.

commit   : 78652a3332128c89ae369e03698f7212ca73d022    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 14:06:22 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 14:06:22 -0400    

Click here for diff

Commit 0709b7ee72e4bc71ad07b7120acd117265ab51d0 obsoleted this comment  
but neglected to update it.  
  
Thomas Munro  

M src/include/storage/spin.h

Prohibit parallel query when the isolation level is serializable.

commit   : a53c06a13eb4669d08ce8a5199aee51f88dd453e    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 11:58:27 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 11:58:27 -0400    

Click here for diff

In order for this to be safe, the code which hands true serializability  
will need to taught that the SIRead locks taken by a parallel worker  
pertain to the same transaction as those taken by the parallel leader.  
Some further changes may be needed as well.  Until the necessary  
adaptations are made, don't generate parallel plans in serializable  
mode, and if a previously-generated parallel plan is used after  
serializable mode has been activated, run it serially.  
  
This fixes a bug in commit 7aea8e4f2daa4b39ca9d1309a0c4aadb0f7ed81b.  

M src/backend/access/transam/parallel.c
M src/backend/optimizer/plan/planner.c

Rewrite interaction of parallel mode with parallel executor support.

commit   : bfc78d7196eb28cd4e3d6c24f7e607bacecf1129    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 11:56:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 11:56:02 -0400    

Click here for diff

In the previous coding, before returning from ExecutorRun, we'd shut  
down all parallel workers.  This was dead wrong if ExecutorRun was  
called with a non-zero tuple count; it had the effect of truncating  
the query output.  To fix, give ExecutePlan control over whether to  
enter parallel mode, and have it refuse to do so if the tuple count  
is non-zero.  Rewrite the Gather logic so that it can cope with being  
called outside parallel mode.  
  
Commit 7aea8e4f2daa4b39ca9d1309a0c4aadb0f7ed81b is largely to blame  
for this problem, though this patch modifies some subsequently-committed  
code which relied on the guarantees it purported to make.  

M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeGather.c
M src/include/executor/execParallel.h
M src/include/nodes/execnodes.h

Mark more functions parallel-restricted or parallel-unsafe.

commit   : 816e336f12ecabdc834d4cc31bcf966b2dd323dc    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 11:48:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 11:48:48 -0400    

Click here for diff

Commit 7aea8e4f2daa4b39ca9d1309a0c4aadb0f7ed81b was overoptimistic  
about the degree of safety associated with running various functions  
in parallel mode.  Functions that take a table name or OID as an  
argument are at least parallel-restricted, because the table might be  
temporary, and we currently don't allow parallel workers to touch  
temporary tables.  Functions that take a query as an argument are  
outright unsafe, because the query could be anything, including a  
parallel-unsafe query.  
  
Also, the queue of pending notifications is backend-private, so adding  
to it from a worker doesn't behave correctly.  We could fix this by  
transferring the worker's queue of pending notifications to the master  
during worker cleanup, but that seems like more trouble than it's  
worth for now.  In addition to adjusting the pg_proc.h markings, also  
add an explicit check for this in async.c.  

M src/backend/commands/async.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h

Fix a problem with parallel workers being unable to restore role.

commit   : 82b37765c76b8b2daf6cad3dfb5e5b4a2776d56f    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 11:37:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 11:37:19 -0400    

Click here for diff

check_role() tries to verify that the user has permission to become the  
requested role, but this is inappropriate in a parallel worker, which  
needs to exactly recreate the master's authorization settings.  So skip  
the check in that case.  
  
This fixes a bug in commit 924bcf4f16d54c55310b28f77686608684734f42.  

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

Invalidate caches after cranking up a parallel worker transaction.

commit   : 6de6d96d971c76c8d7bd3b31e6f182906137f913    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 11:31:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 11:31:23 -0400    

Click here for diff

Starting a parallel worker transaction changes our notion of which XIDs  
are in-progress or committed, and our notion of the current command  
counter ID.  Therefore, our view of these caches prior to starting  
this transaction may no longer valid.  Defend against that by clearing  
them.  
  
This fixes a bug in commit 924bcf4f16d54c55310b28f77686608684734f42.  

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

Fix order of arguments in ecpg generated typedef command.

commit   : d07fea542f18f3d4bc5413a5fc23d69b9fcb631c    
  
author   : Michael Meskes <[email protected]>    
date     : Fri, 16 Oct 2015 17:29:05 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Fri, 16 Oct 2015 17:29:05 +0200    

Click here for diff

M src/interfaces/ecpg/preproc/ecpg.trailer

Tighten up application of parallel mode checks.

commit   : 94b4f7e2a635c3027a23b07086f740615b56aa64    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 09:59:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 09:59:57 -0400    

Click here for diff

Commit 924bcf4f16d54c55310b28f77686608684734f42 failed to enforce  
parallel mode checks during the commit of a parallel worker, because  
we exited parallel mode prior to ending the transaction so that we  
could pop the active snapshot.  Re-establish parallel mode during  
parallel worker commit.  Without this, it's far too easy for unsafe  
actions during the pre-commit sequence to crash the server instead of  
hitting the error checks as intended.  
  
Just to be extra paranoid, adjust a couple of the sanity checks in  
xact.c to check not only IsInParallelMode() but also  
IsParallelWorker().  

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

Transfer current command counter ID to parallel workers.

commit   : 423ec0877ff29bc78e48e50362dbcde351a1f025    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 09:53:34 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 09:53:34 -0400    

Click here for diff

Commit 924bcf4f16d54c55310b28f77686608684734f42 correctly forbade  
parallel workers to modify the command counter while in parallel mode,  
but it inexplicably neglected to actually transfer the current command  
counter from leader to workers.  This can result in the workers seeing  
a different set of tuples from the leader, which is bad.  Repair.  

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

Don't send protocol messages to a shm_mq that no longer exists.

commit   : 2ad5c27bb565c26a4b12ea3343331c80f121f269    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 09:42:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 09:42:33 -0400    

Click here for diff

Commit 2bd9e412f92bc6a68f3e8bcb18e04955cc35001d introduced a mechanism  
for relaying protocol messages from a background worker to another  
backend via a shm_mq.  However, there was no provision for shutting  
down the communication channel.  Therefore, a protocol message sent  
late in the shutdown sequence, such as a DEBUG message resulting from  
cranking up log_min_messages, could crash the server.  To fix, install  
an on_dsm_detach callback that disables sending messages to the shm_mq  
when the associated DSM is detached.  

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

Fix NULL handling in datum_to_jsonb().

commit   : 3587cbc34fe87e1bde6c202daba791b68e44cb3a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Oct 2015 13:46:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Oct 2015 13:46:09 -0400    

Click here for diff

The function failed to adhere to its specification that the "tcategory"  
argument should not be examined when the input value is NULL.  This  
resulted in a crash in some cases.  Per bug #13680 from Boyko Yordanov.  
  
In passing, re-pgindent some recent changes in jsonb.c, and fix a rather  
ungrammatical comment.  
  
Diagnosis and patch by Michael Paquier, cosmetic changes by me  

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

Revert "Have dtrace depend on object files directly, not objfiles.txt"

commit   : 08fbad0afd62690cc82990c0504529ef238ac24d    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 15 Oct 2015 13:16:03 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 15 Oct 2015 13:16:03 -0400    

Click here for diff

This reverts commit 73537828537239923a0f827a92b20502a3efa52d.  Per  
report from Tom Lane, this breaks parallel builds.  

M src/backend/Makefile

Allow FDWs to push down quals without breaking EvalPlanQual rechecks.

commit   : 5fc4c26db5120bd90348b6ee3101fcddfdf54800    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 15 Oct 2015 13:00:40 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 15 Oct 2015 13:00:40 -0400    

Click here for diff

This fixes a long-standing bug which was discovered while investigating  
the interaction between the new join pushdown code and the EvalPlanQual  
machinery: if a ForeignScan appears on the inner side of a paramaterized  
nestloop, an EPQ recheck would re-return the original tuple even if  
it no longer satisfied the pushed-down quals due to changed parameter  
values.  
  
This fix adds a new member to ForeignScan and ForeignScanState and a  
new argument to make_foreignscan, and requires changes to FDWs which  
push down quals to populate that new argument with a list of quals they  
have chosen to push down.  Therefore, I'm only back-patching to 9.5,  
even though the bug is not new in 9.5.  
  
Etsuro Fujita, reviewed by me and by Kyotaro Horiguchi.  

M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/fdwhandler.sgml
M src/backend/executor/nodeForeignscan.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/planmain.h

Fix bogus comments

commit   : 817588bc2bd684b630da11ca068505dbd985de10    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 15 Oct 2015 12:20:11 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 15 Oct 2015 12:20:11 -0300    

Click here for diff

Author: Amit Langote  

M src/backend/commands/tablecmds.c

-- email subject limit ----------------------------------------- -- gitweb summary limit -------------------------- pg_upgrade: reorder controldata checks to match program output

commit   : aa7f9493a02f5981c09b924323f0e7a58a32f2ed    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 13 Oct 2015 18:25:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 13 Oct 2015 18:25:32 -0400    

Click here for diff

Also improve comment for how float8_pass_by_value is used.  
  
Backpatch through 9.5  

M src/bin/pg_upgrade/controldata.c

Have dtrace depend on object files directly, not objfiles.txt

commit   : 73537828537239923a0f827a92b20502a3efa52d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 13 Oct 2015 15:39:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 13 Oct 2015 15:39:58 -0400    

Click here for diff

Per Mark Johnston, this resolves a build error on FreeBSD related  
to the fact that dtrace is modifying the generated object files  
under the hood.  Consequently, without this, dtrace gets reinvoked  
at install time because the object files have been updated.  This  
is a pretty hacky fix, but it shouldn't hurt anything, and it's  
not clear that it's worth expending any more effort for a feature  
that not too many people are using.  
  
Patch by Mark Johnston.  This is arguably back-patchable as a bug  
fix to the build system, but I'm not certain enough of the  
consequences to try that.  Let's see what the buildfarm (and  
our packagers) think of this change on master first.  

M src/backend/Makefile

Improve INSERT .. ON CONFLICT error message.

commit   : b8dd19af50950d4933da7ad60f93388e9d0eb851    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 13 Oct 2015 15:33:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 13 Oct 2015 15:33:07 -0400    

Click here for diff

Peter Geoghegan, reviewed by me.  

M src/backend/executor/execIndexing.c
M src/test/regress/output/constraints.source

On Windows, ensure shared memory handle gets closed if not being used.

commit   : 869f693a36556e9872c4369820ce8289451619f0    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Oct 2015 11:21:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Oct 2015 11:21:33 -0400    

Click here for diff

Postmaster child processes that aren't supposed to be attached to shared  
memory were not bothering to close the shared memory mapping handle they  
inherit from the postmaster process.  That's mostly harmless, since the  
handle vanishes anyway when the child process exits -- but the syslogger  
process, if used, doesn't get killed and restarted during recovery from a  
backend crash.  That meant that Windows doesn't see the shared memory  
mapping as becoming free, so it doesn't delete it and the postmaster is  
unable to create a new one, resulting in failure to recover from crashes  
whenever logging_collector is turned on.  
  
Per report from Dmitry Vasilyev.  It's a bit astonishing that we'd not  
figured this out long ago, since it's been broken from the very beginnings  
of out native Windows support; probably some previously-unexplained trouble  
reports trace to this.  
  
A secondary problem is that on Cygwin (perhaps only in older versions?),  
exec() may not detach from the shared memory segment after all, in which  
case these child processes did remain attached to shared memory, posing  
the risk of an unexpected shared memory clobber if they went off the rails  
somehow.  That may be a long-gone bug, but we can deal with it now if it's  
still live, by detaching within the infrastructure introduced here to deal  
with closing the handle.  
  
Back-patch to all supported branches.  
  
Tom Lane and Amit Kapila  

M src/backend/port/sysv_shmem.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/postmaster.c
M src/include/storage/pg_shmem.h

Fix "pg_ctl start -w" to test child process status directly.

commit   : 6bcce25801c3fcb219e0d92198889ec88c74e2ff    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Oct 2015 18:30:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Oct 2015 18:30:36 -0400    

Click here for diff

pg_ctl start with -w previously relied on a heuristic that the postmaster  
would surely always manage to create postmaster.pid within five seconds.  
Unfortunately, that fails much more often than we would like on some of the  
slower, more heavily loaded buildfarm members.  
  
We have known for quite some time that we could remove the need for that  
heuristic on Unix by using fork/exec instead of system() to launch the  
postmaster.  This allows us to know the exact PID of the postmaster, which  
allows near-certain verification that the postmaster.pid file is the one  
we want and not a leftover, and it also lets us use waitpid() to detect  
reliably whether the child postmaster has exited or not.  
  
What was blocking this change was not wanting to rewrite the Windows  
version of start_postmaster() to avoid use of CMD.EXE.  That's doable  
in theory but would require fooling about with stdout/stderr redirection,  
and getting the handling of quote-containing postmaster switches to  
stay the same might be rather ticklish.  However, we realized that  
we don't have to do that to fix the problem, because we can test  
whether the shell process has exited as a proxy for whether the  
postmaster is still alive.  That doesn't allow an exact check of the  
PID in postmaster.pid, but we're no worse off than before in that  
respect; and we do get to get rid of the heuristic about how long the  
postmaster might take to create postmaster.pid.  
  
On Unix, this change means that a second "pg_ctl start -w" immediately  
after another such command will now reliably fail, whereas previously  
it would succeed if done within two seconds of the earlier command.  
Since that's a saner behavior anyway, it's fine.  On Windows, the case can  
still succeed within the same time window, since pg_ctl can't tell that the  
earlier postmaster's postmaster.pid isn't the pidfile it is looking for.  
To ensure stable test results on Windows, we can insert a short sleep into  
the test script for pg_ctl, ensuring that the existing pidfile looks stale.  
This hack can be removed if we ever do rewrite start_postmaster(), but that  
no longer seems like a high-priority thing to do.  
  
Back-patch to all supported versions, both because the current behavior  
is buggy and because we must do that if we want the buildfarm failures  
to go away.  
  
Tom Lane and Michael Paquier  

M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_ctl/t/001_start_stop.pl

Use JsonbIteratorToken consistently in automatic variable declarations.

commit   : 7732d49ca211571552bf82b5207deed95c0cc09c    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 11 Oct 2015 23:53:35 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 11 Oct 2015 23:53:35 -0400    

Click here for diff

Many functions stored JsonbIteratorToken values in variables of other  
integer types.  Also, standardize order relative to other declarations.  
Expect compilers to generate the same code before and after this change.  

M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c

Fix whitespace

commit   : f20b26960ae62a3ffd12782eea09e0e9c23a2ac1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 11 Oct 2015 21:44:27 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 11 Oct 2015 21:44:27 -0400    

Click here for diff

M src/test/regress/sql/json_encoding.sql

Avoid scan-build warning about uninitialized htonl() arguments.

commit   : dfa1cddc4c92cce0c35f926d813894a2b3632c27    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 11 Oct 2015 20:42:26 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 11 Oct 2015 20:42:26 -0400    

Click here for diff

Josh Kupershmidt  

M contrib/pgcrypto/crypt-des.c

Make prove_installcheck remove the old log directory, if any.

commit   : 03a22f8b1d68754f3ba1fcad977ca44471d21ec1    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 11 Oct 2015 20:36:07 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 11 Oct 2015 20:36:07 -0400    

Click here for diff

prove_check already has been doing this.  Back-patch to 9.4, like the  
commit that introduced this logging.  

M src/Makefile.global.in

Speed up text sorts where the same strings occur multiple times.

commit   : 0e57b4d8bd9674adaf5747421b3255b85e385534    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 9 Oct 2015 19:03:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 9 Oct 2015 19:03:44 -0400    

Click here for diff

Cache strxfrm() blobs across calls made to the text SortSupport  
abbreviation routine.  This can speed up sorting if the same string  
needs to be abbreviated many times in a row.  
  
Also, cache the result of the previous strcoll() comparison, so that  
if we're asked to compare the same strings agin, we do need to call  
strcoll() again.  
  
Perhaps surprisingly, these optimizations don't seem to hurt even when  
they don't help.  memcmp() is really cheap compared to strcoll() or  
strxfrm().  
  
Peter Geoghegan, reviewed by me.  

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

Make abbreviated key comparisons for text a bit cheaper.

commit   : bfb54ff15a447fb22e9deae096e0d45b3e4bd56f    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 9 Oct 2015 15:06:06 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 9 Oct 2015 15:06:06 -0400    

Click here for diff

If we do some byte-swapping while abbreviating, we can do comparisons  
using integer arithmetic rather than memcmp.  
  
Peter Geoghegan, reviewed and slightly revised by me.  

M src/backend/utils/adt/varlena.c
M src/include/port/pg_bswap.h

Remove set_latch_on_sigusr1 flag.

commit   : db0f6cad4884bd4c835156d3a720d9a79dbd63a9    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 9 Oct 2015 14:31:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 9 Oct 2015 14:31:04 -0400    

Click here for diff

This flag has proven to be a recipe for bugs, and it doesn't seem like  
it can really buy anything in terms of performance.  So let's just  
*always* set the process latch when we receive SIGUSR1 instead of  
trying to do it only when needed.  
  
Per my recent proposal on pgsql-hackers.  

M src/backend/postmaster/bgworker.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/tcop/postgres.c
M src/include/storage/procsignal.h
M src/test/modules/test_shm_mq/setup.c

Handle append_rel_list in expand_security_qual

commit   : b7aac36245261eba9eb7d18561ce44220b361959    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 9 Oct 2015 10:49:02 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 9 Oct 2015 10:49:02 -0400    

Click here for diff

During expand_security_quals, we take the security barrier quals on an  
RTE and create a subquery which evaluates the quals.  During this, we  
have to replace any variables in the outer query which refer to the  
original RTE with references to the columns from the subquery.  
  
We need to also perform that replacement for any Vars in the  
append_rel_list.  
  
Only backpatching to 9.5 as we only go through this process in 9.4 for  
auto-updatable security barrier views, which UNION ALL queries aren't.  
  
Discovered by Haribabu Kommi  
  
Patch by Dean Rasheed  

M src/backend/optimizer/prep/prepsecurity.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Fix uninitialized-variable bug.

commit   : 94f5246ce1cac2b3fb976bed5792f39e01a28d08    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Oct 2015 09:12:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Oct 2015 09:12:03 -0500    

Click here for diff

For some reason, neither of the compilers I usually use noticed the  
uninitialized-variable problem I introduced in commit 7e2a18a9161fee7e.  
That's hardly a good enough excuse though.  Committing with brown paper bag  
on head.  
  
In addition to putting the operations in the right order, move the  
declaration of "now" inside the loop; there's no need for it to be  
outside, and that does wake up older gcc enough to notice any similar  
future problem.  
  
Back-patch to 9.4; earlier versions lack the time-to-SIGKILL stanza  
so there's no bug.  

M src/backend/postmaster/postmaster.c

Fix typo in docs.

commit   : 41562b14bb9085378957f9a08de4518ae049ffca    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 8 Oct 2015 13:21:03 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 8 Oct 2015 13:21:03 -0400    

Click here for diff

Pallavi Sontakke  

M doc/src/sgml/func.sgml

Add BSWAP64 macro.

commit   : c171818b275b9dbd6a1f1cf1666e9e72237f75e6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 8 Oct 2015 13:01:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 8 Oct 2015 13:01:36 -0400    

Click here for diff

This is like BSWAP32, but for 64-bit values.  Since we've got two of  
them now and they have use cases (like sortsupport) beyond CRCs, move  
the definitions to their own header file.  
  
Peter Geoghegan  

M config/c-compiler.m4
M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
A src/include/port/pg_bswap.h
M src/include/port/pg_crc32c.h

Hyphenate variable-length for consistency.

commit   : 1e353198612586befd44fe5e87304d08ebfac552    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 8 Oct 2015 12:29:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 8 Oct 2015 12:29:25 -0400    

Click here for diff

We hyphenate "fixed-length" earlier in the same sentence, and overall we  
more often use "variable-length" rather than "variable length".  
  
Nikolay Shaplov  

M doc/src/sgml/ref/create_type.sgml

Correct pg_indent to pgindent in various comments.

commit   : fd5eaad71529d508a1b1e411b3dc16e0b2d33da5    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 8 Oct 2015 12:24:51 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 8 Oct 2015 12:24:51 -0400    

Click here for diff

David Christensen  

M src/include/storage/s_lock.h
M src/include/utils/elog.h
M src/tools/pgindent/exclude_file_patterns

Factor out encoding specific tests for json

commit   : b6363772fd5f07dcfff2b4869765705ac9633950    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 7 Oct 2015 17:41:45 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 7 Oct 2015 17:41:45 -0400    

Click here for diff

This lets us remove the large alternative results files for the main  
json and jsonb tests, which makes modifying those tests simpler for  
committers and patch submitters.  
  
Backpatch to 9.4 for jsonb and 9.3 for json.  

M src/test/regress/expected/json.out
D src/test/regress/expected/json_1.out
A src/test/regress/expected/json_encoding.out
A src/test/regress/expected/json_encoding_1.out
M src/test/regress/expected/jsonb.out
D src/test/regress/expected/jsonb_1.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/json.sql
A src/test/regress/sql/json_encoding.sql
M src/test/regress/sql/jsonb.sql

Improve documentation of the role-dropping process.

commit   : 1ea0c73c2b112911fb2ef297121be92d3b0ca35e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Oct 2015 16:12:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Oct 2015 16:12:05 -0400    

Click here for diff

In general one may have to run both REASSIGN OWNED and DROP OWNED to get  
rid of all the dependencies of a role to be dropped.  This was alluded to  
in the REASSIGN OWNED man page, but not really spelled out in full; and in  
any case the procedure ought to be documented in a more prominent place  
than that.  Add a section to the "Database Roles" chapter explaining this,  
and do a bit of wordsmithing in the relevant commands' man pages.  

M doc/src/sgml/ref/drop_owned.sgml
M doc/src/sgml/ref/drop_role.sgml
M doc/src/sgml/ref/drop_user.sgml
M doc/src/sgml/ref/reassign_owned.sgml
M doc/src/sgml/user-manag.sgml

docs: add JSONB containment example of a key and empty object

commit   : b292ee79a6bc8a1a6610181fcdc2c4092c82eaf2    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 7 Oct 2015 10:30:54 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 7 Oct 2015 10:30:54 -0400    

Click here for diff

Backpatch through 9.5  

M doc/src/sgml/json.sgml

docs: Map operator @> to the proper SGML escape for '>'

commit   : 23d29cef93ea8d060ceae42146154e45c5a4f862    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 7 Oct 2015 09:42:26 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 7 Oct 2015 09:42:26 -0400    

Click here for diff

Backpatch through 9.5  

M doc/src/sgml/json.sgml
M doc/src/sgml/rangetypes.sgml

docs: clarify JSONB operator descriptions

commit   : b852dc4cbd09156e2c74786d5b265f03d45bc404    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 7 Oct 2015 09:06:49 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 7 Oct 2015 09:06:49 -0400    

Click here for diff

No catalog bump as the catalog changes are for SQL operator comments.  
  
Backpatch through 9.5  

M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml
M src/include/catalog/pg_operator.h

Perform an immediate shutdown if the postmaster.pid file is removed.

commit   : 7e2a18a9161fee7e67642863f72b51d77d3e996f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Oct 2015 17:15:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Oct 2015 17:15:27 -0400    

Click here for diff

The postmaster now checks every minute or so (worst case, at most two  
minutes) that postmaster.pid is still there and still contains its own PID.  
If not, it performs an immediate shutdown, as though it had received  
SIGQUIT.  
  
The original goal behind this change was to ensure that failed buildfarm  
runs would get fully cleaned up, even if the test scripts had left a  
postmaster running, which is not an infrequent occurrence.  When the  
buildfarm script removes a test postmaster's $PGDATA directory, its next  
check on postmaster.pid will fail and cause it to exit.  Previously, manual  
intervention was often needed to get rid of such orphaned postmasters,  
since they'd block new test postmasters from obtaining the expected socket  
address.  
  
However, by checking postmaster.pid and not something else, we can provide  
additional robustness: manual removal of postmaster.pid is a frequent DBA  
mistake, and now we can at least limit the damage that will ensue if a new  
postmaster is started while the old one is still alive.  
  
Back-patch to all supported branches, since we won't get the desired  
improvement in buildfarm reliability otherwise.  

M src/backend/postmaster/postmaster.c
M src/backend/utils/init/miscinit.c
M src/include/miscadmin.h

Remove more volatile qualifiers.

commit   : 8f6bb851bdb75d741b3a7543bbf681e3cd7e65dc    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 6 Oct 2015 15:45:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 6 Oct 2015 15:45:02 -0400    

Click here for diff

Prior to commit 0709b7ee72e4bc71ad07b7120acd117265ab51d0, access to  
variables within a spinlock-protected critical section had to be done  
through a volatile pointer, but that should no longer be necessary.  
This continues work begun in df4077cda2eae3eb4a5cf387da0c1e7616e73204  
and 6ba4ecbf477e0b25dd7bde1b0c4e07fc2da19348.  
  
Thomas Munro and Michael Paquier  

M src/backend/postmaster/checkpointer.c
M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c

Have CREATE TABLE LIKE add OID column if any LIKEd table has one

commit   : b943f502b788a3708ca660785fd14a4ee938fdcd    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 5 Oct 2015 21:19:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 5 Oct 2015 21:19:16 -0400    

Click here for diff

Also, process constraints for LIKEd tables at the end so an OID column  
can be referenced in a constraint.  
  
Report by Tom Lane  

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

to_number(): allow 'V' to divide by 10^(the number of digits)

commit   : 28b3a3d41a8b72841a3f5067217f639a7d337c0e    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 5 Oct 2015 21:03:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 5 Oct 2015 21:03:38 -0400    

Click here for diff

to_char('V') already multiplied in a similar manner.  
  
Report by Jeremy Lowery  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/formatting.c

psql: allow \pset C in setting the title, matches \C

commit   : 2145a766044b4de32ab154a074ade0bf78d021df    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 5 Oct 2015 20:56:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 5 Oct 2015 20:56:38 -0400    

Click here for diff

Report by David G. Johnston  

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

to_char(): Do not count negative sign as a digit for time values

commit   : 2d87eedc1d4468d331035bbe55f140f180d20144    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 5 Oct 2015 20:51:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 5 Oct 2015 20:51:46 -0400    

Click here for diff

For time masks, like HH24, MI, SS, CC, MM, do not count the negative  
sign as part of the zero-padding length specified by the mask, e.g. have  
to_char('-4 years'::interval, 'YY') return '-04', not '-4'.  
  
Report by Craig Ringer  

M src/backend/utils/adt/formatting.c
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out

docs: update guidelines on when to use GIN and GiST indexes

commit   : 6d8b2aa83af70e20323caf23961667dc4c149276    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 5 Oct 2015 13:38:36 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 5 Oct 2015 13:38:36 -0400    

Click here for diff

Report by Tomas Vondra  
  
Backpatch through 9.5  

M doc/src/sgml/textsearch.sgml

Docs: explain contrib/pg_stat_statements' handling of GC failure.

commit   : f8a5e579d18b268f287d81b8a4bd54955ca90c37    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Oct 2015 12:44:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Oct 2015 12:44:12 -0400    

Click here for diff

Failure to perform garbage collection now has a user-visible effect, so  
explain that and explain that reducing pgss_max is the way to prevent it.  
Per gripe from Andrew Dunstan.  

M doc/src/sgml/pgstatstatements.sgml

Fix insufficiently-portable regression test case.

commit   : 9e36c91b468d7d821b77214337ff891811b4b337    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Oct 2015 12:19:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Oct 2015 12:19:14 -0400    

Click here for diff

Some of the buildfarm members are evidently miserly enough of stack space  
to pass the originally-committed form of this test.  Increase the  
requirement 10X to hopefully ensure that it fails as-expected everywhere.  
  
Security: CVE-2015-5289  

M src/test/regress/expected/json.out
M src/test/regress/expected/json_1.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Last-minute updates for release notes.

commit   : 272ede71a66892e68d4de285a82f117ce23e10ba    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Oct 2015 10:57:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Oct 2015 10:57:15 -0400    

Click here for diff

Add entries for security and not-quite-security issues.  
  
Security: CVE-2015-5288, CVE-2015-5289  

M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml

Remove outdated comment about relation level autovacuum freeze limits.

commit   : 10cfd6f8544ea658c3d87821ab8525296363bbdf    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Oct 2015 16:09:13 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Oct 2015 16:09:13 +0200    

Click here for diff

The documentation for the autovacuum_multixact_freeze_max_age and  
autovacuum_freeze_max_age relation level parameters contained:  
"Note that while you can set autovacuum_multixact_freeze_max_age very  
small, or even zero, this is usually unwise since it will force frequent  
vacuuming."  
which hasn't been true since these options were made relation options,  
instead of residing in the pg_autovacuum table (834a6da4f7).  
  
Remove the outdated sentence. Even the lowered limits from 2596d70 are  
high enough that this doesn't warrant calling out the risk in the CREATE  
TABLE docs.  
  
Per discussion with Tom Lane and Alvaro Herrera  
  
Discussion: [email protected]  
Backpatch: 9.0- (in parts)  

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

Add regression tests for INSERT/UPDATE+RETURNING

commit   : be400cd25c7f407111b9617dbf6a5fae761754cb    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 5 Oct 2015 10:14:49 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 5 Oct 2015 10:14:49 -0400    

Click here for diff

This adds regressions tests which are specific to INSERT+RETURNING and  
UPDATE+RETURNING to ensure that the SELECT policies are added as  
WithCheckOptions (and should therefore throw an error when the policy is  
violated).  
  
Per suggestion from Andres.  
  
Back-patch to 9.5 as the prior commit was.  

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

Prevent stack overflow in query-type functions.

commit   : 5976097c0fce03f8cc201aefc4445ad57e09bb75    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:30 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:30 -0400    

Click here for diff

The tsquery, ltxtquery and query_int data types have a common ancestor.  
Having acquired check_stack_depth() calls independently, each was  
missing at least one call.  Back-patch to 9.0 (all supported versions).  

M contrib/intarray/_int_bool.c
M contrib/ltree/ltxtquery_io.c
M contrib/ltree/ltxtquery_op.c
M src/backend/utils/adt/tsquery_cleanup.c

Prevent stack overflow in container-type functions.

commit   : 30cb12881de55bc91a2cbde29d836bd3332612c3    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:29 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:29 -0400    

Click here for diff

A range type can name another range type as its subtype, and a record  
type can bear a column of another record type.  Consequently, functions  
like range_cmp() and record_recv() are recursive.  Functions at risk  
include operator family members and referents of pg_type regproc  
columns.  Treat as recursive any such function that looks up and calls  
the same-purpose function for a record column type or the range subtype.  
Back-patch to 9.0 (all supported versions).  
  
An array type's element type is never itself an array type, so array  
functions are unaffected.  Recursion depth proportional to array  
dimensionality, found in array_dim_to_jsonb(), is fine thanks to MAXDIM.  

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

commit   : 08fa47c4850cea32c3116665975bca219fbf2fe6    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:29 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:29 -0400    

Click here for diff

Sufficiently-deep recursion heretofore elicited a SIGSEGV.  If an  
application constructs PostgreSQL json or jsonb values from arbitrary  
user input, application users could have exploited this to terminate all  
active database connections.  That applies to 9.3, where the json parser  
adopted recursive descent, and later versions.  Only row_to_json() and  
array_to_json() were at risk in 9.2, both in a non-security capacity.  
Back-patch to 9.2, where the json type was introduced.  
  
Oskari Saarenmaa, reviewed by Michael Paquier.  
  
Security: CVE-2015-5289  

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

pgcrypto: Detect and report too-short crypt() salts.

commit   : 1d812c8b059d0b9b1fba4a459c9876de0f6259b6    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:29 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:29 -0400    

Click here for diff

Certain short salts crashed the backend or disclosed a few bytes of  
backend memory.  For existing salt-induced error conditions, emit a  
message saying as much.  Back-patch to 9.0 (all supported versions).  
  
Josh Kupershmidt  
  
Security: CVE-2015-5288  

M contrib/pgcrypto/crypt-blowfish.c
M contrib/pgcrypto/crypt-des.c
M contrib/pgcrypto/expected/crypt-blowfish.out
M contrib/pgcrypto/expected/crypt-des.out
M contrib/pgcrypto/expected/crypt-xdes.out
M contrib/pgcrypto/px-crypt.c
M contrib/pgcrypto/sql/crypt-blowfish.sql
M contrib/pgcrypto/sql/crypt-des.sql
M contrib/pgcrypto/sql/crypt-xdes.sql

Apply SELECT policies in INSERT/UPDATE+RETURNING

commit   : 2ca9d5445c35db8956e4abbf1e653373820e8c0a    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 5 Oct 2015 07:55:13 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 5 Oct 2015 07:55:13 -0400    

Click here for diff

Similar to 7d8db3e, given that INSERT+RETURNING requires SELECT rights  
on the table, apply the SELECT policies as WCOs to the tuples being  
inserted.  Apply the same logic to UPDATE+RETURNING.  
  
Back-patch to 9.5 where RLS was added.  

M src/backend/rewrite/rowsecurity.c

Do not write out WCOs in Query

commit   : 4158cc3793fe0e074dcb58e91103344c8ffcd6df    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 5 Oct 2015 07:38:58 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 5 Oct 2015 07:38:58 -0400    

Click here for diff

The WithCheckOptions list in Query are only populated during rewrite and  
do not need to be written out or read in as part of a Query structure.  
  
Further, move WithCheckOptions to the bottom and add comments to clarify  
that it is only populated during rewrite.  
  
Back-patch to 9.5 with a catversion bump, as we are still in alpha.  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h

Re-Align *_freeze_max_age reloption limits with corresponding GUC limits.

commit   : 2596d705bdc4ac886a12720b19ef65b3e67b55f7    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Oct 2015 11:53:43 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Oct 2015 11:53:43 +0200    

Click here for diff

In 020235a5754 I lowered the autovacuum_*freeze_max_age minimums to  
allow for easier testing of wraparounds. I did not touch the  
corresponding per-table limits. While those don't matter for the purpose  
of wraparound, it seems more consistent to lower them as well.  
  
It's noteworthy that the previous reloption lower limit for  
autovacuum_multixact_freeze_max_age was too high by one magnitude, even  
before 020235a5754.  
  
Discussion: [email protected]  
Backpatch: back to 9.0 (in parts), like the prior patch  

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

ALTER TABLE .. FORCE ROW LEVEL SECURITY

commit   : 088c83363a11200f2225f279d4a5c6cc6f9db3d2    
  
author   : Stephen Frost <[email protected]>    
date     : Sun, 4 Oct 2015 21:05:08 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sun, 4 Oct 2015 21:05:08 -0400    

Click here for diff

To allow users to force RLS to always be applied, even for table owners,  
add ALTER TABLE .. FORCE ROW LEVEL SECURITY.  
  
row_security=off overrides FORCE ROW LEVEL SECURITY, to ensure pg_dump  
output is complete (by default).  
  
Also add SECURITY_NOFORCE_RLS context to avoid data corruption when  
ALTER TABLE .. FORCE ROW SECURITY is being used. The  
SECURITY_NOFORCE_RLS security context is used only during referential  
integrity checks and is only considered in check_enable_rls() after we  
have already checked that the current user is the owner of the relation  
(which should always be the case during referential integrity checks).  
  
Back-patch to 9.5 where RLS was added.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_table.sgml
M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/rls.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_class.h
M src/include/miscadmin.h
M src/include/nodes/parsenodes.h
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/output/misc.source
M src/test/regress/sql/rowsecurity.sql

Release notes for 9.5beta1, 9.4.5, 9.3.10, 9.2.14, 9.1.19, 9.0.23.

commit   : 16a70e3059885739f59ccdaa20f2e4a3b2a0a700    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 19:38:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 19:38:00 -0400    

Click here for diff

M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml

Improve contrib/pg_stat_statements' handling of garbage collection failure.

commit   : 8bbe4cbd9bd687eddfb8fd8f7bba488ff794d166    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 17:58:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 17:58:29 -0400    

Click here for diff

If we can't read the query texts file (whether because out-of-memory, or  
for some other reason), give up and reset the file to empty, discarding all  
stored query texts, though not the statistics per se.  We used to leave  
things alone and hope for better luck next time, but the problem is that  
the file is only going to get bigger and even harder to slurp into memory.  
Better to do something that will get us out of trouble.  
  
Likewise reset the file to empty for any other failure within gc_qtexts().  
The previous behavior after a write error was to discard query texts but  
not do anything to truncate the file, which is just weird.  
  
Also, increase the maximum supported file size from MaxAllocSize to  
MaxAllocHugeSize; this makes it more likely we'll be able to do a garbage  
collection successfully.  
  
Also, fix recalculation of mean_query_len within entry_dealloc() to match  
the calculation in gc_qtexts().  The previous coding overlooked the  
possibility of dropped texts (query_len == -1) and would underestimate the  
mean of the remaining entries in such cases, thus possibly causing excess  
garbage collection cycles.  
  
In passing, add some errdetail to the log entry that complains about  
insufficient memory to read the query texts file, which after all was  
Jim Nasby's original complaint.  
  
Back-patch to 9.4 where the current handling of query texts was  
introduced.  
  
Peter Geoghegan, rather editorialized upon by me  

M contrib/pg_stat_statements/pg_stat_statements.c

Fix hstore_plpython test when python3 is used.

commit   : 86b1e6784b19b03606197cf3f69b10f5a653931d    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 4 Oct 2015 22:24:13 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 4 Oct 2015 22:24:13 +0200    

Click here for diff

Due to b67aaf21e8ef8 / CREATE EXTENSION ... CASCADE the test output  
contains the extension name in yet another place. Since that's variable  
depending on the python version...  
  
Add yet another name mangling stanza to regress-python3-mangle.mk.  
  
Author: Petr Jelinek  

M src/pl/plpython/regress-python3-mangle.mk

Further twiddling of nodeHash.c hashtable sizing calculation.

commit   : f2fc98fb8e060b2243aba4cfe8b206f54bcc5a4f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 15:55:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 15:55:07 -0400    

Click here for diff

On reflection, the submitted patch didn't really work to prevent the  
request size from exceeding MaxAllocSize, because of the fact that we'd  
happily round nbuckets up to the next power of 2 after we'd limited it to  
max_pointers.  The simplest way to enforce the limit correctly is to  
round max_pointers down to a power of 2 when it isn't one already.  
  
(Note that the constraint to INT_MAX / 2, if it were doing anything useful  
at all, is properly applied after that.)  

M src/backend/executor/nodeHash.c

Fix some issues in new hashtable size calculations in nodeHash.c.

commit   : a31e64d0652622d4627ffa2123163a43538a3f51    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 14:06:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 14:06:40 -0400    

Click here for diff

Limit the size of the hashtable pointer array to not more than  
MaxAllocSize, per reports from Kouhei Kaigai and others of "invalid memory  
alloc request size" failures.  There was discussion of allowing the array  
to get larger than that by using the "huge" palloc API, but so far no proof  
that that is actually a good idea, and at this point in the 9.5 cycle major  
changes from old behavior don't seem like the way to go.  
  
Fix a rather serious secondary bug in the new code, which was that it  
didn't ensure nbuckets remained a power of 2 when recomputing it for the  
multiple-batch case.  
  
Clean up sloppy division of labor between ExecHashIncreaseNumBuckets and  
its sole call site.  

M src/backend/executor/nodeHash.c
M src/include/executor/hashjoin.h

Disallow invalid path elements in jsonb_set

commit   : 1edd4ec831458e10b524d1473a7de5791aa8753e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 4 Oct 2015 13:28:16 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 4 Oct 2015 13:28:16 -0400    

Click here for diff

Null path elements and, where the object is an array, invalid integer  
elements now cause an error.  
  
Incorrect behaviour noted by Thom Brown, patch from Dmitry Dolgov.  
  
Backpatch to 9.5 where jsonb_set was introduced  

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

Group cluster_name and update_process_title settings together

commit   : 6390c8c654d07c08686adbbc595a13d76b573653    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 4 Oct 2015 11:14:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 4 Oct 2015 11:14:28 -0400    

Click here for diff

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

Update 9.5 release notes through today.

commit   : cf007a4bca59a1bca6951351e10ff227d2b0c10a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Oct 2015 22:27:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Oct 2015 22:27:02 -0400    

Click here for diff

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

First-draft release notes for 9.4.5, 9.3.10, 9.2.14, 9.1.19, 9.0.23.

commit   : 01ef33701bf6d475deeb550c18a5c3fd698c9623    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Oct 2015 21:21:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Oct 2015 21:21:30 -0400    

Click here for diff

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

Document that row_security is a boolean GUC.

commit   : f78ae3747d8bdf07d864e465eb257ad5b7fd825a    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 3 Oct 2015 20:20:22 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 3 Oct 2015 20:20:22 -0400    

Click here for diff

Oversight in commit 537bd178c73b1d25938347b17e9e3e62898fc231.  
Back-patch to 9.5, like that commit.  

M doc/src/sgml/config.sgml

Make BYPASSRLS behave like superuser RLS bypass.

commit   : 3cb0a7e75aaa9a7826c769068970ce2200e61023    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 3 Oct 2015 20:19:57 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 3 Oct 2015 20:19:57 -0400    

Click here for diff

Specifically, make its effect independent from the row_security GUC, and  
make it affect permission checks pertinent to views the BYPASSRLS role  
owns.  The row_security GUC thereby ceases to change successful-query  
behavior; it can only make a query fail with an error.  Back-patch to  
9.5, where BYPASSRLS was introduced.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/create_role.sgml
M src/backend/utils/misc/rls.c
M src/include/catalog/pg_authid.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Add missed CREATE EXTENSION ... CASCADE regression test adjustment.

commit   : 23fc0b485d6dfa49ff20fff6c5661be4b12a5bff    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 3 Oct 2015 21:31:51 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 3 Oct 2015 21:31:51 +0200    

Click here for diff

M contrib/earthdistance/expected/earthdistance.out

Add CASCADE support for CREATE EXTENSION.

commit   : b67aaf21e8ef8273d5179a8832a109153d7adfe1    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 3 Oct 2015 18:19:37 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 3 Oct 2015 18:19:37 +0200    

Click here for diff

Without CASCADE, if an extension has an unfullfilled dependency on  
another extension, CREATE EXTENSION ERRORs out with "required extension  
... is not installed". That is annoying, especially when that dependency  
is an implementation detail of the extension, rather than something the  
extension's user can make sense of.  
  
In addition to CASCADE this also includes a small set of regression  
tests around CREATE EXTENSION.  
  
Author: Petr Jelinek, editorialized by Michael Paquier, Andres Freund  
Reviewed-By: Michael Paquier, Andres Freund, Jeff Janes  
Discussion: [email protected]  

M contrib/hstore_plperl/expected/hstore_plperl.out
M contrib/hstore_plperl/expected/hstore_plperlu.out
M contrib/hstore_plperl/sql/hstore_plperl.sql
M contrib/hstore_plperl/sql/hstore_plperlu.sql
M contrib/hstore_plpython/expected/hstore_plpython.out
M contrib/hstore_plpython/sql/hstore_plpython.sql
M contrib/ltree_plpython/expected/ltree_plpython.out
M contrib/ltree_plpython/sql/ltree_plpython.sql
M doc/src/sgml/ref/create_extension.sgml
M src/backend/commands/extension.c
M src/backend/parser/gram.y
M src/bin/psql/tab-complete.c
M src/test/modules/Makefile
A src/test/modules/test_extensions/.gitignore
A src/test/modules/test_extensions/Makefile
A src/test/modules/test_extensions/expected/test_extensions.out
A src/test/modules/test_extensions/sql/test_extensions.sql
A src/test/modules/test_extensions/test_ext1–1.0.sql
A src/test/modules/test_extensions/test_ext1.control
A src/test/modules/test_extensions/test_ext2–1.0.sql
A src/test/modules/test_extensions/test_ext2.control
A src/test/modules/test_extensions/test_ext3–1.0.sql
A src/test/modules/test_extensions/test_ext3.control
A src/test/modules/test_extensions/test_ext4–1.0.sql
A src/test/modules/test_extensions/test_ext4.control
A src/test/modules/test_extensions/test_ext5–1.0.sql
A src/test/modules/test_extensions/test_ext5.control
A src/test/modules/test_extensions/test_ext_cyclic1–1.0.sql
A src/test/modules/test_extensions/test_ext_cyclic1.control
A src/test/modules/test_extensions/test_ext_cyclic2–1.0.sql
A src/test/modules/test_extensions/test_ext_cyclic2.control
M src/tools/msvc/Mkvcbuild.pm

Add missing "static" specifier.

commit   : bf686796a055a8bd4abc9765763eb675a0428473    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Oct 2015 10:59:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Oct 2015 10:59:42 -0400    

Click here for diff

Per buildfarm (pademelon, at least, doesn't like this).  

M src/backend/executor/nodeGather.c

Improve errhint() about replication slot naming restrictions.

commit   : 920218cbc0a36f18793c20184b7ebb999d28e8c8    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 3 Oct 2015 15:29:08 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 3 Oct 2015 15:29:08 +0200    

Click here for diff

The existing hint talked about "may only contain letters", but the  
actual requirement is more strict: only lower case letters are allowed.  
  
Reported-By: Rushabh Lathia  
Author: Rushabh Lathia  
Discussion: AGPqQf2x50qcwbYOBKzb4x75sO_V3g81ZsA8+Ji9iN5t_khFhQ@mail.gmail.com  
Backpatch: 9.4-, where replication slots were added  

M contrib/test_decoding/expected/ddl.out
M src/backend/replication/slot.c

commit   : ad227837924464eb9a7defbe34e95064a3b1bdc2    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 3 Oct 2015 15:12:10 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 3 Oct 2015 15:12:10 +0200    

Click here for diff

Four related issues:  
  
1) attnos/varnos/resnos for EXCLUDED were out of sync when a column  
   after one dropped in the underlying relation was referenced.  
2) References to whole-row variables (i.e. EXCLUDED.*) lead to errors.  
3) It was possible to reference system columns in the EXCLUDED pseudo  
   relations, even though they would not have valid contents.  
4) References to EXCLUDED were rewritten by the RLS machinery, as  
   EXCLUDED was treated as if it were the underlying relation.  
  
To fix the first two issues, generate the excluded targetlist with  
dropped columns in mind and add an entry for whole row  
variables. Instead of unconditionally adding a wholerow entry we could  
pull up the expression if needed, but doing it unconditionally seems  
simpler. The wholerow entry is only really needed for ruleutils/EXPLAIN  
support anyway.  
  
The remaining two issues are addressed by changing the EXCLUDED RTE to  
have relkind = composite. That fits with EXCLUDED not actually being a  
real relation, and allows to treat it differently in the relevant  
places. scanRTEForColumn now skips looking up system columns when the  
RTE has a composite relkind; fireRIRrules() already had a corresponding  
check, thereby preventing RLS expansion on EXCLUDED.  
  
Also add tests for these issues, and improve a few comments around  
excluded handling in setrefs.c.  
  
Reported-By: Peter Geoghegan, Geoff Winkless  
Author: Andres Freund, Amit Langote, Peter Geoghegan  
Discussion: CAEzk6fdzJ3xYQZGbcuYM2rBd2BuDkUksmK=mY9UYYDugg_GgZg@mail.gmail.com,  
   CAM3SWZS+CauzbiCEcg-GdE6K6ycHE_Bz6Ksszy8AoixcMHOmsA@mail.gmail.com  
Backpatch: 9.5, where ON CONFLICT was introduced  

M src/backend/optimizer/plan/setrefs.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_relation.c
M src/test/regress/expected/insert_conflict.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/insert_conflict.sql
M src/test/regress/sql/rules.sql

doc: Update URLs of external projects

commit   : 1023194b7aba88680a5c943d5122d086c3431d19    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 2 Oct 2015 21:50:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 2 Oct 2015 21:50:59 -0400    

Click here for diff

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

doc: Make some index terms and terminology more consistent

commit   : eff091cc19118c1be7f692c969ca3ebb6994552a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 2 Oct 2015 21:22:44 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 2 Oct 2015 21:22:44 -0400    

Click here for diff

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/create_role.sgml

Update time zone data files to tzdata release 2015g.

commit   : 241e6844ad7643783e9b4bc020d2abe6a9cbfed2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 19:15:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 19:15:39 -0400    

Click here for diff

DST law changes in Cayman Islands, Fiji, Moldova, Morocco, Norfolk Island,  
North Korea, Turkey, Uruguay.  New zone America/Fort_Nelson for Canadian  
Northern Rockies.  

M src/timezone/data/africa
M src/timezone/data/asia
M src/timezone/data/australasia
M src/timezone/data/backzone
M src/timezone/data/europe
M src/timezone/data/iso3166.tab
M src/timezone/data/leapseconds
M src/timezone/data/northamerica
M src/timezone/data/southamerica
M src/timezone/data/zone.tab
M src/timezone/data/zone1970.tab
M src/timezone/known_abbrevs.txt
M src/timezone/tznames/America.txt
M src/timezone/tznames/Asia.txt
M src/timezone/tznames/Default
M src/timezone/tznames/Pacific.txt

Clarify FDW documentation about ON CONFLICT.

commit   : 01bc589a464964475a0718497ebd21af5bc7338e    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 2 Oct 2015 16:55:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 2 Oct 2015 16:55:47 -0400    

Click here for diff

Etsuro Fujita, reviewed by Peter Geoghegan  

M doc/src/sgml/fdwhandler.sgml

Add recursion depth protection to LIKE matching.

commit   : 2e8cfcf4ea1140213eae56ce64a2c53182643578    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 15:00:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 15:00:51 -0400    

Click here for diff

Since MatchText() recurses, it could in principle be driven to stack  
overflow, although quite a long pattern would be needed.  

M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c

Add recursion depth protections to regular expression matching.

commit   : b63fc28776c5d2efdb4de326ad0f0b5b88f82220    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 14:51:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 14:51:58 -0400    

Click here for diff

Some of the functions in regex compilation and execution recurse, and  
therefore could in principle be driven to stack overflow.  The Tcl crew  
has seen this happen in practice in duptraverse(), though their fix was  
to put in a hard-wired limit on the number of recursive levels, which is  
not too appetizing --- fortunately, we have enough infrastructure to check  
the actually available stack.  Greg Stark has also seen it in other places  
while fuzz testing on a machine with limited stack space.  Let's put guards  
in to prevent crashes in all these places.  
  
Since the regex code would leak memory if we simply threw elog(ERROR),  
we have to introduce an API that checks for stack depth without throwing  
such an error.  Fortunately that's not difficult.  

M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c
M src/backend/regex/rege_dfa.c
M src/backend/regex/regexec.c
M src/backend/tcop/postgres.c
M src/include/miscadmin.h
M src/include/regex/regguts.h

Fix potential infinite loop in regular expression execution.

commit   : f2c4ffc3307cab6619a28e77da9211416c8b1d83    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 14:26:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 14:26:36 -0400    

Click here for diff

In cfindloop(), if the initial call to shortest() reports that a  
zero-length match is possible at the current search start point, but then  
it is unable to construct any actual match to that, it'll just loop around  
with the same start point, and thus make no progress.  We need to force the  
start point to be advanced.  This is safe because the loop over "begin"  
points has already tried and failed to match starting at "close", so there  
is surely no need to try that again.  
  
This bug was introduced in commit e2bd904955e2221eddf01110b1f25002de2aaa83,  
wherein we allowed continued searching after we'd run out of match  
possibilities, but evidently failed to think hard enough about exactly  
where we needed to search next.  
  
Because of the way this code works, such a match failure is only possible  
in the presence of backrefs --- otherwise, shortest()'s judgment that a  
match is possible should always be correct.  That probably explains how  
come the bug has escaped detection for several years.  
  
The actual fix is a one-liner, but I took the trouble to add/improve some  
comments related to the loop logic.  
  
After fixing that, the submitted test case "()*\1" didn't loop anymore.  
But it reported failure, though it seems like it ought to match a  
zero-length string; both Tcl and Perl think it does.  That seems to be from  
overenthusiastic optimization on my part when I rewrote the iteration match  
logic in commit 173e29aa5deefd9e71c183583ba37805c8102a72: we can't just  
"declare victory" for a zero-length match without bothering to set match  
data for capturing parens inside the iterator node.  
  
Per fuzz testing by Greg Stark.  The first part of this is a bug in all  
supported branches, and the second part is a bug since 9.2 where the  
iteration rewrite happened.  

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

Add some more query-cancel checks to regular expression matching.

commit   : 9fe8fe9c9e5d7fc099acfc96e976ee72b2b49865    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 13:45:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 13:45:39 -0400    

Click here for diff

Commit 9662143f0c35d64d7042fbeaf879df8f0b54be32 added infrastructure to  
allow regular-expression operations to be terminated early in the event  
of SIGINT etc.  However, fuzz testing by Greg Stark disclosed that there  
are still cases where regex compilation could run for a long time without  
noticing a cancel request.  Specifically, the fixempties() phase never  
adds new states, only new arcs, so it doesn't hit the cancel check I'd put  
in newstate().  Add one to newarc() as well to cover that.  
  
Some experimentation of my own found that regex execution could also run  
for a long time despite a pending cancel.  We'd put a high-level cancel  
check into cdissect(), but there was none inside the core text-matching  
routines longest() and shortest().  Ordinarily those inner loops are very  
very fast ... but in the presence of lookahead constraints, not so much.  
As a compromise, stick a cancel check into the stateset cache-miss  
function, which is enough to guarantee a cancel check at least once per  
lookahead constraint test.  
  
Making this work required more attention to error handling throughout the  
regex executor.  Henry Spencer had apparently originally intended longest()  
and shortest() to be incapable of incurring errors while running, so  
neither they nor their subroutines had well-defined error reporting  
behaviors.  However, that was already broken by the lookahead constraint  
feature, since lacon() can surely suffer an out-of-memory failure ---  
which, in the code as it stood, might never be reported to the user at all,  
but just silently be treated as a non-match of the lookahead constraint.  
Normalize all that by inserting explicit error tests as needed.  I took the  
opportunity to add some more comments to the code, too.  
  
Back-patch to all supported branches, like the previous patch.  

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

Docs: add disclaimer about hazards of using regexps from untrusted sources.

commit   : 558d4ada1851274fe4dd3618f3f6561b63857e8f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 13:30:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 13:30:42 -0400    

Click here for diff

It's not terribly hard to devise regular expressions that take large  
amounts of time and/or memory to process.  Recent testing by Greg Stark has  
also shown that machines with small stack limits can be driven to stack  
overflow by suitably crafted regexps.  While we intend to fix these things  
as much as possible, it's probably impossible to eliminate slow-execution  
cases altogether.  In any case we don't want to treat such things as  
security issues.  The history of that code should already discourage  
prudent DBAs from allowing execution of regexp patterns coming from  
possibly-hostile sources, but it seems like a good idea to warn about the  
hazard explicitly.  
  
Currently, similar_escape() allows access to enough of the underlying  
regexp behavior that the warning has to apply to SIMILAR TO as well.  
We might be able to make it safer if we tightened things up to allow only  
SQL-mandated capabilities in SIMILAR TO; but that would be a subtly  
non-backwards-compatible change, so it requires discussion and probably  
could not be back-patched.  
  
Per discussion among pgsql-security list.  

M doc/src/sgml/func.sgml

Docs: add another example of creating a range type.

commit   : 27fddec197857db4d54db50a63f311bb0ed7b6fd    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 12:20:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 12:20:01 -0400    

Click here for diff

The "floatrange" example is a bit too simple because float8mi can be  
used without any additional type conversion.  Add an example that does  
have to account for that, and do some minor other wordsmithing.  

M doc/src/sgml/rangetypes.sgml

Don't disable commit_ts in standby if enabled locally

commit   : e06b2e1d2ecde5cef469b9eac3dc5bf825a29a26    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 2 Oct 2015 12:49:01 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 2 Oct 2015 12:49:01 -0300    

Click here for diff

Bug noticed by Fujii Masao  

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

pg_rewind: Improve some messages

commit   : cdcae2b6a7d263b2771b6386af626b47ce17da19    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Oct 2015 21:42:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Oct 2015 21:42:00 -0400    

Click here for diff

The output of a typical pg_rewind run contained a mix of capitalized and  
not-capitalized and punctuated and not-punctuated phrases for no  
apparent reason.  Make that consistent.  Also fix some problems in other  
messages.  

M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/timeline.c

Fix message punctuation according to style guide

commit   : 87c2b517accf287cb746b58af570e7a29b5ad26a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Oct 2015 21:39:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Oct 2015 21:39:56 -0400    

Click here for diff

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

Fix pg_dump to handle inherited NOT VALID check constraints correctly.

commit   : 8ab4a6bd3f1a300313eab04d52b0c9a4003f3e43    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Oct 2015 16:19:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Oct 2015 16:19:49 -0400    

Click here for diff

This case seems to have been overlooked when unvalidated check constraints  
were introduced, in 9.2.  The code would attempt to dump such constraints  
over again for each child table, even though adding them to the parent  
table is sufficient.  
  
In 9.2 and 9.3, also fix contrib/pg_upgrade/Makefile so that the "make  
clean" target fully cleans up after a failed test.  This evidently got  
dealt with at some point in 9.4, but it wasn't back-patched.  I ran into  
it while testing this fix ...  
  
Per bug #13656 from Ingmar Brouns.  

M src/bin/pg_dump/pg_dump.c
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Fix commit_ts for standby

commit   : f12e814b88d8082804bbc8b827469d8068e7252c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 1 Oct 2015 15:06:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 1 Oct 2015 15:06:55 -0300    

Click here for diff

Module initialization was still not completely correct after commit  
6b61955135e9, per crash report from Takashi Ohnishi.  To fix, instead of  
trying to monkey around with the value of the GUC setting directly, add  
a separate boolean flag that enables the feature on a standby, but only  
for the startup (recovery) process, when it sees that its master server  
has the feature enabled.  
Discussion: http://www.postgresql.org/message-id/ca44c6c7f9314868bdc521aea4f77cbf@MP-MSGSS-MBX004.msg.nttdata.co.jp  
  
Also change the deactivation routine to delete all segment files rather  
than leaving the last one around.  (This doesn't need separate  
WAL-logging, because on recovery we execute the same deactivation  
routine anyway.)  
  
In passing, clean up the code structure somewhat, particularly so that  
xlog.c doesn't know so much about when to activate/deactivate the  
feature.  
  
Thanks to Fujii Masao for testing and Petr Jelínek for off-list discussion.  
  
Back-patch to 9.5, where commit_ts was introduced.  

M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/include/access/commit_ts.h

Fix incorrect tab-completion for GRANT and REVOKE

commit   : bf4817e4f090a0a72d1849a3d61b45e7f2feadda    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 1 Oct 2015 23:39:02 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 1 Oct 2015 23:39:02 +0900    

Click here for diff

Previously "GRANT * ON * TO " was tab-completed to add an extra "TO",  
rather than with a list of roles. This is the bug that commit 2f88807  
introduced unexpectedly. This commit fixes that incorrect tab-completion.  
  
Thomas Munro, reviewed by Jeff Janes.  

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

Fix documentation error in commit 8703059c6b55c427100e00a09f66534b6ccbfaa1.

commit   : 21995d3f6d69670b5bc5b3654970701f8abb6d9f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Oct 2015 10:31:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Oct 2015 10:31:22 -0400    

Click here for diff

Etsuro Fujita spotted a thinko in the README commentary.  

M src/backend/optimizer/README

Fix mention of htup.h in storage.sgml

commit   : 3123ee0db2982be545a0d403b543ed4518403ca1    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 1 Oct 2015 23:00:52 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 1 Oct 2015 23:00:52 +0900    

Click here for diff

Previously it was documented that the details on HeapTupleHeaderData  
struct could be found in htup.h. This is not correct because it's now  
defined in htup_details.h.  
  
Back-patch to 9.3 where the definition of HeapTupleHeaderData struct  
was moved from htup.h to htup_details.h.  
  
Michael Paquier  

M doc/src/sgml/storage.sgml

Fix readfuncs/outfuncs problems in last night's Gather patch.

commit   : 286a3a68dcafa15f28a169daac38659816911940    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 1 Oct 2015 09:15:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 1 Oct 2015 09:15:36 -0400    

Click here for diff

KaiGai Kohei, with one correction by me.  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c

Fix errors in commit a04bb65f70dafdf462e0478ad19e6de56df89bfc.

commit   : 5884b92a841d83ceadb986843892d57c68ea32cd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Sep 2015 23:37:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Sep 2015 23:37:26 -0400    

Click here for diff

Not a lot of commentary needed here really.  

M src/backend/commands/async.c
M src/test/isolation/isolation_schedule

Improve LISTEN startup time when there are many unread notifications.

commit   : 07e4d03fb476587bd943b4ba7d51bf0bb559a631    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Sep 2015 23:32:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Sep 2015 23:32:22 -0400    

Click here for diff

If some existing listener is far behind, incoming new listener sessions  
would start from that session's read pointer and then need to advance over  
many already-committed notification messages, which they have no interest  
in.  This was expensive in itself and also thrashed the pg_notify SLRU  
buffers a lot more than necessary.  We can improve matters considerably  
in typical scenarios, without much added cost, by starting from the  
furthest-ahead read pointer, not the furthest-behind one.  We do have to  
consider only sessions in our own database when doing this, which requires  
an extra field in the data structure, but that's a pretty small cost.  
  
Back-patch to 9.0 where the current LISTEN/NOTIFY logic was introduced.  
  
Matt Newell, slightly adjusted by me  

M src/backend/commands/async.c

Add a Gather executor node.

commit   : 3bd909b220930f21d6e15833a17947be749e7fde    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 30 Sep 2015 19:23:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 30 Sep 2015 19:23:36 -0400    

Click here for diff

A Gather executor node runs any number of copies of a plan in an equal  
number of workers and merges all of the results into a single tuple  
stream.  It can also run the plan itself, if the workers are  
unavailable or haven't started up yet.  It is intended to work with  
the Partial Seq Scan node which will be added in future commits.  
  
It could also be used to implement parallel query of a different sort  
by itself, without help from Partial Seq Scan, if the single_copy mode  
is used.  In that mode, a worker executes the plan, and the parallel  
leader does not, merely collecting the worker's results.  So, a Gather  
node could be inserted into a plan to split the execution of that plan  
across two processes.  Nested Gather nodes aren't currently supported,  
but we might want to add support for that in the future.  
  
There's nothing in the planner to actually generate Gather nodes yet,  
so it's not quite time to break out the champagne.  But we're getting  
close.  
  
Amit Kapila.  Some designs suggestions were provided by me, and I also  
reviewed the patch.  Single-copy mode, documentation, and other minor  
changes also by me.  

M doc/src/sgml/config.sgml
M src/backend/commands/explain.c
M src/backend/executor/Makefile
M src/backend/executor/execAmi.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execProcnode.c
A src/backend/executor/nodeGather.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/pathnode.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/executor/executor.h
A src/include/executor/nodeGather.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/tools/pgindent/typedefs.list

Don't dump core when destroying an unused ParallelContext.

commit   : 227d57f3587d7d2a7d0792011f5ac952ba763681    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 30 Sep 2015 18:36:31 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 30 Sep 2015 18:36:31 -0400    

Click here for diff

If a transaction or subtransaction creates a ParallelContext but ends  
without calling InitializeParallelDSM, the previous code would  
seg fault.  Fix that.  

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

Include policies based on ACLs needed

commit   : 7d8db3e8f37aec9d252353904e77381a18a2fa9f    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 30 Sep 2015 07:39:24 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 30 Sep 2015 07:39:24 -0400    

Click here for diff

When considering which policies should be included, rather than look at  
individual bits of the query (eg: if a RETURNING clause exists, or if a  
WHERE clause exists which is referencing the table, or if it's a  
FOR SHARE/UPDATE query), consider any case where we've determined  
the user needs SELECT rights on the relation while doing an UPDATE or  
DELETE to be a case where we apply SELECT policies, and any case where  
we've deteremind that the user needs UPDATE rights on the relation while  
doing a SELECT to be a case where we apply UPDATE policies.  
  
This simplifies the logic and addresses concerns that a user could use  
UPDATE or DELETE with a WHERE clauses to determine if rows exist, or  
they could use SELECT .. FOR UPDATE to lock rows which they are not  
actually allowed to modify through UPDATE policies.  
  
Use list_append_unique() to avoid adding the same quals multiple times,  
as, on balance, the cost of checking when adding the quals will almost  
always be cheaper than keeping them and doing busywork for each tuple  
during execution.  
  
Back-patch to 9.5 where RLS was added.  

M src/backend/rewrite/rowsecurity.c
M src/test/regress/expected/rowsecurity.out

Small improvements in comments in async.c.

commit   : 6057f61b4d511d8321f295d827ced13809e5a1ae    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Sep 2015 22:06:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Sep 2015 22:06:59 -0400    

Click here for diff

We seem to have lost a line somewhere along the way in the comment block  
that discusses async.c's locks, because it suddenly refers to "both locks"  
without previously having mentioned more than one.  Add a sentence to make  
that read more sanely.  Also, refer to the "pos of the slowest backend"  
not the "tail of the slowest backend", since we have no per-backend value  
called "tail".  

M src/backend/commands/async.c

Fix incorrect tps number calculation in "excluding connections establishing".

commit   : a16db3a07da9c47a5ef5b1d18f9c45bdb893b243    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Wed, 30 Sep 2015 10:36:23 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Wed, 30 Sep 2015 10:36:23 +0900    

Click here for diff

The tolerance (larger than actual tps number) increases as the number  
of threads decreases.  The bug has been there since the thread support  
was introduced in 9.0. Because back patching introduces incompatible  
behavior changes regarding the tps number, the fix is committed to  
master and 9.5 stable branches only.  
  
Problem spotted by me and fix proposed by Fabien COELHO. Note that his  
original patch included more than fixes (a code re-factoring) which is  
not related to the problem and I omitted the part.  

M src/bin/pgbench/pgbench.c

Code review for transaction commit timestamps

commit   : 6b61955135e94b39d85571fdbb0c5a749af767f1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 29 Sep 2015 14:40:56 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 29 Sep 2015 14:40:56 -0300    

Click here for diff

There are three main changes here:  
  
1. No longer cause a start failure in a standby if the feature is  
disabled in postgresql.conf but enabled in the master.  This reverts one  
part of commit 4f3924d9cd43; what we keep is the ability of the standby  
to activate/deactivate the module (which includes creating and removing  
segments as appropriate) during replay of such actions in the master.  
  
2. Replay WAL records affecting commitTS even if the feature is  
disabled.  This means the standby will always have the same state as the  
master after replay.  
  
3. Have COMMIT PREPARE record the transaction commit time as well.  We  
were previously only applying it in the normal transaction commit path.  
  
Author: Petr Jelínek  
Discussion: http://www.postgresql.org/message-id/CAHGQGwHereDzzzmfxEBYcVQu3oZv6vZcgu1TPeERWbDc+gQ06g@mail.gmail.com  
Discussion: http://www.postgresql.org/message-id/CAHGQGwFuzfO4JscM9LCAmCDCxp_MfLvN4QdB+xWsS-FijbjTYQ@mail.gmail.com  
  
Additionally, I cleaned up nearby code related to replication origins,  
which I found a bit hard to follow, and fixed a couple of typos.  
  
Backpatch to 9.5, where this code was introduced.  
  
Per bug reports from Fujii Masao and subsequent discussion.  

M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/include/access/commit_ts.h

Fix plperl to handle non-ASCII error message texts correctly.

commit   : b631a46ed83b7eebf5cde16b41d842596cbcc69d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Sep 2015 10:52:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Sep 2015 10:52:22 -0400    

Click here for diff

We were passing error message texts to croak() verbatim, which turns out  
not to work if the text contains non-ASCII characters; Perl mangles their  
encoding, as reported in bug #13638 from Michal Leinweber.  To fix, convert  
the text into a UTF8-encoded SV first.  
  
It's hard to test this without risking failures in different database  
encodings; but we can follow the lead of plpython, which is already  
assuming that no-break space (U+00A0) has an equivalent in all encodings  
we care about running the regression tests in (cf commit 2dfa15de5).  
  
Back-patch to 9.1.  The code is quite different in 9.0, and anyway it seems  
too risky to put something like this into 9.0's final minor release.  
  
Alex Hunsaker, with suggestions from Tim Bunce and Tom Lane  

M src/pl/plperl/SPI.xs
M src/pl/plperl/Util.xs
M src/pl/plperl/expected/plperl_elog.out
M src/pl/plperl/expected/plperl_elog_1.out
M src/pl/plperl/plperl.c
M src/pl/plperl/plperl_helpers.h
M src/pl/plperl/sql/plperl_elog.sql

Comment update for join pushdown.

commit   : 758fcfdc016ac687c4f4094e0dca6ae641400820    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Sep 2015 07:42:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Sep 2015 07:42:30 -0400    

Click here for diff

Etsuro Fujita  

M src/backend/optimizer/util/pathnode.c

Parallel executor support.

commit   : d1b7c1ffe72e86932b5395f29e006c3f503bc53d    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 28 Sep 2015 21:55:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 28 Sep 2015 21:55:57 -0400    

Click here for diff

This code provides infrastructure for a parallel leader to start up  
parallel workers to execute subtrees of the plan tree being executed  
in the master.  User-supplied parameters from ParamListInfo are passed  
down, but PARAM_EXEC parameters are not.  Various other constructs,  
such as initplans, subplans, and CTEs, are also not currently shared.  
Nevertheless, there's enough here to support a basic implementation of  
parallel query, and we can lift some of the current restrictions as  
needed.  
  
Amit Kapila and Robert Haas  

M src/backend/executor/Makefile
A src/backend/executor/execParallel.c
M src/backend/executor/instrument.c
M src/backend/executor/tqueue.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/utils/adt/datum.c
A src/include/executor/execParallel.h
M src/include/executor/instrument.h
M src/include/nodes/params.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/utils/datum.h

Fix compiler warning for non-TIOCGWINSZ case

commit   : 0557dc276f1022965f72dc8bcfc820dfd83a7dc2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 28 Sep 2015 18:42:30 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 28 Sep 2015 18:42:30 -0400    

Click here for diff

Backpatch to 9.5 where the error was introduced.  

M src/bin/psql/print.c

Fix compiler warning about unused function in non-readline case.

commit   : 8a0aa686f41f68c03683a9e37ba783a20cf53a97    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 28 Sep 2015 18:29:20 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 28 Sep 2015 18:29:20 -0400    

Click here for diff

Backpatch to all live branches to keep the code in sync.  

M src/bin/psql/input.c

Fix "sesssion" typo

commit   : 17f5831c8150349d22da2e88820b1be3d734315d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Sep 2015 19:13:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Sep 2015 19:13:42 -0300    

Click here for diff

It was introduced alongside replication origins, by commit  
5aa2350426c, so backpatch to 9.5.  
  
Pointed out by Fujii Masao  

M src/backend/access/transam/xact.c
M src/backend/access/transam/xloginsert.c
M src/backend/replication/logical/origin.c
M src/include/replication/origin.h

Fix poor errno handling in libpq's version of our custom OpenSSL BIO.

commit   : 60f1e6bc130241c1f1da337d0a08a05ee8b982d8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Sep 2015 18:02:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Sep 2015 18:02:38 -0400    

Click here for diff

Thom Brown reported that SSL connections didn't seem to work on Windows in  
9.5.  Asif Naeem figured out that the cause was my_sock_read() looking at  
"errno" when it needs to look at "SOCK_ERRNO".  This mistake was introduced  
in commit 680513ab79c7e12e402a2aad7921b95a25a4bcc8, which cloned the  
backend's custom SSL BIO code into libpq, and didn't translate the errno  
handling properly.  Moreover, it introduced unnecessary errno save/restore  
logic, which was particularly confusing because it was incomplete; and it  
failed to check for all three of EINTR, EAGAIN, and EWOULDBLOCK in  
my_sock_write.  (That might not be necessary; but since we're copying  
well-tested backend code that does do that, it seems prudent to copy it  
faithfully.)  

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

Ensure a few policies remain for pg_upgrade

commit   : 992d702bfafdb4258e65cbfa7353a631460a8389    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 28 Sep 2015 15:48:36 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 28 Sep 2015 15:48:36 -0400    

Click here for diff

To make sure that pg_dump/pg_restore function properly with RLS  
policies, arrange to have a few of them left around at the end of the  
regression tests.  
  
Back-patch to 9.5 where RLS was added.  

M src/test/regress/expected/rowsecurity.out
M src/test/regress/output/misc.source
M src/test/regress/sql/rowsecurity.sql

COPY: use pg_plan_query() instead of planner()

commit   : 590e2d12f0e17aed39a64050f2dddc0d9f56c1ba    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Sep 2015 15:14:08 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Sep 2015 15:14:08 -0300    

Click here for diff

While at it, trim the includes list in copy.c.  The planner headers  
cannot be removed, but there are a few others that are not of any use.  

M src/backend/commands/copy.c

Fix ON CONFLICT DO UPDATE for tables with oids.

commit   : 617db3a2d8ad6abc0d7be623f43edc943a6640a8    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 28 Sep 2015 19:12:48 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 28 Sep 2015 19:12:48 +0200    

Click here for diff

When taking the UPDATE path in an INSERT .. ON CONFLICT .. UPDATE tables  
with oids were not supported. The tuple generated by the update target  
list was projected without space for an oid - a simple oversight.  
  
Reported-By: Peter Geoghegan  
Author: Andres Freund  
Backpatch: 9.5, where ON CONFLICT was introduced  

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

Use LOCKBIT_ON() instead of a bit shift in a few places.

commit   : f40792a93ccdc4d01c448121da67693fc2f6297a    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 28 Sep 2015 10:57:15 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 28 Sep 2015 10:57:15 -0400    

Click here for diff

We do this mostly everywhere, so it seems just as well to do it here,  
too.  
  
Thomas Munro  

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

Don't try to create a temp install without abs_top_builddir.

commit   : 45e5b4ef5c392ddfcd72693f65659bafdda7ee1b    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 28 Sep 2015 10:47:05 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 28 Sep 2015 10:47:05 -0400    

Click here for diff

Otherwise, we effectively act as if abs_top_builddir were the root  
directory, which is quite dangerous if the user happens to have  
permissions to do things there.  This can crop up in PGXS builds,  
for example.  
  
Report by Sandro Santilli, patch by me, review by Noah Misch.  

M src/Makefile.global.in

pg_dump: Fix some messages

commit   : 883af819c1ef7ec975f5c180a3434ff690c23606    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 27 Sep 2015 20:29:40 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 27 Sep 2015 20:29:40 -0400    

Click here for diff

Make quoting style match existing style.  Improve plural support.  

M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump_sort.c

reindexdb: Fix mistake in help output

commit   : 71fc49dfe1d99bd83cd99c2e7a39f93e07d19310    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 27 Sep 2015 11:22:16 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 27 Sep 2015 11:22:16 -0400    

Click here for diff

M src/bin/scripts/reindexdb.c

pg_ctl: Improve help formatting and order

commit   : 72ed3905563cfd847c6ab0b39415423238652ef1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 26 Sep 2015 21:09:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 26 Sep 2015 21:09:52 -0400    

Click here for diff

M src/bin/pg_ctl/pg_ctl.c

doc: Tweak "cube" index entry

commit   : ac7cbf4fb00a8a0f8348653b954c4c75880997aa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 26 Sep 2015 21:00:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 26 Sep 2015 21:00:59 -0400    

Click here for diff

With the arrival of the CUBE key word/feature, the index entries for the  
cube extension and the CUBE feature were collapsed into one.  Tweak the  
entry for the cube extension so they are separate entries.  

M doc/src/sgml/cube.sgml

Remove legacy multixact truncation support.

commit   : aa29c1ccd9f785f9365809f5133e5491acc7ae53    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 26 Sep 2015 19:04:25 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 26 Sep 2015 19:04:25 +0200    

Click here for diff

In 9.5 and master there is no need to support legacy truncation. This is  
just committed separately to make it easier to backpatch the WAL logged  
multixact truncation to 9.3 and 9.4 if we later decide to do so.  
  
I bumped master's magic from 0xD086 to 0xD088 and 9.5's from 0xD085 to  
0xD087 to avoid 9.5 reusing a value that has been in use on master while  
keeping the numbers increasing between major versions.  
  
Discussion: [email protected]  
Backpatch: 9.5  

M src/backend/access/transam/multixact.c
M src/backend/access/transam/xlog.c
M src/backend/commands/vacuum.c
M src/include/access/multixact.h
M src/include/access/xlog_internal.h

Rework the way multixact truncations work.

commit   : 4f627f897367f15702d59973f75f6391d5d3e06f    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 26 Sep 2015 19:04:25 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 26 Sep 2015 19:04:25 +0200    

Click here for diff

The fact that multixact truncations are not WAL logged has caused a fair  
share of problems. Amongst others it requires to do computations during  
recovery while the database is not in a consistent state, delaying  
truncations till checkpoints, and handling members being truncated, but  
offset not.  
  
We tried to put bandaids on lots of these issues over the last years,  
but it seems time to change course. Thus this patch introduces WAL  
logging for multixact truncations.  
  
This allows:  
1) to perform the truncation directly during VACUUM, instead of delaying it  
   to the checkpoint.  
2) to avoid looking at the offsets SLRU for truncation during recovery,  
   we can just use the master's values.  
3) simplify a fair amount of logic to keep in memory limits straight,  
   this has gotten much easier  
  
During the course of fixing this a bunch of additional bugs had to be  
fixed:  
1) Data was not purged from memory the member's SLRU before deleting  
   segments. This happened to be hard or impossible to hit due to the  
   interlock between checkpoints and truncation.  
2) find_multixact_start() relied on SimpleLruDoesPhysicalPageExist - but  
   that doesn't work for offsets that haven't yet been flushed to  
   disk. Add code to flush the SLRUs to fix. Not pretty, but it feels  
   slightly safer to only make decisions based on actual on-disk state.  
3) find_multixact_start() could be called concurrently with a truncation  
   and thus fail. Via SetOffsetVacuumLimit() that could lead to a round  
   of emergency vacuuming. The problem remains in  
   pg_get_multixact_members(), but that's quite harmless.  
  
For now this is going to only get applied to 9.5+, leaving the issues in  
the older branches in place. It is quite possible that we need to  
backpatch at a later point though.  
  
For the case this gets backpatched we need to handle that an updated  
standby may be replaying WAL from a not-yet upgraded primary. We have to  
recognize that situation and use "old style" truncation (i.e. looking at  
the SLRUs) during WAL replay. In contrast to before, this now happens in  
the startup process, when replaying a checkpoint record, instead of the  
checkpointer. Doing truncation in the restartpoint is incorrect, they  
can happen much later than the original checkpoint, thereby leading to  
wraparound.  To avoid "multixact_redo: unknown op code 48" errors  
standbys would have to be upgraded before primaries.  
  
A later patch will bump the WAL page magic, and remove the legacy  
truncation codepaths. Legacy truncation support is just included to make  
a possible future backpatch easier.  
  
Discussion: [email protected]  
Reviewed-By: Robert Haas, Alvaro Herrera, Thomas Munro  
Backpatch: 9.5 for now  

M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/xlog.c
M src/backend/commands/vacuum.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/include/access/multixact.h
M src/include/access/slru.h
M src/tools/pgindent/typedefs.list

Second try at fixing O(N^2) problem in foreign key references.

commit   : 2abfd9d5e9cb7fe5345c415475622a4a95ea61e2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Sep 2015 13:16:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Sep 2015 13:16:30 -0400    

Click here for diff

This replaces ill-fated commit 5ddc72887a012f6a8b85707ef27d85c274faf53d,  
which was reverted because it broke active uses of FK cache entries.  In  
this patch, we still do nothing more to invalidatable cache entries than  
mark them as needing revalidation, so we won't break active uses.  To keep  
down the overhead of InvalidateConstraintCacheCallBack(), keep a list of  
just the currently-valid cache entries.  (The entries are large enough that  
some added space for list links doesn't seem like a big problem.)  This  
would still be O(N^2) when there are many valid entries, though, so when  
the list gets too long, just force the "sinval reset" behavior to remove  
everything from the list.  I set the threshold at 1000 entries, somewhat  
arbitrarily.  Possibly that could be fine-tuned later.  Another item for  
future study is whether it's worth adding reference counting so that we  
could safely remove invalidated entries.  As-is, problem cases are likely  
to end up with large and mostly invalid FK caches.  
  
Like the previous attempt, backpatch to 9.3.  
  
Jan Wieck and Tom Lane  

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

Further fix for psql's code for locale-aware formatting of numeric output.

commit   : 77130fc1482f978629a16c8e956a5477a05d2c04    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Sep 2015 12:20:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Sep 2015 12:20:45 -0400    

Click here for diff

(Third time's the charm, I hope.)  
  
Additional testing disclosed that this code could mangle already-localized  
output from the "money" datatype.  We can't very easily skip applying it  
to "money" values, because the logic is tied to column right-justification  
and people expect "money" output to be right-justified.  Short of  
decoupling that, we can fix it in what should be a safe enough way by  
testing to make sure the string doesn't contain any characters that would  
not be expected in plain numeric output.  

M src/bin/psql/print.c

Further fix for psql's code for locale-aware formatting of numeric output.

commit   : 6325527d845b629243fb3f605af6747a7a4ac45f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Sep 2015 00:00:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Sep 2015 00:00:33 -0400    

Click here for diff

On closer inspection, those seemingly redundant atoi() calls were not so  
much inefficient as just plain wrong: the author of this code either had  
not read, or had not understood, the POSIX specification for localeconv().  
The grouping field is *not* a textual digit string but separate integers  
encoded as chars.  
  
We'll follow the existing code as well as the backend's cash.c in only  
honoring the first group width, but let's at least honor it correctly.  
  
This doesn't actually result in any behavioral change in any of the  
locales I have installed on my Linux box, which may explain why nobody's  
complained; grouping width 3 is close enough to universal that it's barely  
worth considering other cases.  Still, wrong is wrong, so back-patch.  

M src/bin/psql/print.c

Fix psql's code for locale-aware formatting of numeric output.

commit   : 4778a0bdaac3cb8eeb89acb585fd913783d80c4b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Sep 2015 23:01:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Sep 2015 23:01:04 -0400    

Click here for diff

This code did the wrong thing entirely for numbers with an exponent  
but no decimal point (e.g., '1e6'), as reported by Jeff Janes in  
bug #13636.  More generally, it made lots of unverified assumptions  
about what the input string could possibly look like.  Rearrange so  
that it only fools with leading digits that it's directly verified  
are there, and an immediately adjacent decimal point.  While at it,  
get rid of some useless inefficiencies, like converting the grouping  
count string to integer over and over (and over).  
  
This has been broken for a long time, so back-patch to all supported  
branches.  

M src/bin/psql/print.c

Allow planner to use expression-index stats for function calls in WHERE.

commit   : 39df0f150ca69fac1c89537065ddc97af18921b8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Sep 2015 18:35:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Sep 2015 18:35:46 -0400    

Click here for diff

Previously, a function call appearing at the top level of WHERE had a  
hard-wired selectivity estimate of 0.3333333, a kludge conveniently dated  
in the source code itself to July 1992.  The expectation at the time was  
that somebody would soon implement estimator support functions analogous  
to those for operators; but no such code has appeared, nor does it seem  
likely to in the near future.  We do have an alternative solution though,  
at least for immutable functions on single relations: creating an  
expression index on the function call will allow ANALYZE to gather stats  
about the function's selectivity.  But the code in clause_selectivity()  
failed to make use of such data even if it exists.  
  
Refactor so that that will happen.  I chose to make it try this technique  
for any clause type for which clause_selectivity() doesn't have a special  
case, not just functions.  To avoid adding unnecessary overhead in the  
common case where we don't learn anything new, make selfuncs.c provide an  
API that hooks directly to examine_variable() and then var_eq_const(),  
rather than the previous coding which laboriously constructed an OpExpr  
only so that it could be expensively deconstructed again.  
  
I preserved the behavior that the default estimate for a function call  
is 0.3333333.  (For any other expression node type, it's 0.5, as before.)  
I had originally thought to make the default be 0.5 across the board, but  
changing a default estimate that's survived for twenty-three years seems  
like something not to do without a lot more testing than I care to put  
into it right now.  
  
Per a complaint from Jehan-Guillaume de Rorthais.  Back-patch into 9.5,  
but not further, at least for the moment.  

M src/backend/optimizer/path/clausesel.c
M src/backend/utils/adt/selfuncs.c
M src/include/utils/selfuncs.h

Improve handling of collations in contrib/postgres_fdw.

commit   : 76f965ff1f2896d74812a1cad9158fb9f4a1aab9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Sep 2015 12:47:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Sep 2015 12:47:29 -0400    

Click here for diff

If we have a local Var of say varchar type with default collation, and  
we apply a RelabelType to convert that to text with default collation, we  
don't want to consider that as creating an FDW_COLLATE_UNSAFE situation.  
It should be okay to compare that to a remote Var, so long as the remote  
Var determines the comparison collation.  (When we actually ship such an  
expression to the remote side, the local Var would become a Param with  
default collation, meaning the remote Var would in fact control the  
comparison collation, because non-default implicit collation overrides  
default implicit collation in parse_collate.c.)  To fix, be more precise  
about what FDW_COLLATE_NONE means: it applies either to a noncollatable  
data type or to a collatable type with default collation, if that collation  
can't be traced to a remote Var.  (When it can, FDW_COLLATE_SAFE is  
appropriate.)  We were essentially using that interpretation already at  
the Var/Const/Param level, but we weren't bubbling it up properly.  
  
An alternative fix would be to introduce a separate FDW_COLLATE_DEFAULT  
value to describe the second situation, but that would add more code  
without changing the actual behavior, so it didn't seem worthwhile.  
  
Also, since we're clarifying the rule to be that we care about whether  
operator/function input collations match, there seems no need to fail  
immediately upon seeing a Const/Param/non-foreign-Var with nondefault  
collation.  We only have to reject if it appears in a collation-sensitive  
context (for example, "var IS NOT NULL" is perfectly safe from a collation  
standpoint, whatever collation the var has).  So just set the state to  
UNSAFE rather than failing immediately.  
  
Per report from Jeevan Chalke.  This essentially corrects some sloppy  
thinking in commit ed3ddf918b59545583a4b374566bc1148e75f593, so back-patch  
to 9.3 where that logic appeared.  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql

Don't zero opfuncid when reading nodes.

commit   : 9f1255ac859364a86264a67729dbd1a36dd63ff2    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 24 Sep 2015 11:27:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 24 Sep 2015 11:27:20 -0400    

Click here for diff

The comments here stated that this was just in case we ever had an  
ALTER OPERATOR command that could remap an operator to a different  
function.  But those comments have been here for a long time, and no  
such command has come about.  In the absence of such a feature,  
forcing the pg_proc OID to be looked up again each time we reread a  
stored rule or similar is just a waste of cycles.  Moreover, parallel  
query needs a way to reread the exact same node tree that was written  
out, not one that has been slightly stomped on.  So just get rid of  
this for now.  
  
Per discussion with Tom Lane.  

M src/backend/nodes/readfuncs.c

Make pg_controldata report newest XID with valid commit timestamp

commit   : 18d938de7a99d698d33cc3a94507c8fe0a0005ab    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 24 Sep 2015 23:31:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 24 Sep 2015 23:31:17 +0900    

Click here for diff

Previously pg_controldata didn't report newestCommitTs and this was  
an oversight in commit 73c986a.  
  
Also this patch changes pg_resetxlog so that it uses the same sentences  
as pg_controldata does, regarding oldestCommitTs and newestCommitTs,  
for the sake of consistency.  
  
Back-patch to 9.5 where track_commit_timestamp was added.  
  
Euler Taveira  

M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetxlog/pg_resetxlog.c

Lower *_freeze_max_age minimum values.

commit   : 020235a5754be6ba1f0d240b4c86c642e1a62d70    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 24 Sep 2015 14:53:32 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 24 Sep 2015 14:53:32 +0200    

Click here for diff

The old minimum values are rather large, making it time consuming to  
test related behaviour. Additionally the current limits, especially for  
multixacts, can be problematic in space-constrained systems. 10000000  
multixacts can contain a lot of members.  
  
Since there's no good reason for the current limits, lower them a good  
bit. Setting them to 0 would be a bad idea, triggering endless vacuums,  
so still retain a limit.  
  
While at it fix autovacuum_multixact_freeze_max_age to refer to  
multixact.c instead of varsup.c.  
  
Reviewed-By: Robert Haas  
Discussion: CA+TgmoYmQPHcrc3GSs7vwvrbTkbcGD9Gik=OztbDGGrovkkEzQ@mail.gmail.com  
Backpatch: back to 9.0 (in parts)  

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

Make ANALYZE compute basic statistics even for types with no "=" operator.

commit   : 82e1ba7fd6cc9ac3fb1d9b819dc7295b268d3703    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Sep 2015 18:26:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Sep 2015 18:26:49 -0400    

Click here for diff

Previously, ANALYZE simply ignored columns of datatypes that have neither  
a btree nor hash opclass (which means they have no recognized equality  
operator).  Without a notion of equality, we can't identify most-common  
values nor estimate the number of distinct values.  But we can still  
count nulls and compute the average physical column width, and those  
stats might be of value.  Moreover there are some tools out there that  
don't work so well if rows are missing from pg_statistic.  So let's  
add suitable logic for this case.  
  
While this is arguably a bug fix, it also has the potential to change  
query plans, and the gain seems not worth taking a risk of that in  
stable branches.  So back-patch into 9.5 but not further.  
  
Oleksandr Shulgin, rewritten a bit by me.  

M src/backend/commands/analyze.c

Add readfuncs.c support for plan nodes.

commit   : a0d9f6e434bb56f7e5441b7988f3982feead33b3    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 23 Sep 2015 11:51:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 23 Sep 2015 11:51:50 -0400    

Click here for diff

For parallel query, we need to be able to pass a Plan to a worker, so  
that it knows what it's supposed to do.  We could invent our own way  
of serializing plans for that purpose, but piggybacking on the  
existing node infrastructure seems like a much better idea.  
  
Initially, we'll probably only support a limited number of nodes  
within parallel workers, but this commit adds support for everything  
in plannodes.h except CustomScan, because doing it all at once seems  
easier than doing it piecemeal, and it makes testing this code easier,  
too.  CustomScan is excluded because making that work requires a  
larger rework of that facility.  
  
Amit Kapila, reviewed and slightly revised by me.  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c

Print a MergeJoin's mergeNullsFirst array as bool, not int.

commit   : 4fe6f72bda7b4c3eb39560e3da50a093d833647d    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 23 Sep 2015 10:53:29 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 23 Sep 2015 10:53:29 -0400    

Click here for diff

It's declared as being an array of bool, but it's printed  
differently from the way bool and arrays of bool are handled  
elsewhere.  
  
Patch by Amit Kapila.  Anomaly noted independently by Amit Kapila  
and KaiGai Kohei.  

M src/backend/nodes/outfuncs.c

Allow autoanalyze to add pages deleted from pending list to FSM

commit   : dc943ad952329a46ce8dc0103b0980e1fe5893a8    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 23 Sep 2015 15:33:51 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 23 Sep 2015 15:33:51 +0300    

Click here for diff

Commit e95680832854cf300e64c10de9cc2f586df558e8 introduces adding pages  
to FSM for ordinary insert, but autoanalyze was able just cleanup  
pending list without adding to FSM.  
  
Also fix double call of IndexFreeSpaceMapVacuum() during ginvacuumcleanup()  
  
Report from Fujii Masao  
Patch by me  
Review by Jeff Janes  

M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginvacuum.c
M src/include/access/gin_private.h

Teach planstate_tree_walker about custom scans.

commit   : 262e56bcae4f529c47ce4fbb8306fd6e26762975    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 22 Sep 2015 21:42:00 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 22 Sep 2015 21:42:00 -0400    

Click here for diff

This logic was missing from ExplainPreScanNode, from which I derived  
planstate_tree_walker.  But it shouldn't be missing, especially not  
from a generic walker function, so add it.  
  
KaiGai Kohei  

M src/backend/nodes/nodeFuncs.c

Docs: fix typo in to_char() example.

commit   : b1d5cc375b8786b2ff6293b3f3986c8edf120898    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 Sep 2015 10:40:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 Sep 2015 10:40:25 -0400    

Click here for diff

Per bug #13631 from KOIZUMI Satoru.  

M doc/src/sgml/func.sgml

test_decoding: Protect against rare spurious test failures.

commit   : eef34e523693c15eb4ad7067c96269ab96c87ef5    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 22 Sep 2015 15:33:30 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 22 Sep 2015 15:33:30 +0200    

Click here for diff

A bunch of tests missed specifying that empty transactions shouldn't be  
displayed. That causes problems when e.g. autovacuum runs in an  
unfortunate moment. The tests in question only run for a very short  
time, making this quite unlikely.  
  
Reported-By: Buildfarm member axolotl  
Backpatch: 9.4, where logical decoding was introduced  

M contrib/test_decoding/expected/binary.out
M contrib/test_decoding/sql/binary.sql

Correct value of LW_SHARED_MASK.

commit   : 98d5b084d23b0304569ef2c1b4794754166cf0a5    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 22 Sep 2015 11:05:48 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 22 Sep 2015 11:05:48 +0200    

Click here for diff

The previous wrong value lead to wrong LOCK_DEBUG output, never showing  
any shared lock holders.  
  
Reported-By: Alexander Korotkov  
Discussion: CAPpHfdsPmWqz9FB0AnxJrwp1=KLF0n=-iB+QvR0Q8GSmpFVdUQ@mail.gmail.com  
Backpatch: 9.5, where the bug was introduced.  

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

Add some notes about coding conventions do the docs.

commit   : d9cb34abb40c547325dbf24e8986698dffc9ffa8    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 11 Sep 2015 21:33:17 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 11 Sep 2015 21:33:17 +0200    

Click here for diff

This deserves to be greatly expanded and improved, but it's a start.  
  
Discussion: [email protected]  

M doc/src/sgml/sources.sgml

doc: Tweak synopsis indentation for consistency

commit   : 84ae1af8f48fc910bbdacee4fc26a2145dc09657    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Sep 2015 23:31:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Sep 2015 23:31:43 -0400    

Click here for diff

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

Use gender-neutral language in documentation

commit   : 741ccd5015f82e31f80cdc5d2ae81263ea92d794    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Sep 2015 22:57:29 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Sep 2015 22:57:29 -0400    

Click here for diff

Based on patch by Thomas Munro <[email protected]>, although  
I rephrased most of the initial work.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/manage-ag.sgml
M doc/src/sgml/nls.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/ref/alter_user_mapping.sgml
M doc/src/sgml/ref/create_schema.sgml
M doc/src/sgml/ref/create_user_mapping.sgml
M doc/src/sgml/ref/drop_schema.sgml
M doc/src/sgml/ref/drop_user_mapping.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/revoke.sgml
M doc/src/sgml/ref/set_role.sgml
M doc/src/sgml/rules.sgml
M doc/src/sgml/sepgsql.sgml
M doc/src/sgml/sslinfo.sgml
M doc/src/sgml/start.sgml
M doc/src/sgml/user-manag.sgml
M doc/src/sgml/xplang.sgml

Fix whitespace

commit   : 13200777e7ab678d7f3535147852113ec67e6c32    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Sep 2015 13:39:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Sep 2015 13:39:34 -0400    

Click here for diff

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

Fix possible internal overflow in numeric multiplication.

commit   : 246693e5ae8a36f015294aa8c73dbbf0d4e542a8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Sep 2015 12:11:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Sep 2015 12:11:32 -0400    

Click here for diff

mul_var() postpones propagating carries until it risks overflow in its  
internal digit array.  However, the logic failed to account for the  
possibility of overflow in the carry propagation step, allowing wrong  
results to be generated in corner cases.  We must slightly reduce the  
when-to-propagate-carries threshold to avoid that.  
  
Discovered and fixed by Dean Rasheed, with small adjustments by me.  
  
This has been wrong since commit d72f6c75038d8d37e64a29a04b911f728044d83b,  
so back-patch to all supported branches.  

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

Remove the SECURITY_ROW_LEVEL_DISABLED security context bit.

commit   : 7f11724bd61b420acb2839908d51674e86e52034    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 20 Sep 2015 20:47:17 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 20 Sep 2015 20:47:17 -0400    

Click here for diff

This commit's parent made superfluous the bit's sole usage.  Referential  
integrity checks have long run as the subject table's owner, and that  
now implies RLS bypass.  Safe use of the bit was tricky, requiring  
strict control over the SQL expressions evaluating therein.  Back-patch  
to 9.5, where the bit was introduced.  
  
Based on a patch by Stephen Frost.  

M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/rls.c
M src/include/miscadmin.h
M src/include/utils/plancache.h

Remove the row_security=force GUC value.

commit   : 537bd178c73b1d25938347b17e9e3e62898fc231    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 20 Sep 2015 20:45:41 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 20 Sep 2015 20:45:41 -0400    

Click here for diff

Every query of a single ENABLE ROW SECURITY table has two meanings, with  
the row_security GUC selecting between them.  With row_security=force  
available, every function author would have been advised to either set  
the GUC locally or test both meanings.  Non-compliance would have  
threatened reliability and, for SECURITY DEFINER functions, security.  
Authors already face an obligation to account for search_path, and we  
should not mimic that example.  With this change, only BYPASSRLS roles  
need exercise the aforementioned care.  Back-patch to 9.5, where the  
row_security GUC was introduced.  
  
Since this narrows the domain of pg_db_role_setting.setconfig and  
pg_proc.proconfig, one might bump catversion.  A row_security=force  
setting in one of those columns will elicit a clear message, so don't.  

M doc/src/sgml/config.sgml
M doc/src/sgml/ddl.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/rls.c
M src/include/utils/plancache.h
M src/include/utils/rls.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Restrict file mode creation mask during tmpfile().

commit   : 8346218c029dc0db425e3bea20033f96e1543df9    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 20 Sep 2015 20:42:27 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 20 Sep 2015 20:42:27 -0400    

Click here for diff

Per Coverity.  Back-patch to 9.0 (all supported versions).  
  
Michael Paquier, reviewed (in earlier versions) by Heikki Linnakangas.  

M src/bin/pg_dump/pg_backup_tar.c

Be more wary about partially-valid LOCALLOCK data in RemoveLocalLock().

commit   : ba51774d87a2a0402628f7bd68295c0b2913cc25    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Sep 2015 16:48:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Sep 2015 16:48:44 -0400    

Click here for diff

RemoveLocalLock() must consider the possibility that LockAcquireExtended()  
failed to palloc the initial space for a locallock's lockOwners array.  
I had evidently meant to cope with this hazard when the code was originally  
written (commit 1785acebf2ed14fd66955e2d9a55d77a025f418d), but missed that  
the pfree needed to be protected with an if-test.  Just to make sure things  
are left in a clean state, reset numLockOwners as well.  
  
Per low-memory testing by Andreas Seltenreich.  Back-patch to all supported  
branches.  

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

Simplify GETTEXT_FILES list

commit   : 85eda7e92c936470515b73682cacabe972e69adc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 18 Sep 2015 22:40:41 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 18 Sep 2015 22:40:41 -0400    

Click here for diff

M src/bin/pg_rewind/nls.mk

Add missing serial comma

commit   : 4a1e15e4a911502bbfb2f36a18e6b930b6caf85d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 18 Sep 2015 22:40:10 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 18 Sep 2015 22:40:10 -0400    

Click here for diff

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

Remove trailing slashes from directories in find command

commit   : f2dd10613e7fdd40cb4f543d86e7ef19f6d0a6e4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 18 Sep 2015 22:03:42 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 18 Sep 2015 22:03:42 -0400    

Click here for diff

BSD find is not very smart and ends up writing double slashes into the  
output in those cases.  Also, xgettext is not very smart and splits the  
file names incorrectly in those cases, resulting in slightly incorrect  
file names being written into the POT file.  

M src/backend/nls.mk

Glue layer to connect the executor to the shm_mq mechanism.

commit   : 4a4e6893aa080b9094dadbe0e65f8a75fee41ac6    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Sep 2015 21:10:08 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Sep 2015 21:10:08 -0400    

Click here for diff

The shm_mq mechanism was built to send error (and notice) messages and  
tuples between backends.  However, shm_mq itself only deals in raw  
bytes.  Since commit 2bd9e412f92bc6a68f3e8bcb18e04955cc35001d, we have  
had infrastructure for one message to redirect protocol messages to a  
queue and for another backend to parse them and do useful things with  
them.  This commit introduces a somewhat analogous facility for tuples  
by adding a new type of DestReceiver, DestTupleQueue, which writes  
each tuple generated by a query into a shm_mq, and a new  
TupleQueueFunnel facility which reads raw tuples out of the queue and  
reconstructs the HeapTuple format expected by the executor.  
  
The TupleQueueFunnel abstraction supports reading from multiple tuple  
streams at the same time, but only in round-robin fashion.  Someone  
could imaginably want other policies, but this should be good enough  
to meet our short-term needs related to parallel query, and we can  
always extend it later.  
  
This also makes one minor addition to the shm_mq API that didn'  
seem worth breaking out as a separate patch.  
  
Extracted from Amit Kapila's parallel sequential scan patch.  This  
code was originally written by me, and then it was revised by Amit,  
and then it was revised some more by me.  

M src/backend/executor/Makefile
A src/backend/executor/tqueue.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/tcop/dest.c
A src/include/executor/tqueue.h
M src/include/storage/shm_mq.h
M src/include/tcop/dest.h
M src/tools/pgindent/typedefs.list

Cache argument type information in json(b) aggregate functions.

commit   : c00c3249e3247d24751d97ff6f26603810593414    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 18 Sep 2015 14:39:39 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 18 Sep 2015 14:39:39 -0400    

Click here for diff

These functions have been looking up type info for every row they  
process. Instead of doing that we only look them up the first time  
through and stash the information in the aggregate state object.  
  
Affects json_agg, json_object_agg, jsonb_agg and jsonb_object_agg.  
  
There is plenty more work to do in making these more efficient,  
especially the jsonb functions, but this is a virtually cost free  
improvement that can be done right away.  
  
Backpatch to 9.5 where the jsonb variants were introduced.  

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

Fix low-probability memory leak in regex execution.

commit   : d9c0c728afe734b7087dbb9a4bc16d5b682d139d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Sep 2015 13:55:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Sep 2015 13:55:17 -0400    

Click here for diff

After an internal failure in shortest() or longest() while pinning down the  
exact location of a match, find() forgot to free the DFA structure before  
returning.  This is pretty unlikely to occur, since we just successfully  
ran the "search" variant of the DFA; but it could happen, and it would  
result in a session-lifespan memory leak since this code uses malloc()  
directly.  Problem seems to have been aboriginal in Spencer's library,  
so back-patch all the way.  
  
In passing, correct a thinko in a comment I added awhile back about the  
meaning of the "ntree" field.  
  
I happened across these issues while comparing our code to Tcl's version  
of the library.  

M src/backend/regex/regcomp.c
M src/backend/regex/regexec.c
M src/include/regex/regguts.h

Add header forgotten in 213335c14529a8d5e2007ec0c256f4cf64d62d3b

commit   : d63a1720fa0b2ca8452c3a2aa2f6ddbb4f05b640    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 18 Sep 2015 14:32:09 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 18 Sep 2015 14:32:09 +0300    

Click here for diff

Report from Peter Eisentraut  

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

Order some new options on man pages more sensibly, minor improvements

commit   : 213335c14529a8d5e2007ec0c256f4cf64d62d3b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Sep 2015 20:56:58 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Sep 2015 20:56:58 -0400    

Click here for diff

M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/pg_ctl-ref.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_receivexlog.sgml
M doc/src/sgml/ref/pg_restore.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/ref/vacuumdb.sgml

Fix oversight in tsearch type check

commit   : 9acb9007de30b3daaa9efc16763c3bc6e3e0a92d    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 17 Sep 2015 19:50:51 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 17 Sep 2015 19:50:51 +0300    

Click here for diff

Use IsBinaryCoercible() method instead of custom  
is_expected_type/is_text_type functions which was introduced when tsearch2  
was moved into core.  
  
Per report by David E. Wheeler  
Analysis by Tom Lane  
Patch by me  

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

Honour TEMP_CONFIG when testing pg_upgrade

commit   : 5f7c804ba155cc696297f06a819721f36a731181    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 17 Sep 2015 11:57:00 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 17 Sep 2015 11:57:00 -0400    

Click here for diff

This setting contains extra configuration for the temp instance, as used  
in pg_regress' --temp-config flag.  
  
Backpatch to 9.2 where test.sh was introduced.  

M src/bin/pg_upgrade/test.sh

Add new function planstate_tree_walker.

commit   : 8dd401aa07b91d46f81e51321523864d32843523    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 17 Sep 2015 11:24:49 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 17 Sep 2015 11:24:49 -0400    

Click here for diff

ExplainPreScanNode knows how to iterate over a generic tree of plan  
states; factor that logic out into a separate walker function so that  
other code, such as upcoming patches for parallel query, can also use  
it.  
  
Patch by me, reviewed by Tom Lane.  

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

Let compiler handle size calculation of bool types.

commit   : 293fd7c77e40cdf06b7a9eb6db95379be8869b04    
  
author   : Michael Meskes <[email protected]>    
date     : Thu, 17 Sep 2015 15:41:04 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Thu, 17 Sep 2015 15:41:04 +0200    

Click here for diff

Back in the day this did not work, but modern compilers should handle it themselves.  

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

Fix bug introduced by microvacuum for GiST

commit   : 22f519c92a45eb017bf2e65f36506a75309f8094    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 17 Sep 2015 14:22:37 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 17 Sep 2015 14:22:37 +0300    

Click here for diff

Commit 013ebc0a7b7ea9c1b1ab7a3d4dd75ea121ea8ba7 introduces microvacuum for  
GiST, deletetion of tuple marked LP_DEAD uses IndexPageMultiDelete while  
recovery code uses IndexPageTupleDelete in loop. This causes a difference  
in offset numbers of tuples to delete. Patch introduces usage of  
IndexPageMultiDelete in GiST except gistplacetopage() where only one tuple is  
deleted at once. That also slightly improve performance, because  
IndexPageMultiDelete is more effective.  
  
Patch changes WAL format, so bump wal page magic.  
  
Bug report from Jeff Janes  
Diagnostic and patch by Anastasia Lubennikova and me  

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/xlog_internal.h

Determine whether it's safe to attempt a parallel plan for a query.

commit   : 7aea8e4f2daa4b39ca9d1309a0c4aadb0f7ed81b    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 16 Sep 2015 15:38:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 16 Sep 2015 15:38:47 -0400    

Click here for diff

Commit 924bcf4f16d54c55310b28f77686608684734f42 introduced a framework  
for parallel computation in PostgreSQL that makes most but not all  
built-in functions safe to execute in parallel mode.  In order to have  
parallel query, we'll need to be able to determine whether that query  
contains functions (either built-in or user-defined) that cannot be  
safely executed in parallel mode.  This requires those functions to be  
labeled, so this patch introduces an infrastructure for that.  Some  
functions currently labeled as safe may need to be revised depending on  
how pending issues related to heavyweight locking under paralllelism  
are resolved.  
  
Parallel plans can't be used except for the case where the query will  
run to completion.  If portal execution were suspended, the parallel  
mode restrictions would need to remain in effect during that time, but  
that might make other queries fail.  Therefore, this patch introduces  
a framework that enables consideration of parallel plans only when it  
is known that the plan will be run to completion.  This probably needs  
some refinement; for example, at bind time, we do not know whether a  
query run via the extended protocol will be execution to completion or  
run with a limited fetch count.  Having the client indicate its  
intentions at bind time would constitute a wire protocol break.  Some  
contexts in which parallel mode would be safe are not adjusted by this  
patch; the default is not to try parallel plans except from call sites  
that have been updated to say that such plans are OK.  
  
This commit doesn't introduce any parallel paths or plans; it just  
provides a way to determine whether they could potentially be used.  
I'm committing it on the theory that the remaining parallel sequential  
scan patches will also get committed to this release, hopefully in the  
not-too-distant future.  
  
Robert Haas and Amit Kapila.  Reviewed (in earlier versions) by Noah  
Misch.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_function.sgml
M doc/src/sgml/ref/create_function.sgml
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/proclang.c
M src/backend/commands/typecmds.c
M src/backend/executor/execMain.c
M src/backend/executor/functions.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/tcop/postgres.c
M src/backend/utils/cache/lsyscache.c
M src/bin/pg_dump/pg_dump.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_proc_fn.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/clauses.h
M src/include/parser/kwlist.h
M src/include/utils/lsyscache.h
M src/pl/plpgsql/src/pl_exec.c

Sync regex code with Tcl 8.6.4.

commit   : b44d92b67b65a76f92448b5a282aae72820ac676    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2015 15:25:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2015 15:25:25 -0400    

Click here for diff

Sync our regex code with upstream changes since last time we did this,  
which was Tcl 8.5.11 (see commit 08fd6ff37f71485e2fc04bc6ce07d2a483c36702).  
  
The only functional change here is to disbelieve that an octal escape is  
three digits long if it would exceed \377.  That's a bug fix, but it's  
a minor one and could change the interpretation of working regexes, so  
don't back-patch.  
  
In addition to that, s/INFINITY/DUPINF/ to eliminate the risk of collisions  
with <math.h>'s macro, and s/LOCAL/NOPROP/ because that also seems like  
an unnecessarily collision-prone macro name.  
  
There were some other cosmetic changes in their copy that I did not adopt,  
notably a rather half-hearted attempt at renaming some of the C functions  
in a more verbose style.  (I'm not necessarily against the concept, but  
renaming just a few functions in the package is not an improvement.)  

M src/backend/regex/regc_lex.c
M src/backend/regex/regcomp.c
M src/backend/regex/regexec.c
M src/include/regex/regguts.h

Fix documentation of regular expression character-entry escapes.

commit   : d0f18cde7e40f1f6412bb35e8645888cd620682f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2015 14:50:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2015 14:50:12 -0400    

Click here for diff

The docs claimed that \uhhhh would be interpreted as a Unicode value  
regardless of the database encoding, but it's never been implemented  
that way: \uhhhh and \xhhhh actually mean exactly the same thing, namely  
the character that pg_mb2wchar translates to 0xhhhh.  Moreover we were  
falsely dismissive of the usefulness of Unicode code points above FFFF.  
Fix that.  
  
It's been like this for ages, so back-patch to all supported branches.  

M doc/src/sgml/func.sgml

Don't use "#" as an abbreviation for "number" in PL/Tcl error messages.

commit   : 4d0fc1d54b465d4a40b3cf89908438533680e7f3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2015 12:08:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2015 12:08:57 -0400    

Click here for diff

Also, rewrite one error message to make it follow our message style  
guidelines better.  
  
Euler Taveira and Tom Lane  

M src/pl/tcl/pltcl.c

Remove no-longer-used T_PrivGrantee node tag.

commit   : ad584a08c1f19742bf971a52b71a073b9cfcfd50    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2015 10:48:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2015 10:48:11 -0400    

Click here for diff

Oversight in commit 31eae6028eca4365e7165f5f33fee1ed0486aee0, which  
replaced PrivGrantee nodes with RoleSpec nodes.  Spotted by Yugo Nagata.  

M src/include/nodes/nodes.h

pgbench progress with timestamp

commit   : 1def9063ca3c8ad66a2814a90af95ca22636bf66    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 16 Sep 2015 17:24:53 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 16 Sep 2015 17:24:53 +0300    

Click here for diff

This patch adds an option to replace the "time since pgbench run  
started" with a Unix epoch timestamp in the progress report so that,  
for instance, it is easier to compare timelines with pgsql log  
  
Fabien COELHO <[email protected]>  

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

Review program help output for wording and formatting

commit   : 5878a377ba47a39d8d3ecc1240986916eb9dbaf5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Sep 2015 00:37:39 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Sep 2015 00:37:39 -0400    

Click here for diff

M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/help.c
M src/bin/scripts/vacuumdb.c

Enforce ALL/SELECT policies in RETURNING for RLS

commit   : 4f3b2a8883c47b6710152a8e157f8a02656d0e68    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 15 Sep 2015 15:49:31 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 15 Sep 2015 15:49:31 -0400    

Click here for diff

For the UPDATE/DELETE RETURNING case, filter the records which are not  
visible to the user through ALL or SELECT policies from those considered  
for the UPDATE or DELETE.  This is similar to how the GRANT system  
works, which prevents RETURNING unless the caller has SELECT rights on  
the relation.  
  
Per discussion with Robert, Dean, Tom, and Kevin.  
  
Back-patch to 9.5 where RLS was introduced.  

M src/backend/rewrite/rowsecurity.c
M src/test/regress/expected/rowsecurity.out

RLS refactoring

commit   : 22eaf35c1d247407b7cf1fffb310a26cd9b9ceb1    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 15 Sep 2015 15:49:31 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 15 Sep 2015 15:49:31 -0400    

Click here for diff

This refactors rewrite/rowsecurity.c to simplify the handling of the  
default deny case (reducing the number of places where we check for and  
add the default deny policy from three to one) by splitting up the  
retrival of the policies from the application of them.  
  
This also allowed us to do away with the policy_id field.  A policy_name  
field was added for WithCheckOption policies and is used in error  
reporting, when available.  
  
Patch by Dean Rasheed, with various mostly cosmetic changes by me.  
  
Back-patch to 9.5 where RLS was introduced to avoid unnecessary  
differences, since we're still in alpha, per discussion with Robert.  

M src/backend/commands/policy.c
M src/backend/executor/execMain.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/cache/relcache.c
M src/include/nodes/parsenodes.h
M src/include/rewrite/rowsecurity.h
M src/test/modules/test_rls_hooks/expected/test_rls_hooks.out
M src/test/modules/test_rls_hooks/test_rls_hooks.c

Fix whitespace

commit   : 000a21336b8e218deb856f73dc8972073cb8a649    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Sep 2015 15:20:13 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Sep 2015 15:20:13 -0400    

Click here for diff

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

Revert "Fix an O(N^2) problem in foreign key references".

commit   : 3d9e8db9e56beb0501d168779ae9644587924061    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Sep 2015 11:08:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Sep 2015 11:08:56 -0400    

Click here for diff

Commit 5ddc72887a012f6a8b85707ef27d85c274faf53d does not actually work  
because it will happily blow away ri_constraint_cache entries that are  
in active use in outer call levels.  In any case, it's a very ugly,  
brute-force solution to the problem of limiting the cache size.  
Revert until it can be redesigned.  

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

Add POLICY to COMMENT documentation

commit   : 6820094d1ad37429f910cf46e9f3771ebe93347c    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 15 Sep 2015 10:56:29 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 15 Sep 2015 10:56:29 -0400    

Click here for diff

COMMENT supports POLICY but the documentation hadn't caught up with  
that fact.  
  
Patch by Charles Clavadetscher  
  
Back-patch to 9.5 where POLICY was added.  

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

Fix comment regarding the meaning of infinity for timeline history entry

commit   : 05ec71eea265622e1a311c9de3d3b186924e736a    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 15 Sep 2015 23:38:01 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 15 Sep 2015 23:38:01 +0900    

Click here for diff

Michael Paquier  

M src/include/access/timeline.h

commit   : 10fbb79f1a918124f39fc8a87b8d19db3712202f    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 15 Sep 2015 23:21:51 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 15 Sep 2015 23:21:51 +0900    

Click here for diff

This patch changes the log message which is logged when the server  
successfully renames backup_label file to *.old but fails to rename  
tablespace_map file during the shutdown. Previously the WARNING  
message "online backup mode was not canceled" was logged in that case.  
However this message is confusing because the backup mode is treated  
as canceled whenever backup_label is successfully renamed. So this  
commit makes the server log the message "online backup mode canceled"  
in that case.  
  
Also this commit changes errdetail messages so that they follow the  
error message style guide.  
  
Back-patch to 9.5 where tablespace_map file is introduced.  
  
Original patch by Amit Kapila, heavily modified by me.  

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

Fix wrong comment in commit d02426029b133ee2bbe492a038642359bce3c527

commit   : 0f75928516a55ba69d46328ec5e676c13d163831    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 15 Sep 2015 09:33:22 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 15 Sep 2015 09:33:22 +0300    

Click here for diff

Per gripe from Robert Haas  

M src/bin/pg_dump/pg_dump.c

Check existency of table/schema for -t/-n option (pg_dump/pg_restore)

commit   : d02426029b133ee2bbe492a038642359bce3c527    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 14 Sep 2015 16:19:49 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 14 Sep 2015 16:19:49 +0300    

Click here for diff

Patch provides command line option --strict-names which requires that at  
least one table/schema should present for each -t/-n option.  
  
Pavel Stehule <[email protected]>  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_restore.sgml
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_restore.c

Add noreturn attribute

commit   : b5217d696833b15ed5d3c5e858e7f20836defa95    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 13 Sep 2015 18:47:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 13 Sep 2015 18:47:56 -0400    

Click here for diff

per gcc -Wsuggest-attribute=noreturn  

M src/bin/pgbench/pgbench.c

Fix the fastpath rule for jsonb_concat with an empty operand.

commit   : e7e3ac2d51130d707792e657facc58c160182342    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 13 Sep 2015 17:06:45 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 13 Sep 2015 17:06:45 -0400    

Click here for diff

To prevent perverse results, we now only return the other operand if  
it's not scalar, and if both operands are of the same kind (array or  
object).  
  
Original bug complaint and patch from Oskari Saarenmaa, extended by me  
to cover the cases of different kinds of jsonb.  
  
Backpatch to 9.5 where jsonb_concat was introduced.  

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

doc: Remove dead links

commit   : c193b8ca9d05e8167b6deb057c06a7580fa517a3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 12 Sep 2015 23:49:11 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 12 Sep 2015 23:49:11 -0400    

Click here for diff

The web pages of Andy Dong at Berkeley don't exist anymore, and he is no  
longer there.  

M doc/src/sgml/cube.sgml

Fix typo in create_policy.sgml

commit   : e7bf508e6b527bc6c28cd5ddba99a23d27780e94    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 12 Sep 2015 17:17:00 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 12 Sep 2015 17:17:00 -0400    

Click here for diff

WTIH -> WITH  
  
Pointed out by Dmitriy Olshevskiy  
  
Backpatch to 9.5 where create_policy.sgml was added.  

M doc/src/sgml/ref/create_policy.sgml

Update SQL features list

commit   : b2ae8f1e35d85e4e24a724ef64c47deb126368f7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 12 Sep 2015 00:07:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 12 Sep 2015 00:07:56 -0400    

Click here for diff

M src/backend/catalog/sql_features.txt

Install lwlocknames.h even in vpath builds.

commit   : a7212a9997e592fe72e2095a5f4f37071787d849    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 11 Sep 2015 16:45:41 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 11 Sep 2015 16:45:41 -0400    

Click here for diff

Per buildfarm member crake.  

M src/include/Makefile

pg_dump, pg_upgrade: allow postgres/template1 tablespace moves

commit   : 7f8d090b8966ef098f45537d42e47e296210145f    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 11 Sep 2015 15:51:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 11 Sep 2015 15:51:11 -0400    

Click here for diff

Modify pg_dump to restore postgres/template1 databases to non-default  
tablespaces by switching out of the database to be moved, then switching  
back.  
  
Also, to fix potentially cases where the old/new tablespaces might not  
match, fix pg_upgrade to process new/old tablespaces separately in all  
cases.  
  
Report by Marti Raudsepp  
  
Patch by Marti Raudsepp, me  
  
Backpatch through 9.0  

M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_upgrade/info.c

Fix build problems in commit aa65de042f5828968f2f6cd65f45c543a40cc3e6.

commit   : 2ccc4e972eb85829a8fe8d39fc5ce4d770ac2e2e    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 11 Sep 2015 14:53:41 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 11 Sep 2015 14:53:41 -0400    

Click here for diff

The previous way didn't work for vpath builds, and make distprep was  
busted too.  
  
Reported off-list by Andres Freund.  

M src/backend/Makefile
M src/backend/storage/lmgr/Makefile
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h

Add missing ReleaseBuffer call in BRIN revmap code

commit   : 5cd6538345858aec128945b58265a8d5560777dc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 11 Sep 2015 15:29:46 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 11 Sep 2015 15:29:46 -0300    

Click here for diff

I think this particular branch is actually dead, but the analysis to  
prove that is not trivial, so instead take the weasel way.  
  
Reported by Jinyu Zhang  
Backpatch to 9.5, where BRIN was introduced.  

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

Fix an O(N^2) problem in foreign key references.

commit   : 5ddc72887a012f6a8b85707ef27d85c274faf53d    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 11 Sep 2015 13:06:51 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 11 Sep 2015 13:06:51 -0500    

Click here for diff

Commit 45ba424f improved foreign key lookups during bulk updates  
when the FK value does not change.  When restoring a schema dump  
from a database with many (say 100,000) foreign keys, this cache  
would grow very big and every ALTER TABLE command was causing an  
InvalidateConstraintCacheCallBack(), which uses a sequential hash  
table scan.  This could cause a severe performance regression in  
restoring a schema dump (including during pg_upgrade).  
  
The patch uses a heuristic method of detecting when the hash table  
should be destroyed and recreated.  
InvalidateConstraintCacheCallBack() adds the current size of the  
hash table to a counter.  When that sum reaches 1,000,000, the hash  
table is flushed.  This fixes the regression without noticeable  
harm to the bulk update use case.  
  
Jan Wieck  
Backpatch to 9.3 where the performance regression was introduced.  

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

When trace_lwlocks is used, identify individual lwlocks by name.

commit   : aa65de042f5828968f2f6cd65f45c543a40cc3e6    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 11 Sep 2015 13:58:28 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 11 Sep 2015 13:58:28 -0400    

Click here for diff

Naming the individual lwlocks seems like something that may be useful  
for other types of debugging, monitoring, or instrumentation output,  
but this commit just implements it for the specific case of  
trace_lwlocks.  
  
Patch by me, reviewed by Amit Kapila and Kyotaro Horiguchi  

M src/backend/Makefile
A src/backend/storage/lmgr/.gitignore
M src/backend/storage/lmgr/Makefile
A src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lwlock.c
A src/backend/storage/lmgr/lwlocknames.txt
A src/include/storage/.gitignore
M src/include/storage/lwlock.h
M src/tools/msvc/Solution.pm

Correct description of PageHeaderData layout in documentation

commit   : a1b28885177aff123cafe5a7f694555af33ad4e9    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 11 Sep 2015 13:02:15 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 11 Sep 2015 13:02:15 +0900    

Click here for diff

Back-patch to 9.3 where PageHeaderData layout was changed.  
  
Michael Paquier  

M doc/src/sgml/storage.sgml

doc: Spell checking

commit   : 103ef2021110e66c2b3b87af4b0a901683b0275e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Sep 2015 21:22:21 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Sep 2015 21:22:21 -0400    

Click here for diff

M doc/src/sgml/backup.sgml
M doc/src/sgml/brin.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/custom-scan.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/manage-ag.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/recovery-config.sgml
M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/create_domain.sgml
M doc/src/sgml/ref/create_function.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pg_xlogdump.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/pgtestfsync.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/replication-origins.sgml

Fix setrefs.c comment properly.

commit   : 87efbc2be12b07c77b7fa2d54d029329f56d6677    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Sep 2015 10:23:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Sep 2015 10:23:56 -0400    

Click here for diff

The "typo" alleged in commit 1e460d4bd was actually a comment that was  
correct when written, but I missed updating it in commit b5282aa89.  
Use a slightly less specific (and hopefully more future-proof) description  
of what is collected.  Back-patch to 9.2 where that commit appeared, and  
revert the comment to its then-entirely-correct state before that.  

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

Fix typo in setrefs.c

commit   : 1e460d4bd633462bdee34c61ad7c073aec0a941a    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 10 Sep 2015 09:22:03 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 10 Sep 2015 09:22:03 -0400    

Click here for diff

We're adding OIDs, not TIDs, to invalItems.  
  
Pointed out by Etsuro Fujita.  
  
Back-patch to all supported branches.  

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

Fix minor bug in regexp makesearch() function.

commit   : 91cf3135b9079bf44ee9b4b445531987cdb7deee    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Sep 2015 20:14:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Sep 2015 20:14:58 -0400    

Click here for diff

The list-wrangling here was done wrong, allowing the same state to get  
put into the list twice.  The following loop then would clone it twice.  
The second clone would wind up with no inarcs, so that there was no  
observable misbehavior AFAICT, but a useless state in the finished NFA  
isn't an especially good thing.  

M src/backend/regex/regcomp.c

Fix oversight in 013ebc0a7b7ea9c1b1ab7a3d4dd75ea121ea8ba7 commit

commit   : 223936e22691ccae02be7e2980b6f565518bff19    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 9 Sep 2015 19:21:16 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 9 Sep 2015 19:21:16 +0300    

Click here for diff

Declaration of varibale inside ÓÝ×Õ  

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

Microvacuum for GIST

commit   : 013ebc0a7b7ea9c1b1ab7a3d4dd75ea121ea8ba7    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 9 Sep 2015 18:43:37 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 9 Sep 2015 18:43:37 +0300    

Click here for diff

Mark index tuple as dead if it's pointed by kill_prior_tuple during  
ordinary (search) scan and remove it during insert process if there is no  
enough space for new tuple to insert. This improves select performance  
because index will not return tuple marked as dead and improves insert  
performance because it reduces number of page split.  
  
Anastasia Lubennikova <[email protected]> with  
 minor editorialization by me  

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

Remove files signaling a standby promotion request at postmaster startup

commit   : 96f6a0cb41ee06673960019f0026b1b0fd1e644d    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 9 Sep 2015 22:51:44 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 9 Sep 2015 22:51:44 +0900    

Click here for diff

This commit makes postmaster forcibly remove the files signaling  
a standby promotion request. Otherwise, the existence of those files  
can trigger a promotion too early, whether a user wants that or not.  
  
This removal of files is usually unnecessary because they can exist  
only during a few moments during a standby promotion. However  
there is a race condition: if pg_ctl promote is executed and creates  
the files during a promotion, the files can stay around even after  
the server is brought up to new master. Then, if new standby starts  
by using the backup taken from that master, the files can exist  
at the server startup and should be removed in order to avoid  
an unexpected promotion.  
  
Back-patch to 9.1 where promote signal file was introduced.  
  
Problem reported by Feike Steenbergen.  
Original patch by Michael Paquier, modified by me.  
  
Discussion: [email protected]  

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

Lock all relations referred to in updatable views

commit   : c3e0ddd403d74b161cd83cdccbb0adc45788934f    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 8 Sep 2015 17:02:49 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 8 Sep 2015 17:02:49 -0400    

Click here for diff

Even views considered "simple" enough to be automatically updatable may  
have mulitple relations involved (eg: in a where clause).  We need to  
make sure and lock those relations when rewriting the query.  
  
Back-patch to 9.3 where updatable views were added.  
  
Pointed out by Andres, patch thanks to Dean Rasheed.  

M src/backend/rewrite/rewriteHandler.c

psql: Generic tab completion support for enum and bool GUCs.

commit   : 3ae16798f0f9d2d941e50062b579c28c9b946c9e    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 8 Sep 2015 20:57:35 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 8 Sep 2015 20:57:35 +0200    

Click here for diff

Author: Pavel Stehule  
Reviewed-By: Andres Freund  
Discussion: [email protected]  

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

Add gin_fuzzy_search_limit to postgresql.conf.sample.

commit   : 043113e7982942279d940f9bf0e3a5a4b66b9aa7    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 9 Sep 2015 02:25:50 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 9 Sep 2015 02:25:50 +0900    

Click here for diff

This was forgotten in 8a3631f (commit that originally added the parameter)  
and 0ca9907 (commit that added the documentation later that year).  
  
Back-patch to all supported versions.  

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

Improve tab-completion for GRANT and REVOKE.

commit   : 2f8880704a697312d8d10ab3a2ad7ffe4b5e3dfd    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 9 Sep 2015 01:58:29 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 9 Sep 2015 01:58:29 +0900    

Click here for diff

Thomas Munro, reviewed by Michael Paquier, modified by me.  

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

Allow per-tablespace effective_io_concurrency

commit   : 1aba62ec635f5852bc45ce65482366e541e61ff5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 8 Sep 2015 12:51:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 8 Sep 2015 12:51:42 -0300    

Click here for diff

Per discussion, nowadays it is possible to have tablespaces that have  
wildly different I/O characteristics from others.  Setting different  
effective_io_concurrency parameters for those has been measured to  
improve performance.  
  
Author: Julien Rouhaud  
Reviewed by: Andres Freund  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/create_tablespace.sgml
M src/backend/access/common/reloptions.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/misc/guc.c
M src/bin/psql/tab-complete.c
M src/include/commands/tablespace.h
M src/include/nodes/execnodes.h
M src/include/storage/bufmgr.h
M src/include/utils/spccache.h

Fix error message wording in previous sslinfo commit

commit   : 665a00c9e2598e3be366cb9f99c0a04a51dd8c7a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 8 Sep 2015 11:10:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 8 Sep 2015 11:10:20 -0300    

Click here for diff

M contrib/sslinfo/sslinfo.c

contrib/sslinfo: add ssl_extension_info SRF

commit   : 49124613f134b04594b1a5c46368eb0a5db16d4b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 7 Sep 2015 21:24:17 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 7 Sep 2015 21:24:17 -0300    

Click here for diff

This new function provides information about SSL extensions present in  
the X509 certificate used for the current connection.  
  
Extension version updated to version 1.1.  
  
Author: Дмитрий Воронин (Dmitry Voronin)  
Reviewed by: Michael Paquier, Heikki Linnakangas, Álvaro Herrera  

M contrib/sslinfo/Makefile
A contrib/sslinfo/sslinfo–1.0–1.1.sql
R083 contrib/sslinfo/sslinfo–1.0.sql contrib/sslinfo/sslinfo–1.1.sql
M contrib/sslinfo/sslinfo.c
M contrib/sslinfo/sslinfo.control
M doc/src/sgml/sslinfo.sgml

In the pg_rewind test suite, receive WAL fully before promoting.

commit   : 582fbffb0ccc79de76a459df670b86d109d37ca5    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 7 Sep 2015 19:01:00 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 7 Sep 2015 19:01:00 -0400    

Click here for diff

If a transaction never reaches the standby, later tests find unexpected  
cluster state.  A "tail-copy: query result matches" test failure has  
been the usual symptom.  Among the buildfarm members having run this  
test suite, most have exhibited that symptom at least once.  Back-patch  
to 9.5, where pg_rewind was introduced.  
  
Michael Paquier, reported by Christoph Berg.  

M src/bin/pg_rewind/RewindTest.pm

Coordinate log_line_prefix options 'm' and 'n' to share a timeval.

commit   : b1e1862a123b6904d51fd0a607e30f5832bf9a1f    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 7 Sep 2015 15:40:49 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 7 Sep 2015 15:40:49 -0700    

Click here for diff

Commit f828654e introduced the 'n' option, but it invoked  
gettimeofday() independently of the 'm' option. If both options were  
in use (or multiple 'n' options), or if 'n' was in use along with  
csvlog, then the reported times could be different for the same log  
message.  
  
To fix, initialize a global variable with gettimeofday() once per log  
message, and use that for both formats.  
  
Don't bother coordinating the time for the 't' option, which has much  
lower resolution.  
  
Per complaint by Alvaro Herrera.  

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

Add more sanity checks in contrib/sslinfo

commit   : d94c36a45ab457cf43bad76656f77778b3318523    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 7 Sep 2015 19:18:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 7 Sep 2015 19:18:29 -0300    

Click here for diff

We were missing a few return checks on OpenSSL calls.  Should be pretty  
harmless, since we haven't seen any user reports about problems, and  
this is not a high-traffic module anyway; still, a bug is a bug, so  
backpatch this all the way back to 9.0.  
  
Author: Michael Paquier, while reviewing another sslinfo patch  

M contrib/sslinfo/sslinfo.c

Add log_line_prefix option 'n' for Unix epoch.

commit   : f828654e1097bdbb40fedebd9ac1ea045b183e15    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 7 Sep 2015 13:46:31 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 7 Sep 2015 13:46:31 -0700    

Click here for diff

Prints time as Unix epoch with milliseconds.  
  
Tomas Vondra, reviewed by Fabien Coelho.  

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

Change type of DOW/DOY to UNITS

commit   : 37239ef8c9fa72e0f73a307cc413a03a743878d3    
  
author   : Greg Stark <[email protected]>    
date     : Mon, 7 Sep 2015 13:35:09 +0100    
  
committer: Greg Stark <[email protected]>    
date     : Mon, 7 Sep 2015 13:35:09 +0100    

Click here for diff

M src/interfaces/ecpg/pgtypeslib/dt_common.c

Make GIN's cleanup pending list process interruptable

commit   : e26692248ada18417199b47bc2e4e1648d530953    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 7 Sep 2015 17:16:29 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 7 Sep 2015 17:16:29 +0300    

Click here for diff

Cleanup process could be called by ordinary insert/update and could take a lot  
of time. Add vacuum_delay_point() to make this process interruptable. Under  
vacuum this call will also throttle a vacuum process to decrease system load,  
called from insert/update it will not throttle, and that reduces a latency.  
  
Backpatch for all supported branches.  
  
Jeff Janes <[email protected]>  

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

Add pages deleted from pending list to FSM

commit   : e95680832854cf300e64c10de9cc2f586df558e8    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 7 Sep 2015 16:24:01 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 7 Sep 2015 16:24:01 +0300    

Click here for diff

Add pages deleted from GIN's pending list during cleanup to free space map  
immediately. Clean up process could be initiated by ordinary insert but adding  
page to FSM might occur only at vacuum. On some workload like never-vacuumed  
insert-only tables it could cause a huge bloat.  
  
Jeff Janes <[email protected]>  

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

Update site address of Snowball project

commit   : a1c44e1af62f7247610ee80bb355ef7084c24001    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 7 Sep 2015 15:20:45 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 7 Sep 2015 15:20:45 +0300    

Click here for diff

M doc/src/sgml/textsearch.sgml

Adjust sepgsql regression output for recent error context change

commit   : 03543afe1529b437e2f6861eab15f9d71debdba7    
  
author   : Joe Conway <[email protected]>    
date     : Sun, 6 Sep 2015 11:25:36 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Sun, 6 Sep 2015 11:25:36 -0700    

Click here for diff

Recent commit 0426f349e changed handling of error context reports  
in such a way to have a minor effect on the sepgsql regression  
output. Adapt the expected output file to suit. Since that commit  
was HEAD only, so is this one.  

M contrib/sepgsql/expected/label.out

Support RADIUS passwords up to 128 characters

commit   : 643beffe8f69327147513a0f0d750e8ca035a4f6    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 6 Sep 2015 14:26:33 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 6 Sep 2015 14:26:33 +0200    

Click here for diff

Previous limit was 16 characters, due to lack of support for multiple passes  
of encryption.  
  
Marko Tiikkaja  

M src/backend/libpq/auth.c

Add ability to reserve WAL upon slot creation via replication protocol.

commit   : c314ead5be0c627a6f654a74f18099466c566c47    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 6 Sep 2015 13:17:23 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 6 Sep 2015 13:17:23 +0200    

Click here for diff

Since 6fcd885 it is possible to immediately reserve WAL when creating a  
slot via pg_create_physical_replication_slot(). Extend the replication  
protocol to allow that as well.  
  
Although, in contrast to the SQL interface, it is possible to update the  
reserved location via the replication interface, it is still useful  
being able to reserve upon creation there. Otherwise the logic in  
ReplicationSlotReserveWal() has to be repeated in slot employing  
clients.  
  
Author: Michael Paquier  
Discussion: CAB7nPqT0Wc1W5mdYGeJ_wbutbwNN+3qgrFR64avXaQCiJMGaYA@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/walsender.c
M src/include/nodes/replnodes.h

Move DTK_ISODOW DTK_DOW and DTK_DOY to be type UNITS rather than RESERV. RESERV is meant for tokens like "now" and having them in that category throws errors like these when used as an input date:

commit   : 258ee1b635e43a37e901fd5f62bdd5f1087d65a5    
  
author   : Greg Stark <[email protected]>    
date     : Sun, 6 Sep 2015 02:04:37 +0100    
  
committer: Greg Stark <[email protected]>    
date     : Sun, 6 Sep 2015 02:04:37 +0100    

Click here for diff

stark=# SELECT 'doy'::timestamptz;  
ERROR:  unexpected dtype 33 while parsing timestamptz "doy"  
LINE 1: SELECT 'doy'::timestamptz;  
               ^  
stark=# SELECT 'dow'::timestamptz;  
ERROR:  unexpected dtype 32 while parsing timestamptz "dow"  
LINE 1: SELECT 'dow'::timestamptz;  
               ^  
  
Found by LLVM's Libfuzzer  

M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/timestamp.c

Fix CreateTableSpace() so it will compile without HAVE_SYMLINK.

commit   : 9270d8db9a1cd6465e21215e6451b552995fcb08    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Sep 2015 16:15:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Sep 2015 16:15:38 -0400    

Click here for diff

This has been broken since 9.3 (commit 82b1b213cad3a69c to be exact),  
which suggests that nobody is any longer using a Windows build system that  
doesn't provide a symlink emulation.  Still, it's wrong on its own terms,  
so repair.  
  
YUriy Zhuravlev  

M src/backend/commands/tablespace.c

Rearrange the handling of error context reports.

commit   : 0426f349effb6bde2061f3398a71db7180c97dd9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Sep 2015 11:58:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Sep 2015 11:58:20 -0400    

Click here for diff

Remove the code in plpgsql that suppressed the innermost line of CONTEXT  
for messages emitted by RAISE commands.  That was never more than a quick  
backwards-compatibility hack, and it's pretty silly in cases where the  
RAISE is nested in several levels of function.  What's more, it violated  
our design theory that verbosity of error reports should be controlled  
on the client side not the server side.  
  
To alleviate the resulting noise increase, introduce a feature in libpq  
and psql whereby the CONTEXT field of messages can be suppressed, either  
always or only for non-error messages.  Printing CONTEXT for errors only  
is now their default behavior.  
  
The actual code changes here are pretty small, but the effects on the  
regression test outputs are widespread.  I had to edit some of the  
alternative expected outputs by hand; hopefully the buildfarm will soon  
find anything I fat-fingered.  
  
In passing, fix up (again) the output line counts in psql's various  
help displays.  Add some commentary about how to verify them.  
  
Pavel Stehule, reviewed by Petr Jelínek, Jeevan Chalke, and others  

M contrib/dblink/expected/dblink.out
M contrib/dblink/sql/dblink.sql
M contrib/hstore_plperl/expected/hstore_plperlu.out
M contrib/hstore_plpython/expected/hstore_plpython.out
M contrib/ltree_plpython/expected/ltree_plpython.out
M contrib/sepgsql/expected/alter.out
M contrib/sepgsql/expected/label.out
M doc/src/sgml/libpq.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/help.c
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/tab-complete.c
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/pl/plperl/expected/plperl.out
M src/pl/plperl/expected/plperl_elog.out
M src/pl/plperl/expected/plperl_elog_1.out
M src/pl/plperl/expected/plperl_trigger.out
M src/pl/plperl/expected/plperlu.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpython/expected/plpython_do.out
M src/pl/plpython/expected/plpython_error.out
M src/pl/plpython/expected/plpython_error_0.out
M src/pl/plpython/expected/plpython_error_5.out
M src/pl/plpython/expected/plpython_spi.out
M src/pl/plpython/expected/plpython_subtransaction.out
M src/pl/plpython/expected/plpython_subtransaction_0.out
M src/pl/plpython/expected/plpython_subtransaction_5.out
M src/pl/plpython/expected/plpython_test.out
M src/pl/plpython/expected/plpython_trigger.out
M src/pl/plpython/expected/plpython_types.out
M src/pl/plpython/expected/plpython_types_3.out
M src/test/regress/expected/copy2.out
M src/test/regress/expected/event_trigger.out
M src/test/regress/expected/plancache.out
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/psql.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/expected/triggers.out
M src/test/regress/expected/xml.out
M src/test/regress/sql/event_trigger.sql
M src/test/regress/sql/psql.sql

Fix misc typos.

commit   : c80b5f66c6faff085e312492be0aa50754e99eb9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 5 Sep 2015 11:35:49 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 5 Sep 2015 11:35:49 +0300    

Click here for diff

Oskari Saarenmaa. Backpatch to stable branches where applicable.  

M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_utils_var.c
M contrib/cube/cube.c
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/sources.sgml
M src/backend/access/brin/brin_revmap.c
M src/backend/access/common/heaptuple.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gist/gistproc.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/xact.c
M src/backend/optimizer/path/costsize.c
M src/backend/replication/logical/origin.c
M src/backend/utils/adt/regproc.c
M src/include/storage/lwlock.h

Fix brin index summarizing while vacuuming.

commit   : c39f5674dfc77802b4245dd92cb4b1e35499a5a5    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Sat, 5 Sep 2015 09:19:25 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Sat, 5 Sep 2015 09:19:25 +0900    

Click here for diff

If the number of heap blocks is not multiples of pages per range, the  
summarizing produces wrong summary information for the last brin index  
tuple while vacuuming.  
  
Problem reported by Tatsuo Ishii and fixed by Amit Langote.  
  
Discussion at "[HACKERS] BRIN INDEX value (message id :[email protected])  
Backpatched to 9.5 in which brin index was added.  

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

Fix subtransaction cleanup after an outer-subtransaction portal fails.

commit   : c5454f99c49fce01ce946b5f52a4929c21d5f229    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Sep 2015 13:36:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Sep 2015 13:36:49 -0400    

Click here for diff

Formerly, we treated only portals created in the current subtransaction as  
having failed during subtransaction abort.  However, if the error occurred  
while running a portal created in an outer subtransaction (ie, a cursor  
declared before the last savepoint), that has to be considered broken too.  
  
To allow reliable detection of which ones those are, add a bookkeeping  
field to struct Portal that tracks the innermost subtransaction in which  
each portal has actually been executed.  (Without this, we'd end up  
failing portals containing functions that had called the subtransaction,  
thereby breaking plpgsql exception blocks completely.)  
  
In addition, when we fail an outer-subtransaction Portal, transfer its  
resources into the subtransaction's resource owner, so that they're  
released early in cleanup of the subxact.  This fixes a problem reported by  
Jim Nasby in which a function executed in an outer-subtransaction cursor  
could cause an Assert failure or crash by referencing a relation created  
within the inner subtransaction.  
  
The proximate cause of the Assert failure is that AtEOSubXact_RelationCache  
assumed it could blow away a relcache entry without first checking that the  
entry had zero refcount.  That was a bad idea on its own terms, so add such  
a check there, and to the similar coding in AtEOXact_RelationCache.  This  
provides an independent safety measure in case there are still ways to  
provoke the situation despite the Portal-level changes.  
  
This has been broken since subtransactions were invented, so back-patch  
to all supported branches.  
  
Tom Lane and Michael Paquier  

M src/backend/access/transam/xact.c
M src/backend/commands/portalcmds.c
M src/backend/tcop/pquery.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/mmgr/portalmem.c
M src/include/utils/portal.h
M src/test/regress/expected/transactions.out
M src/test/regress/sql/transactions.sql

Make unaccent handle all diacritics known to Unicode, and expand ligatures correctly

commit   : 1bbd52cb9a4aa61a7dd751f5d1f7b44650d6122a    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 4 Sep 2015 12:51:53 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 4 Sep 2015 12:51:53 +0300    

Click here for diff

Add Python script for buiding unaccent.rules from Unicode data. Don't  
backpatch because unaccent changes may require tsvector/index  
rebuild.  
  
Thomas Munro <[email protected]>  

A contrib/unaccent/generate_unaccent_rules.py
M contrib/unaccent/unaccent.rules

Assorted code review for recent ProcArrayLock patch.

commit   : 4aec49899e5782247e134f94ce1c6ee926f88e1c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 3 Sep 2015 13:10:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 3 Sep 2015 13:10:53 -0400    

Click here for diff

Post-commit review by Andres Freund discovered a couple of concurrency  
bugs in the original patch: specifically, if the leader cleared a  
follower's XID before it reached PGSemaphoreLock, the semaphore would be  
left in the wrong state; and if another process did PGSemaphoreUnlock  
for some unrelated reason, we might resume execution before the fact  
that our XID was cleared was globally visible.  
  
Also, improve the wording of some comments, rename nextClearXidElem  
to firstClearXidElem in PROC_HDR for clarity, and drop some volatile  
qualifiers that aren't necessary.  
  
Amit Kapila, reviewed and slightly revised by me.  

M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/proc.h

Document that max_worker_processes must be high enough in standby.

commit   : 1ea5ce5c5f204918b8a9fa6eaa8f3f1374aa8aec    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 3 Sep 2015 22:30:16 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 3 Sep 2015 22:30:16 +0900    

Click here for diff

The setting values of some parameters including max_worker_processes  
must be equal to or higher than the values on the master. However,  
previously max_worker_processes was not listed as such parameter  
in the document. So this commit adds it to that list.  
  
Back-patch to 9.4 where max_worker_processes was added.  

M doc/src/sgml/high-availability.sgml
M src/backend/access/transam/xlog.c

Disable fsync throughout TAP test suites.

commit   : 7d7a103f41fbdc54e608c431ead866061289307d    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 3 Sep 2015 00:29:11 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 3 Sep 2015 00:29:11 -0400    

Click here for diff

Most suites already did so via start_test_server(), but the pg_rewind,  
pg_ctl and pg_controldata suites ran a postmaster or initdb with fsync  
enabled.  This halves the pg_rewind suite's runtime on buildfarm member  
tern.  It makes tern and that machine's other buildfarm members less  
vulnerable to noise failures from postmaster startup overrunning the 60s  
pg_ctl timeout.  Back-patch to 9.5, where pg_rewind was introduced.  

M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/test/perl/TestLib.pm

Update the SSL test suite for recent changes to TAP testing framework.

commit   : a09009e4278439f99d03adfefe2eec72ca35dcc3    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 2 Sep 2015 16:21:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 2 Sep 2015 16:21:38 -0400    

Click here for diff

listen_addresses needs to be handled differently now, and so does  
logging.  
  
Michael Paquier  

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

Allow usage of huge maintenance_work_mem for GIN build.

commit   : 30bb26b5e04cff911db960801e32e5f57045eb61    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 2 Sep 2015 20:08:58 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 2 Sep 2015 20:08:58 +0300    

Click here for diff

Currently, in-memory posting list during GIN build process is limited 1GB  
because of using repalloc. The patch replaces call of repalloc to repalloc_huge.  
It increases limit of posting list from 180 millions  
(1GB / sizeof(ItemPointerData)) to 4 billions limited by maxcount/count fields  
in GinEntryAccumulator and subsequent calls. Check added.  
  
Also, fix accounting of allocatedMemory during build to prevent integer  
overflow with maintenance_work_mem > 4GB.  
  
Robert Abraham <[email protected]> with additions by me  

M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/gininsert.c
M src/include/access/gin_private.h

Document that PL/Python now returns floats using repr() not str().

commit   : 075ab425bdbb4bb2de41624305f20885cae7ba7e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Sep 2015 19:25:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Sep 2015 19:25:58 -0400    

Click here for diff

Commit 1ce7a57ca neglected to update the user-facing documentation,  
which described the old behavior precisely.  

M doc/src/sgml/plpython.sgml

Flush to show results of TestLib.pm (TAP) test as we go.

commit   : adb495049f575563930f3c1fbef2843bda3ae46d    
  
author   : Kevin Grittner <[email protected]>    
date     : Tue, 1 Sep 2015 16:12:22 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Tue, 1 Sep 2015 16:12:22 -0500    

Click here for diff

It appears that some attempt was made to do this using autocommit,  
but it wasn't effective (at least on Ubuntu 14.04).  

M src/test/perl/SimpleTee.pm

pg_upgrade docs: clarify rsync and move verification step

commit   : 46bd95e2a873feb4799b77eca7276cf758e36cca    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 1 Sep 2015 16:42:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 1 Sep 2015 16:42:43 -0400    

Click here for diff

These are adjustments based on someone using the new standby upgrade  
steps.  
  
Report by Andy Colson  
  
Backpatch through 9.5  

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

Allow notifications to bgworkers without database connections.

commit   : 8a02b3d732cf3ec13e089768bf9ce9abbdcc8a3e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 1 Sep 2015 15:30:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 1 Sep 2015 15:30:19 -0400    

Click here for diff

Previously, if one background worker registered another background  
worker and set bgw_notify_pid while for the second background worker,  
it would not receive notifications from the postmaster unless, at the  
time the "parent" was registered, BGWORKER_BACKEND_DATABASE_CONNECTION  
was set.  
  
To fix, instead instead of including only those background workers that  
requested database connections in the postmater's BackendList, include  
them all.  There doesn't seem to be any reason not do this, and indeed  
it removes a significant amount of duplicated code.  The other option  
is to make PostmasterMarkPIDForWorkerNotify look at BackgroundWorkerList  
in addition to BackendList, but that adds more code duplication instead  
of getting rid of it.  
  
Patch by me.  Review and testing by Ashutosh Bapat.  

M src/backend/postmaster/postmaster.c

Use <substeps> in pg_upgrade's procedure

commit   : 9646d2fd62a444ab4502e49dfe3cbf9d7350c5e2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 1 Sep 2015 14:58:28 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 1 Sep 2015 14:58:28 -0300    

Click here for diff

For clarity, so that the substeps are not numbered identically to the  
outer procedure's steps.  
  
Per report from Andy Colson in  
http://www.postgresql.org/message-id/[email protected]  

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

Clean up icc + ia64 situation.

commit   : 123c9d2fc1fe0a8ee676d8244198b34a5e99ea90    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 31 Aug 2015 18:10:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 31 Aug 2015 18:10:04 -0400    

Click here for diff

Some googling turned up multiple sources saying that older versions of icc  
do not accept gcc-compatible asm blocks on IA64, though asm does work on  
x86[_64].  This is apparently fixed as of icc version 12.0 or so, but that  
doesn't help us much; if we have to carry the extra implementation anyway,  
we may as well just use it for icc rather than add a compiler version test.  
  
Hence, revert commit 2c713d6ea29c91cd2cbd92fa801a61e55ea2a3c4 (though I  
separated the icc code from the gcc code completely, producing what seems  
cleaner code).  Document the state of affairs more explicitly, both in  
s_lock.h and postgres.c, and make some cosmetic adjustments around the  
IA64 code in s_lock.h.  

M src/backend/tcop/postgres.c
M src/include/storage/s_lock.h

docs: remove outdated note about unique indexes

commit   : 049a7799dfce096923da27a9b0e4a3c7a0a47104    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2015 17:05:23 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2015 17:05:23 -0400    

Click here for diff

Patch by Josh Kupershmidt  
  
Backpatch through 9.5  

M doc/src/sgml/indices.sgml

Allow icc to use the same atomics infrastructure as gcc.

commit   : cf25b2a2f9a4306637a985cee86a9a987c0b6a7c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 31 Aug 2015 16:30:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 31 Aug 2015 16:30:12 -0400    

Click here for diff

The atomics headers were written under the impression that icc doesn't  
handle gcc-style asm blocks, but this is demonstrably false on x86_[64],  
because s_lock.h has done it that way for more than a decade.  (The jury is  
still out on whether this also works on ia64, so I'm leaving ia64-related  
code alone for the moment.)  Treat gcc and icc the same in these headers.  
This is less code and it should improve the results for icc, because we  
hadn't gotten around to providing icc-specific implementations for most  
of the atomics.  

M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/generic-gcc.h

Actually, it's not that hard to merge the Windows pqsignal code ...

commit   : f333204bbcd32091311b070e8f8ab4717dd8cadf    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 31 Aug 2015 15:52:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 31 Aug 2015 15:52:56 -0400    

Click here for diff

... just need to typedef sigset_t and provide sigemptyset/sigfillset,  
which are easy enough.  

M src/backend/libpq/pqsignal.c
M src/include/libpq/pqsignal.h

Remove theoretically-unnecessary special case for icc.

commit   : 2c713d6ea29c91cd2cbd92fa801a61e55ea2a3c4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 31 Aug 2015 14:43:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 31 Aug 2015 14:43:10 -0400    

Click here for diff

Intel's icc is generally able to swallow asm blocks written for gcc.  
We have a few places that don't seem to know that, though.  Experiment  
with removing the special case for icc in ia64_get_bsp(); if the buildfarm  
likes this, I'll try more cleanup.  This is a good test case because it  
involves a "stop" notation that seems like it might not be very portable.  

M src/backend/tcop/postgres.c

Remove support for Unix systems without the POSIX signal APIs.

commit   : a65e086453e0dea5cdd7f9fe9dc6c34d8bfc0f2c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 31 Aug 2015 12:55:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 31 Aug 2015 12:55:59 -0400    

Click here for diff

Remove configure's checks for HAVE_POSIX_SIGNALS, HAVE_SIGPROCMASK, and  
HAVE_SIGSETJMP.  These APIs are required by the Single Unix Spec v2  
(POSIX 1997), which we generally consider to define our minimum required  
set of Unix APIs.  Moreover, no buildfarm member has reported not having  
them since 2012 or before, which means that even if the code is still live  
somewhere, it's untested --- and we've made plenty of signal-handling  
changes of late.  So just take these APIs as given and save the cycles for  
configure probes for them.  
  
However, we can't remove as much C code as I'd hoped, because the Windows  
port evidently still uses the non-POSIX code paths for signal masking.  
Since we're largely emulating these BSD-style APIs for Windows anyway, it  
might be a good thing to switch over to POSIX-like notation and thereby  
remove a few more #ifdefs.  But I'm not in a position to code or test that.  
In the meantime, we can at least make things a bit more transparent by  
testing for WIN32 explicitly in these places.  

M config/c-library.m4
M configure
M configure.in
M src/Makefile.global.in
M src/backend/libpq/pqsignal.c
M src/include/c.h
M src/include/libpq/pqsignal.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/makefiles/Makefile.hpux
M src/port/pqsignal.c

psql: print longtable as a possible \pset option

commit   : 8f7d044ba842ab3359a8a3190ff2f3aa1de2a6bb    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2015 12:24:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2015 12:24:16 -0400    

Click here for diff

For some reason this message was not updated when the longtable option  
was added.  
  
Backpatch through 9.3  

M src/bin/psql/command.c

Small grammar fix

commit   : 93370076c40730ce2a9071c6a4694d6b0e5b2f0c    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 31 Aug 2015 14:07:17 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 31 Aug 2015 14:07:17 +0200    

Click here for diff

Josh Kupershmidt  

M doc/src/sgml/pgprewarm.sgml

Remove long-dead support for platforms without sig_atomic_t.

commit   : 0f19d0f12fa235c6951ff431bd60da594356a1a6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 31 Aug 2015 01:36:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 31 Aug 2015 01:36:46 -0400    

Click here for diff

C89 requires <signal.h> to define sig_atomic_t, and there is no evidence  
in the buildfarm that any supported platforms don't comply.  Remove the  
configure test to stop wasting build cycles on a purely historical issue.  
(Once upon a time, we cared about supporting C89-compliant compilers on  
machines with pre-C89 system headers, but that use-case has been dead for  
quite a few years.)  
  
I have some other fixes planned in this area, but let's start with this  
to see if the buildfarm produces any surprising results.  

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

Fix sepgsql regression tests.

commit   : 794e2558be670be65a8fdb52b99438a67cd74631    
  
author   : Joe Conway <[email protected]>    
date     : Sun, 30 Aug 2015 11:09:05 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Sun, 30 Aug 2015 11:09:05 -0700    

Click here for diff

The regression tests for sepgsql were broken by changes in the  
base distro as-shipped policies. Specifically, definition of  
unconfined_t in the system default policy was changed to bypass  
multi-category rules, which the regression test depended on.  
Fix that by defining a custom privileged domain  
(sepgsql_regtest_superuser_t) and using it instead of system's  
unconfined_t domain. The new sepgsql_regtest_superuser_t domain  
performs almost like the current unconfined_t, but restricted by  
multi-category policy as the traditional unconfined_t was.  
  
The custom policy module is a self defined domain, and so should not  
be affected by related future system policy changes. However, it still  
uses the unconfined_u:unconfined_r pair for selinux-user and role.  
Those definitions have not been changed for several years and seem  
less risky to rely on than the unconfined_t domain. Additionally, if  
we define custom user/role, they would need to be manually defined  
at the operating system level, adding more complexity to an already  
non-standard and complex regression test.  
  
Back-patch to 9.3. The regression tests will need more work before  
working correctly on 9.2. Starting with 9.2, sepgsql has had dependencies  
on libselinux versions that are only available on newer distros with  
the changed set of policies (e.g. RHEL 7.x). On 9.1 sepgsql works  
fine with the older distros with original policy set (e.g. RHEL 6.x),  
and on which the existing regression tests work fine. We might want  
eventually change 9.1 sepgsql regression tests to be more independent  
from the underlying OS policies, however more work will be needed to  
make that happen and it is not clear that it is worth the effort.  
  
Kohei KaiGai with review by Adam Brightwell and me, commentary by  
Stephen, Alvaro, Tom, Robert, and others.  

M contrib/sepgsql/expected/alter.out
M contrib/sepgsql/expected/ddl.out
M contrib/sepgsql/expected/dml.out
M contrib/sepgsql/expected/label.out
M contrib/sepgsql/expected/misc.out
M contrib/sepgsql/launcher
M contrib/sepgsql/sepgsql-regtest.te
M contrib/sepgsql/sql/alter.sql
M contrib/sepgsql/sql/ddl.sql
M contrib/sepgsql/sql/dml.sql
M contrib/sepgsql/sql/label.sql

Fix s_lock.h PPC assembly code to be compatible with native AIX assembler.

commit   : c41a1215f04912108068b909569551f42059db29    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 29 Aug 2015 16:09:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 29 Aug 2015 16:09:25 -0400    

Click here for diff

On recent AIX it's necessary to configure gcc to use the native assembler  
(because the GNU assembler hasn't been updated to handle AIX 6+).  This  
caused PG builds to fail with assembler syntax errors, because we'd try  
to compile s_lock.h's gcc asm fragment for PPC, and that assembly code  
relied on GNU-style local labels.  We can't substitute normal labels  
because it would fail in any file containing more than one inlined use of  
tas().  Fortunately, that code is stable enough, and the PPC ISA is simple  
enough, that it doesn't seem like too much of a maintenance burden to just  
hand-code the branch offsets, removing the need for any labels.  
  
Note that the AIX assembler only accepts "$" for the location counter  
pseudo-symbol.  The usual GNU convention is "."; but it appears that all  
versions of gas for PPC also accept "$", so in theory this patch will not  
break any other PPC platforms.  
  
This has been reported by a few people, but Steve Underwood gets the credit  
for being the first to pursue the problem far enough to understand why it  
was failing.  Thanks also to Noah Misch for additional testing.  

M src/include/storage/s_lock.h

Ensure locks are acquired on RLS-added relations

commit   : 2ba9e2b778af7a8d040283db6cee11fb03cf9f4a    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 28 Aug 2015 11:39:37 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 28 Aug 2015 11:39:37 -0400    

Click here for diff

During fireRIRrules(), get_row_security_policies can add to  
securityQuals and withCheckOptions.  Make sure to lock any relations  
added at that point and before firing RIR rules on those expressions.  
  
Back-patch to 9.5 where RLS was added.  

M src/backend/rewrite/rewriteHandler.c

Clarify what some historic terms in rewriteHandler.c mean.

commit   : c0f0d8097be17ae7f03fc79f622e9c95026b338a    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 28 Aug 2015 16:24:32 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 28 Aug 2015 16:24:32 +0200    

Click here for diff

Discussion: [email protected]  

M src/backend/rewrite/rewriteHandler.c

Simplify Perl chmod calls

commit   : c86762a242b81395d5f72b106adfe371cd33c67e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 25 Aug 2015 09:58:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 25 Aug 2015 09:58:49 -0400    

Click here for diff

The Perl chmod function already takes multiple file arguments, so we  
don't need a separate looping function.  

M src/test/ssl/ServerSetup.pm

commit   : 119cf760d01c2a41d68ff489ad3c3b7eddc974f0    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 27 Aug 2015 13:43:10 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 27 Aug 2015 13:43:10 -0400    

Click here for diff

This makes the parameter names match the documented prototype names.  
  
Report by Erwin Brandstetter  
  
Backpatch through 9.0  

M doc/src/sgml/dblink.sgml

Speed up HeapTupleSatisfiesMVCC() by replacing the XID-in-progress test.

commit   : 8a7d0701814a4e293efad22091d6f6fb441bbe1c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Aug 2015 18:18:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Aug 2015 18:18:57 -0400    

Click here for diff

Rather than consulting TransactionIdIsInProgress to see if an in-doubt  
transaction is still running, consult XidInMVCCSnapshot.  That requires  
the same or fewer cycles as TransactionIdIsInProgress, and what's far  
more important, it does not access shared data structures (at least in the  
no-subxip-overflow case) so it incurs no contention.  Furthermore, we would  
have had to check XidInMVCCSnapshot anyway before deciding that we were  
allowed to see the tuple.  
  
There should never be a case where XidInMVCCSnapshot says a transaction is  
done while TransactionIdIsInProgress says it's still running.  The other  
way around is quite possible though.  The result of that difference is that  
HeapTupleSatisfiesMVCC will no longer set hint bits on tuples whose source  
transactions recently finished but are still running according to our  
snapshot.  The main cost of delaying the hint-bit setting is that repeated  
visits to a just-committed tuple, by transactions none of which have  
snapshots new enough to see the source transaction as done, will each  
execute TransactionIdIsCurrentTransactionId, which they need not have done  
before.  However, that's normally just a small overhead, and no contention  
costs are involved; so it seems well worth the benefit of removing  
TransactionIdIsInProgress calls during the life of the source transaction.  
  
The core idea for this patch is due to Jeff Janes, who also did the legwork  
proving its performance benefits.  His original proposal was to swap the  
order of TransactionIdIsInProgress and XidInMVCCSnapshot calls in some  
cases within HeapTupleSatisfiesMVCC.  That was a bit messy though.  
The idea that we could dispense with calling TransactionIdIsInProgress  
altogether was mine, as is the final patch.  

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

release notes: abbreviated key speedup only for varchar/text

commit   : 16d4f94e67d9b5f965b593dfb9d529bd5aaaeed9    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 26 Aug 2015 14:46:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 26 Aug 2015 14:46:48 -0400    

Click here for diff

Report by Peter Geoghegan  
  
Backpatch through 9.5  

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

9.5 release notes: mention lack of char() sort improvements

commit   : 8190f2dfef0c8cf17acb678b7d24f68e4c80a44e    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 26 Aug 2015 10:33:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 26 Aug 2015 10:33:02 -0400    

Click here for diff

Report by Peter Geoghegan  
  
Backpatch through 9.5  

M doc/src/sgml/datatype.sgml

Reestablish alignment of pg_controldata output.

commit   : 56c8ce8f6573d4943a621d09ebb6fe767f16d61e    
  
author   : Joe Conway <[email protected]>    
date     : Tue, 25 Aug 2015 18:45:44 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Tue, 25 Aug 2015 18:45:44 -0700    

Click here for diff

Until 9.4, pg_controldata output was all aligned. At some point  
during 9.5 development, a new item was added, namely  
"Current track_commit_timestamp setting:" which is two characters  
too long to be aligned with the rest of the output. Fix this by  
removing the noise word "Current" and adding the requisite number  
of padding spaces. Since the six preceding items are also similar  
in nature, remove "Current" and pad those as well in order to  
maintain overall consistency. Backpatch to 9.5 where new offending  
item was added.  

M src/bin/pg_controldata/pg_controldata.c

Docs: be explicit about datatype matching for lead/lag functions.

commit   : 94324abfb945bd470ec63f5745a0a2e2c218989c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Aug 2015 19:11:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Aug 2015 19:11:17 -0400    

Click here for diff

The default argument, if given, has to be of exactly the same datatype  
as the first argument; but this was not stated in so many words, and  
the error message you get about it might not lead your thought in the  
right direction.  Per bug #13587 from Robert McGehee.  
  
A quick scan says that these are the only two built-in functions with two  
anyelement arguments and no other polymorphic arguments.  There are plenty  
of cases of, eg, anyarray and anyelement, but those seem less likely to  
confuse.  For instance this doesn't seem terribly hard to figure out:  
"function array_remove(integer[], numeric) does not exist".  So I've  
contented myself with fixing these two cases.  

M doc/src/sgml/func.sgml

Further tweak wording of error messages about bad CONTINUE/EXIT statements.

commit   : 781ed2bfa35f0a8a7ad1029d3a7d7687c73d86a0    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Aug 2015 14:06:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Aug 2015 14:06:13 -0400    

Click here for diff

Per discussion, a little more verbosity seems called for.  

M src/pl/plpgsql/src/pl_gram.y
M src/test/regress/expected/plpgsql.out

Limit the verbosity of memory context statistics dumps.

commit   : 7b5ef8f2d070c075811ec04a0fcb745d67c7fe3f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Aug 2015 13:09:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Aug 2015 13:09:48 -0400    

Click here for diff

We had a report from Stefan Kaltenbrunner of a case in which postmaster  
log files overran available disk space because multiple backends spewed  
enormous context stats dumps upon hitting an out-of-memory condition.  
Given the lack of similar reports, this isn't a common problem, but it  
still seems worth doing something about.  However, we don't want to just  
blindly truncate the output, because that might prevent diagnosis of OOM  
problems.  What seems like a workable compromise is to limit the dump to  
100 child contexts per parent, and summarize the space used within any  
additional child contexts.  That should help because practical cases where  
the dump gets long will typically be huge numbers of siblings under the  
same parent context; while the additional debugging value from seeing  
details about individual siblings beyond 100 will not be large, we hope.  
Anyway it doesn't take much code or memory space to do this, so let's try  
it like this and see how things go.  
  
Since the summarization mechanism requires passing totals back up anyway,  
I took the opportunity to add a "grand total" line to the end of the  
printout.  

M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/mcxt.c
M src/include/nodes/memnodes.h
M src/include/utils/memutils.h

Fix potential platform dependence in gist regression test.

commit   : e39c4afcfa0fb2c708e49e54089118d9b4ba5f89    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Aug 2015 11:43:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Aug 2015 11:43:37 -0400    

Click here for diff

The results of the KNN-search test cases were indeterminate, as they asked  
the system to sort pairs of points that are exactly equidistant from the  
query reference point.  It's a bit surprising that we've seen no  
platform-specific failures from this in the buildfarm.  Perhaps IEEE-float  
math is well enough standardized that no such failures will ever occur on  
supported platforms ... but since this entire regression test has yet to be  
shipped in any non-alpha release, that seems like an unduly optimistic  
assumption.  Tweak the queries so that the correct output is uniquely  
defined.  
  
(The other queries in this test are also underdetermined; but it looks like  
they are regurgitating index rows in insertion order, so for the moment  
assume that that behavior is stable enough.)  
  
Per Greg Stark's experiments with VAX.  Back-patch to 9.5 where this test  
script was introduced.  

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

Tweak wording of syntax error messages about bad CONTINUE/EXIT statements.

commit   : 18391a8f0649f40bb841e6492895551fd873f79b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Aug 2015 17:34:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Aug 2015 17:34:47 -0400    

Click here for diff

Try to avoid any possible confusion about what these messages mean.  

M src/pl/plpgsql/src/pl_gram.y
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Reduce number of bytes examined by convert_one_string_to_scalar().

commit   : aad663a0b4af785d0b245bbded27537f23932839    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Aug 2015 15:15:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Aug 2015 15:15:47 -0400    

Click here for diff

Previously, convert_one_string_to_scalar() would examine up to 20 bytes of  
the input string, producing a scalar conversion with theoretical precision  
far greater than is of any possible use considering the other limitations  
on the accuracy of the resulting selectivity estimate.  (I think this  
choice might pre-date the caller-level logic that strips any common prefix  
of the strings; before that, there could have been value in scanning the  
strings far enough to use all the precision available in a double.)  
  
Aside from wasting cycles to little purpose, this choice meant that the  
"denom" variable could grow to as much as 256^21 = 3.74e50, which could  
overflow in some non-IEEE float arithmetics.  While we don't really support  
any machines with non-IEEE arithmetic anymore, this still seems like quite  
an unnecessary platform dependency.  Limit the scan to 12 bytes instead,  
thus limiting "denom" to 256^13 = 2.03e31, a value more likely to be  
computable everywhere.  
  
Per testing by Greg Stark, which showed overflow failures in our standard  
regression tests on VAX.  

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

Avoid use of float arithmetic in bipartite_match.c.

commit   : 44ed65a545970829322098e22d10947e6d545d9a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Aug 2015 13:02:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Aug 2015 13:02:13 -0400    

Click here for diff

Since the distances used in this algorithm are small integers (not more  
than the size of the U set, in fact), there is no good reason to use float  
arithmetic for them.  Use short ints instead: they're smaller, faster, and  
require no special portability assumptions.  
  
Per testing by Greg Stark, which disclosed that the code got into an  
infinite loop on VAX for lack of IEEE-style float infinities.  We don't  
really care all that much whether Postgres can run on a VAX anymore,  
but there seems sufficient reason to change this code anyway.  
  
In passing, make a few other small adjustments to make the code match  
usual Postgres coding style a bit better.  

M src/backend/lib/bipartite_match.c
M src/include/lib/bipartite_match.h

Fix typo in C comment.

commit   : 5956b7f9e858ac5613dd0214ac7fb2476f900771    
  
author   : Kevin Grittner <[email protected]>    
date     : Sun, 23 Aug 2015 10:38:57 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Sun, 23 Aug 2015 10:38:57 -0500    

Click here for diff

Merlin Moncure  
Backpatch to 9.5, where the misspelling was introduced  

M src/backend/commands/trigger.c

Improve whitespace

commit   : b386271594687205becc9518cff2d2a4dca2c933    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 22 Aug 2015 21:41:29 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 22 Aug 2015 21:41:29 -0400    

Click here for diff

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

Improve spelling

commit   : 6103b3f368e1a379705f866c74a9be1e28cb1c77    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 22 Aug 2015 21:41:13 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 22 Aug 2015 21:41:13 -0400    

Click here for diff

M contrib/btree_gist/Makefile

Add hint to run "pgbench -i", if test tables don't exist.

commit   : e7b90c52b3ee440f63445ba8f83419fd713069cf    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 22 Aug 2015 14:19:10 +0100    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 22 Aug 2015 14:19:10 +0100    

Click here for diff

Fabien Coelho, reviewed by Julien Rouhaud  

M src/bin/pgbench/pgbench.c

Avoid O(N^2) behavior when enlarging SPI tuple table in spi_printtup().

commit   : 6e5d9f278c1209936d973930996857f55e119cd8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2015 20:32:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2015 20:32:11 -0400    

Click here for diff

For no obvious reason, spi_printtup() was coded to enlarge the tuple  
pointer table by just 256 slots at a time, rather than doubling the size at  
each reallocation, as is our usual habit.  For very large SPI results, this  
makes for O(N^2) time spent in repalloc(), which of course soon comes to  
dominate the runtime.  Use the standard doubling approach instead.  
  
This is a longstanding performance bug, so back-patch to all active  
branches.  
  
Neil Conway  

M src/backend/executor/spi.c

Detect mismatched CONTINUE and EXIT statements at plpgsql compile time.

commit   : fcdfce6820373422bcdb5630f9eb63df14fd0764    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2015 20:17:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2015 20:17:19 -0400    

Click here for diff

With a bit of tweaking of the compile namestack data structure, we can  
verify at compile time whether a CONTINUE or EXIT is legal.  This is  
surely better than leaving it to runtime, both because earlier is better  
and because we can issue a proper error pointer.  Also, we can get rid  
of the ad-hoc old way of detecting the problem, which only took care of  
CONTINUE not EXIT.  
  
Jim Nasby, adjusted a bit by me  

M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/plpgsql.h
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Clean up roles from roleattributes test

commit   : 072710dff3eef4540f1c64d07890eb128535e212    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 21 Aug 2015 15:51:24 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 21 Aug 2015 15:51:24 -0400    

Click here for diff

Having the roles remain after the test ends up causing repeated 'make  
installcheck' runs to fail and may be risky from a security perspective  
also, so remove them at the end of the test.  

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

Do not allow *timestamp to be passed as NULL

commit   : e68be16b0d0e857bc05949b8ee78c5aaf7d8954a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 21 Aug 2015 14:36:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 21 Aug 2015 14:36:54 -0300    

Click here for diff

The code had bugs that would cause crashes if NULL was passed as that  
argument (originally intended to mean not to bother returning its  
value), and after inspection it turns out that nothing seems interested  
in the case that *ts is NULL anyway.  Therefore, remove the partial  
checks intended to support that case.  
  
Author: Michael Paquier  
though I didn't include a proposed Assert.  
  
Backpatch to 9.5.  

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

Remove ExecGetScanType function

commit   : 8c3d63c521a28c2224aefbdc28ae7e24e81a0156    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 21 Aug 2015 14:11:58 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 21 Aug 2015 14:11:58 -0300    

Click here for diff

This became unused in a191a169d6d0b9558da4519e66510c4540204a51.  

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

Fix plpython crash when returning string representation of a RECORD result.

commit   : f469f634ad7338b7eab046238354f07930fb6bca    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2015 12:21:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2015 12:21:37 -0400    

Click here for diff

PLyString_ToComposite() blithely overwrote proc->result.out.d, even though  
for a composite result type the other union variant proc->result.out.r is  
the one that should be valid.  This could result in a crash if out.r had  
in fact been filled in (proc->result.is_rowtype == 1) and then somebody  
later attempted to use that data; as per bug #13579 from Paweł Michalak.  
  
Just to add insult to injury, it didn't work for RECORD results anyway,  
because record_in() would refuse the case.  
  
Fix by doing the I/O function lookup in a local PLyTypeInfo variable,  
as we were doing already in PLyObject_ToComposite().  This is not a great  
technique because any fn_extra data allocated by the input function will  
be leaked permanently (thanks to using TopMemoryContext as fn_mcxt).  
But that's a pre-existing issue that is much less serious than a crash,  
so leave it to be fixed separately.  
  
This bug would be a potential security issue, except that plpython is  
only available to superusers and the crash requires coding the function  
in a way that didn't work before today's patches.  
  
Add regression test cases covering all the supported methods of converting  
composite results.  
  
Back-patch to 9.1 where the faulty coding was introduced.  

M src/pl/plpython/expected/plpython_composite.out
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/sql/plpython_composite.sql

Allow record_in() and record_recv() to work for transient record types.

commit   : 09b3d27256d26e258c7802cfd8fea06d81b0a62c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2015 11:19:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2015 11:19:33 -0400    

Click here for diff

If we have the typmod that identifies a registered record type, there's no  
reason that record_in() should refuse to perform input conversion for it.  
Now, in direct SQL usage, record_in() will always be passed typmod = -1  
with type OID RECORDOID, because no typmodin exists for type RECORD, so the  
case can't arise.  However, some InputFunctionCall users such as PLs may be  
able to supply the right typmod, so we should allow this to support them.  
  
Note: the previous coding and comment here predate commit 59c016aa9f490b53.  
There has been no case since 8.1 in which the passed type OID wouldn't be  
valid; and if it weren't, this error message wouldn't be apropos anyway.  
Better to let lookup_rowtype_tupdesc complain about it.  
  
Back-patch to 9.1, as this is necessary for my upcoming plpython fix.  
I'm committing it separately just to make it a bit more visible in the  
commit history.  

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

Rename 'cmd' to 'cmd_name' in CreatePolicyStmt

commit   : 3c99788797e8269ac19c7c8e3fb99dd9613646ea    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 21 Aug 2015 08:22:22 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 21 Aug 2015 08:22:22 -0400    

Click here for diff

To avoid confusion, rename CreatePolicyStmt's 'cmd' to 'cmd_name',  
parse_policy_command's 'cmd' to 'polcmd', and AlterPolicy's 'cmd_datum'  
to 'polcmd_datum', per discussion with Noah and as a follow-up to his  
correction of copynodes/equalnodes handling of the CreatePolicyStmt  
'cmd' field.  
  
Back-patch to 9.5 where the CreatePolicyStmt was introduced, as we  
are still only in alpha.  

M src/backend/commands/policy.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h

In AlterRole, make bypassrls an int

commit   : 7ec8296e70f0f03cbdb3e0eb4f05ad5be0f810c8    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 21 Aug 2015 08:22:22 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 21 Aug 2015 08:22:22 -0400    

Click here for diff

When reworking bypassrls in AlterRole to operate the same way the other  
attribute handling is done, I missed that the variable was incorrectly a  
bool rather than an int.  This meant that on platforms with an unsigned  
char, we could end up with incorrect behavior during ALTER ROLE.  
  
Pointed out by Andres thanks to tests he did changing our bool to be the  
one from stdbool.h which showed this and a number of other issues.  
  
Add regression tests to test CREATE/ALTER role for the various role  
attributes.  Arrange to leave roles behind for testing pg_dumpall, but  
none which have the LOGIN attribute.  
  
Back-patch to 9.5 where the AlterRole bug exists.  

M src/backend/commands/user.c
A src/test/regress/expected/roleattributes.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/roleattributes.sql

doc: Whitespace and formatting fixes

commit   : 90a1d0aa76a7a95ff36f72cadd0d7aa0c3cb9b31    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 20 Aug 2015 22:34:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 20 Aug 2015 22:34:35 -0400    

Click here for diff

M doc/src/sgml/brin.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/ref/drop_policy.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/syntax.sgml

Remove xpath namespace-handling change from 9.5 release notes.

commit   : a93545e13f832d457e00420d44ccce1f88f899d4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Aug 2015 12:28:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Aug 2015 12:28:15 -0400    

Click here for diff

Although commit 79af9a1d2 was initially applied to HEAD only, we later  
back-patched the change into all branches (commits 6bbf75192 et al).  
So it's not a new behavior in 9.5 and should not be release-noted here.  

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

Update config.guess and config.sub

commit   : 960ea971e66bcd621ba88841b4cb85c7f0e7c383    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Aug 2015 11:45:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Aug 2015 11:45:52 -0400    

Click here for diff

M config/config.guess
M config/config.sub

Fix bug in calculations of hash join buckets.

commit   : 1cac8c98201cb0ed1a3592cf355a2670d3771689    
  
author   : Kevin Grittner <[email protected]>    
date     : Wed, 19 Aug 2015 08:20:55 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Wed, 19 Aug 2015 08:20:55 -0500    

Click here for diff

Commit 8cce08f168481c5fc5be4e7e29b968e314f1b41e used a left-shift  
on a literal of 1 that could (in large allocations) be shifted by  
31 or more bits.  This was assigned to a local variable that was  
already declared to be a long to protect against overruns of int,  
but the literal in this shift needs to be declared long to allow it  
to work correctly in some compilers.  
  
Backpatch to 9.5, where the bug was introduced.  
  
Report and patch by KaiGai Kohei, slighly modified based on  
discussion.  

M src/backend/executor/nodeHash.c

Fix a few bogus statement type names in plpgsql error messages.

commit   : 2edb9491155ad70e57b5d18f2aa0d8d5a09386cd    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Aug 2015 19:22:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Aug 2015 19:22:37 -0400    

Click here for diff

plpgsql's error location context messages ("PL/pgSQL function fn-name line  
line-no at stmt-type") would misreport a CONTINUE statement as being an  
EXIT, and misreport a MOVE statement as being a FETCH.  These are clear  
bugs that have been there a long time, so back-patch to all supported  
branches.  
  
In addition, in 9.5 and HEAD, change the description of EXECUTE from  
"EXECUTE statement" to just plain EXECUTE; there seems no good reason why  
this statement type should be described differently from others that have  
a well-defined head keyword.  And distinguish GET STACKED DIAGNOSTICS from  
plain GET DIAGNOSTICS.  These are a bit more of a judgment call, and also  
affect existing regression-test outputs, so I did not back-patch into  
stable branches.  
  
Pavel Stehule and Tom Lane  

M src/pl/plpgsql/src/pl_funcs.c
M src/test/regress/expected/event_trigger.out
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/triggers.out

psql: Make EXECUTE PROCEDURE tab completion a bit narrower.

commit   : db5a703bf69d6302d0d515a9068baebffd2d227e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 18 Aug 2015 12:49:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 18 Aug 2015 12:49:04 -0400    

Click here for diff

If the user has typed GRANT EXECUTE, the correct completion is "ON",  
not "PROCEDURE".  
  
Daniel Verite  

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

Fix performance bug from conflict between two previous improvements.

commit   : d3eaab3ef0d552a2f6555b0424a32dc9e77fb17c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Aug 2015 19:39:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Aug 2015 19:39:35 -0400    

Click here for diff

My expanded-objects patch (commit 1dc5ebc9077ab742) included code to make  
plpgsql pass expanded-object variables as R/W pointers to certain functions  
that are trusted for modifying such variables in-place.  However, that  
optimization got broken by commit 6c82d8d1fdb1f126, which arranged to share  
a single ParamListInfo across most expressions evaluated by a plpgsql  
function.  We don't want a R/W pointer to be passed to other functions  
just because we decided one function was safe!  Fortunately, the breakage  
was in the other direction, of never passing a R/W pointer at all, because  
we'd always have pre-initialized the shared array slot with a R/O pointer.  
So it was still functionally correct, but we were back to O(N^2)  
performance for repeated use of "a := a || x".  To fix, force an unshared  
param array to be used when the R/W param optimization is active.  
  
Commit 6c82d8d1fdb1f126 is in HEAD only, so no need for a back-patch.  

M src/pl/plpgsql/src/pl_exec.c

docs: Fix "typo" introduced in 3f811c2d.

commit   : 47ebbdcee7bc4e8dd1b88750ed778c61c4c5ec1b    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 17 Aug 2015 11:51:52 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 17 Aug 2015 11:51:52 +0200    

Click here for diff

Reported-By: Michael Paquier  
Discussion: CAB7nPqSco+RFw9C-VgbCpyurQB3OocS-fuTOa_gFnUy1EE-pyQ@mail.gmail.com  

M doc/src/sgml/catalogs.sgml

Improve configure test for the sse4.2 crc instruction.

commit   : 6cf72879e944f32b5b8232541cccd575de797fa4    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 17 Aug 2015 11:15:46 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 17 Aug 2015 11:15:46 +0200    

Click here for diff

With optimizations enabled at least one compiler, clang 3.7, optimized  
away the crc intrinsics knowing that the result went on unused and has  
no side effects. That can trigger errors in code generation when the  
intrinsic is used, as we chose to use the intrinsics without any  
additional compiler flag. Return the computed value to prevent that.  
  
With some more pedantic warning flags (-Wold-style-definition) the  
configure test failed to recognize the existence of _mm_crc32_u*  
intrinsics due to an independent warning in the test because the test  
turned on -Werror, but that's not actually needed here.  
  
Discussion: [email protected]  
Backpatch: 9.5, where the use of crc intrinsics was integrated.  

M config/c-compiler.m4
M configure

Fix reporting of skipped transactions in pgbench.

commit   : 0e8efed59e7f98f237e90fba20364165f7cc9ba9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 17 Aug 2015 10:11:47 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 17 Aug 2015 10:11:47 +0300    

Click here for diff

Broken by commit 1bc90f7a.  
  
Fabien Coelho.  

M src/bin/pgbench/pgbench.c

Add docs about postgres_fdw's setting of search_path and other GUCs.

commit   : 522400a5198f63823406202e18fdaf3621619d98    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Aug 2015 14:31:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Aug 2015 14:31:04 -0400    

Click here for diff

This behavior wasn't documented, but it should be because it's user-visible  
in triggers and other functions executed on the remote server.  
Per question from Adam Fuchs.  
  
Back-patch to 9.3 where postgres_fdw was added.  

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

Improve documentation about MVCC-unsafe utility commands.

commit   : 5869cbfef48fdfa6b8f108c6c395601e8ad27250    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Aug 2015 13:30:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Aug 2015 13:30:16 -0400    

Click here for diff

The table-rewriting forms of ALTER TABLE are MVCC-unsafe, in much the same  
way as TRUNCATE, because they replace all rows of the table with newly-made  
rows with a new xmin.  (Ideally, concurrent transactions with old snapshots  
would continue to see the old table contents, but the data is not there  
anymore --- and if it were there, it would be inconsistent with the table's  
updated rowtype, so there would be serious implementation problems to fix.)  
This was nowhere documented though, and the problem was only documented for  
TRUNCATE in a note in the TRUNCATE reference page.  Create a new "Caveats"  
section in the MVCC chapter that can be home to this and other limitations  
on serializable consistency.  
  
In passing, fix a mistaken statement that VACUUM and CLUSTER would reclaim  
space occupied by a dropped column.  They don't reconstruct existing tuples  
so they couldn't do that.  
  
Back-patch to all supported branches.  

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

Repair unsafe use of shared typecast-lookup table in plpgsql DO blocks.

commit   : 83604cc42353b6c0de2a3f3ac31f94759a9326ae    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Aug 2015 12:00:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Aug 2015 12:00:36 -0400    

Click here for diff

DO blocks use private simple_eval_estates to avoid intra-transaction memory  
leakage, cf commit c7b849a89.  I had forgotten about that while writing  
commit 0fc94a5ba, but it means that expression execution trees created  
within a DO block disappear immediately on exiting the DO block, and hence  
can't safely be linked into plpgsql's session-wide cast hash table.  
To fix, give a DO block a private cast hash table to go with its private  
simple_eval_estate.  This is less efficient than one could wish, since  
DO blocks can no longer share any cast lookup work with other plpgsql  
execution, but it shouldn't be too bad; in any case it's no worse than  
what happened in DO blocks before commit 0fc94a5ba.  
  
Per bug #13571 from Feike Steenbergen.  Preliminary analysis by  
Oleksandr Shulgin.  

M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Don't use function definitions looking like old-style ones.

commit   : e95126cf048b08d7ff5eb72ec33737e9e27c08f8    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 15 Aug 2015 17:25:00 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 15 Aug 2015 17:25:00 +0200    

Click here for diff

This fixes a bunch of somewhat pedantic warnings with new  
compilers. Since by far the majority of other functions definitions use  
the (void) style it just seems to be consistent to do so as well in the  
remaining few places.  

M contrib/pg_standby/pg_standby.c
M src/backend/access/transam/twophase.c
M src/backend/commands/trigger.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/repl_scanner.l
M src/backend/replication/walsender.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/utils/time/snapmgr.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/pl/plperl/plperl.c

Correct type of waitMode variable in ExecInsertIndexTuples().

commit   : f9dec81a5493bc31fdbbf69b5fafe0d4452a38f1    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 15 Aug 2015 17:02:47 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 15 Aug 2015 17:02:47 +0200    

Click here for diff

It was a bool, even though it should be CEOUC_WAIT_MODE. That's unlikely  
to have a negative effect with the current definition of bool (char),  
but it's definitely wrong.  
  
Discussion: [email protected]  
Backpatch: 9.5, where ON CONFLICT was merged  

M src/backend/executor/execIndexing.c

vacuumdb: Don't assign negative values to a boolean.

commit   : 1d4bd77568493309914217251dce5bd51f4a72b7    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 16:49:36 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 16:49:36 +0200    

Click here for diff

Since a17923204736 (vacuumdb: enable parallel mode) -1 has been assigned  
to a boolean. That can, justifiedly, trigger compiler warnings. There's  
also no need for ternary logic, result was only ever set to 0 or -1. So  
don't.  
  
Discussion: [email protected]  
Backpatch: 9.5  

M src/bin/scripts/vacuumdb.c

Don't use 'bool' as a struct member name in help_config.c.

commit   : 6c772c7453e3e1fa97e3ef0d7e90b22c7f4ea721    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 16:02:20 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 16:02:20 +0200    

Click here for diff

Doing so doesn't work if bool is a macro rather than a typedef.  
  
Although c.h spends some effort to support configurations where bool is  
a preexisting macro, help_config.c has existed this way since  
2003 (b700a6), and there have not been any reports of  
problems. Backpatch anyway since this is as riskless as it gets.  
  
Discussion: [email protected]  
Backpatch: 9.0-master  

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

Use the correct type for TableInfo->relreplident.

commit   : a8015fe7f54c6410866d3751783c48e0dabfacde    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 15:52:10 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 15:52:10 +0200    

Click here for diff

Mistakenly relreplident was stored as a bool. That works today as c.h  
typedefs bool to a char, but isn't very future proof.  
  
Discussion: [email protected]  
Backpatch: 9.4 where replica identity was introduced.  

M src/bin/pg_dump/pg_dump.h

Remove unused expected-output file.

commit   : 8bd42fe5c715c478a4b3ceb77cb28ef9f18b5486    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 14 Aug 2015 23:13:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 14 Aug 2015 23:13:13 -0400    

Click here for diff

D src/test/isolation/expected/fk-delete-insert.out

Remove bogus step from test_decoding isolation tests.

commit   : 5243a35825cf32db5863459be1f3afcc6b6461e0    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 14 Aug 2015 22:39:09 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 14 Aug 2015 22:39:09 -0400    

Click here for diff

Commit 43b4a16817c8b5568cec72f3b0e1c8209f5ac7f7 made the isolation  
tester reject duplicate step names, and it turns out that the  
test_decoding module's concurrent_ddl_dml isolation test has a  
duplicate name.  I think the second definition isn't actually getting  
used, so just remove it.  
  
Per buildfarm.  

M contrib/test_decoding/specs/concurrent_ddl_dml.spec

Reject isolation test specifications with duplicate step names.

commit   : 43b4a16817c8b5568cec72f3b0e1c8209f5ac7f7    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 14 Aug 2015 22:09:27 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 14 Aug 2015 22:09:27 -0400    

Click here for diff

alter-table-1.spec has such a case, so change one instance of step  
rx1 to rx3 instead.  

M src/test/isolation/expected/alter-table-1.out
M src/test/isolation/isolationtester.c
M src/test/isolation/isolationtester.h
M src/test/isolation/specs/alter-table-1.spec

Encoding PG_UHC is code page 949.

commit   : ec79978dd059d51c8c28efae949d115987588011    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 14 Aug 2015 20:23:13 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 14 Aug 2015 20:23:13 -0400    

Click here for diff

This fixes presentation of non-ASCII messages to the Windows event log  
and console in rare cases involving Korean locale.  Processes like the  
postmaster and checkpointer, but not processes attached to databases,  
were affected.  Back-patch to 9.4, where MessageEncoding was introduced.  
The problem exists in all supported versions, but this change has no  
effect in the absence of the code recognizing PG_UHC MessageEncoding.  
  
Noticed while investigating bug #13427 from Dmitri Bourlatchkov.  

M src/backend/utils/mb/encnames.c

Restore old pgwin32_message_to_UTF16() behavior outside transactions.

commit   : 43adc7a7147da2404bd4df0d8a93ca3bd3a8adc6    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 14 Aug 2015 20:23:09 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 14 Aug 2015 20:23:09 -0400    

Click here for diff

Commit 49c817eab78c6f0ce8c3bf46766b73d6cf3190b7 replaced with a hard  
error the dubious pg_do_encoding_conversion() behavior when outside a  
transaction.  Reintroduce the historic soft failure locally within  
pgwin32_message_to_UTF16().  This fixes errors when writing messages in  
less-common encodings to the Windows event log or console.  Back-patch  
to 9.4, where the aforementioned commit first appeared.  
  
Per bug #13427 from Dmitri Bourlatchkov.  

M src/backend/utils/mb/mbutils.c

Update key words table for 9.5

commit   : 845405a7d8dc79f498fe77e3aeeb02ef841b0196    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Aug 2015 12:10:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Aug 2015 12:10:35 -0400    

Click here for diff

M doc/src/sgml/keywords.sgml

Reduce lock levels for ALTER TABLE SET autovacuum storage options

commit   : 47167b7907a802ed39b179c8780b76359468f076    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 14 Aug 2015 14:19:28 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 14 Aug 2015 14:19:28 +0100    

Click here for diff

Reduce lock levels down to ShareUpdateExclusiveLock for all autovacuum-related  
relation options when setting them using ALTER TABLE.  
  
Add infrastructure to allow varying lock levels for relation options in later  
patches. Setting multiple options together uses the highest lock level required  
for any option. Works for both main and toast tables.  
  
Fabrízio Mello, reviewed by Michael Paquier, mild edit and additional regression  
tests from myself  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/access/common/reloptions.c
M src/backend/commands/tablecmds.c
M src/include/access/reloptions.h
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

PL/Python: Make tests pass with Python 3.5

commit   : f16d52269a196f7f303abe3b978d95ade265f05f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jun 2015 19:52:08 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jun 2015 19:52:08 -0400    

Click here for diff

The error message wording for AttributeError has changed in Python 3.5.  
For the plpython_error test, add a new expected file.  In the  
plpython_subtransaction test, we didn't really care what the exception  
is, only that it is something coming from Python.  So use a generic  
exception instead, which has a message that doesn't vary across  
versions.  

M src/pl/plpython/expected/README
A src/pl/plpython/expected/plpython_error_5.out
M src/pl/plpython/expected/plpython_subtransaction.out
M src/pl/plpython/expected/plpython_subtransaction_0.out
M src/pl/plpython/expected/plpython_subtransaction_5.out
M src/pl/plpython/sql/plpython_subtransaction.sql

MSVC: Exclude 'brin' contrib module

commit   : d67616c74395aede8795e785d565b96b735f3f6e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 19:28:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 19:28:54 -0300    

Click here for diff

The build script is not able to parse the Makefile, so remove it.  

M src/tools/msvc/Mkvcbuild.pm

Re-add BRIN isolation test

commit   : 672e3ec0e93e3d2d5549b95f73b2a3ab58714146    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 14:41:52 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 14:41:52 -0300    

Click here for diff

This time, instead of using a core isolation test, put it on its own  
test module; this way it can require the pageinspect module to be  
present before running.  
  
The module's Makefile is loosely modeled after test_decoding's, so that  
it's easy to add further tests for either pg_regress or isolationtester  
later.  
  
Backpatch to 9.5.  

M src/test/modules/Makefile
A src/test/modules/brin/.gitignore
A src/test/modules/brin/Makefile
A src/test/modules/brin/expected/summarization-and-inprogress-insertion.out
A src/test/modules/brin/specs/summarization-and-inprogress-insertion.spec

Improve regression test case to avoid depending on system catalog stats.

commit   : 6a0779a397a5ec44a37d3f7d1b2e4c4359e06c2f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Aug 2015 13:25:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Aug 2015 13:25:01 -0400    

Click here for diff

In commit 95f4e59c32866716 I added a regression test case that examined  
the plan of a query on system catalogs.  That isn't a terribly great idea  
because the catalogs tend to change from version to version, or even  
within a version if someone makes an unrelated regression-test change that  
populates the catalogs a bit differently.  Usually I try to make planner  
test cases rely on test tables that have not changed since Berkeley days,  
but I got sloppy in this case because the submitted crasher example queried  
the catalogs and I didn't spend enough time on rewriting it.  But it was a  
problem waiting to happen, as I was rudely reminded when I tried to port  
that patch into Salesforce's Postgres variant :-(.  So spend a little more  
effort and rewrite the query to not use any system catalogs.  I verified  
that this version still provokes the Assert if 95f4e59c32866716's code fix  
is reverted.  
  
I also removed the EXPLAIN output from the test, as it turns out that the  
assertion occurs while considering a plan that isn't the one ultimately  
selected anyway; so there's no value in risking any cross-platform  
variation in that printout.  
  
Back-patch to 9.2, like the previous patch.  

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

Use materialize SRF mode in brin_page_items

commit   : 94d626ff5a82422825976c096e250b07657cd6f7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 13:02:10 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 13:02:10 -0300    

Click here for diff

This function was using the single-value-per-call mechanism, but the  
code relied on a relcache entry that wasn't kept open across calls.  
This manifested as weird errors in buildfarm during the short time that  
the "brin-1" isolation test lived.  
  
Backpatch to 9.5, where it was introduced.  

M contrib/pageinspect/brinfuncs.c

Run autoheader to add a few missing #defines to pg_config.h.in.

commit   : 36e863bbd42f5815cecbda2397950ea1ca36a81a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Aug 2015 14:35:02 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Aug 2015 14:35:02 +0300    

Click here for diff

These are emitted by the new ax_pthread.m4 script version. They are not  
used for anything in PostgreSQL, but let's keep the generated header file  
up-to-date.  
  
Andres Freund  

M src/include/pg_config.h.in

Fix declaration of isarray variable.

commit   : c396f2b83dbf2af9a6b3fa137f73017f5dcf7266    
  
author   : Michael Meskes <[email protected]>    
date     : Thu, 13 Aug 2015 13:22:29 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Thu, 13 Aug 2015 13:22:29 +0200    

Click here for diff

Found and fixed by Andres Freund.  

M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/extern.h

Fix unitialized variables

commit   : fcbf455842eac10c331a866f559bb3875bcb8c37    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 00:12:07 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 00:12:07 -0300    

Click here for diff

As complained by clang, reported by Andres Freund.  Brown paper bag bug  
in ccc4c074994d.  
  
Add some comments, too.  
  
Backpatch to 9.5, like that one.  

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

Undo mistaken tightening in join_is_legal().

commit   : cfe30a72fa80528997357cb0780412736767e8c4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Aug 2015 21:18:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Aug 2015 21:18:45 -0400    

Click here for diff

One of the changes I made in commit 8703059c6b55c427 turns out not to have  
been such a good idea: we still need the exception in join_is_legal() that  
allows a join if both inputs already overlap the RHS of the special join  
we're checking.  Otherwise we can miss valid plans, and might indeed fail  
to find a plan at all, as in recent report from Andreas Seltenreich.  
  
That code was added way back in commit c17117649b9ae23d, but I failed to  
include a regression test case then; my bad.  Put it back with a better  
explanation, and a test this time.  The logic does end up a bit different  
than before though: I now believe it's appropriate to make this check  
first, thereby allowing such a case whether or not we'd consider the  
previous SJ(s) to commute with this one.  (Presumably, we already decided  
they did; but it was confusing to have this consideration in the middle  
of the code that was handling the other case.)  
  
Back-patch to all active branches, like the previous patch.  

M src/backend/optimizer/path/joinrels.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Close some holes in BRIN page assignment

commit   : ccc4c074994d734aefb9810af79a762df3c0e974    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 12 Aug 2015 14:20:38 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 12 Aug 2015 14:20:38 -0300    

Click here for diff

In some corner cases, it is possible for the BRIN index relation to be  
extended by brin_getinsertbuffer but the new page not be used  
immediately for anything by its callers; when this happens, the page is  
initialized and the FSM is updated (by brin_getinsertbuffer) with the  
info about that page, but these actions are not WAL-logged.  A later  
index insert/update can use the page, but since the page is already  
initialized, the initialization itself is not WAL-logged then either.  
Replay of this sequence of events causes recovery to fail altogether.  
  
There is a related corner case within brin_getinsertbuffer itself, in  
which we extend the relation to put a new index tuple there, but later  
find out that we cannot do so, and do not return the buffer; the page  
obtained from extension is not even initialized.  The resulting page is  
lost forever.  
  
To fix, shuffle the code so that initialization is not the  
responsibility of brin_getinsertbuffer anymore, in normal cases;  
instead, the initialization is done by its callers (brin_doinsert and  
brin_doupdate) once they're certain that the page is going to be used.  
When either those functions determine that the new page cannot be used,  
before bailing out they initialize the page as an empty regular page,  
enter it in FSM and WAL-log all this.  This way, the page is usable for  
future index insertions, and WAL replay doesn't find trying to insert  
tuples in pages whose initialization didn't make it to the WAL.  The  
same strategy is used in brin_getinsertbuffer when it cannot return the  
new page.  
  
Additionally, add a new step to vacuuming so that all pages of the index  
are scanned; whenever an uninitialized page is found, it is initialized  
as empty and WAL-logged.  This closes the hole that the relation is  
extended but the system crashes before anything is WAL-logged about it.  
We also take this opportunity to update the FSM, in case it has gotten  
out of date.  
  
Thanks to Heikki Linnakangas for finding the problem that kicked some  
additional analysis of BRIN page assignment code.  
  
Backpatch to 9.5, where BRIN was introduced.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.c
M src/include/access/brin_page.h
M src/include/access/brin_pageops.h

Remove duplicated assignment in pg_create_physical_replication_slot.

commit   : a4b059fddecefd5f473e539b28277874ab83f32f    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 17:35:50 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 17:35:50 +0200    

Click here for diff

Reported-By: Gurjeet Singh  

M src/backend/replication/slotfuncs.c

Handle PQresultErrorField(PG_DIAG_SQLSTATE) returning NULL in streamutil.c.

commit   : 7685963eeb16c377c2e0ff7b1852b7a8bc527270    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 17:35:50 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 17:35:50 +0200    

Click here for diff

In ff27db5d I missed that PQresultErrorField() may return NULL if  
there's no sqlstate associated with an error.  
  
Spotted-By: Coverity  
Reported-By: Michael Paquier  
Discussion: CAB7nPqQ3o10SY6NVdU4pjq85GQTN5tbbkq2gnNUh2fBNU3rKyQ@mail.gmail.com  
Backpatch: 9.5, like ff27db5d  

M src/bin/pg_basebackup/streamutil.c

Fix two off-by-one errors in bufmgr.c.

commit   : d25fbf9f3ecffb5c80a9201a6310e74da24556a4    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 17:35:50 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 17:35:50 +0200    

Click here for diff

In 4b4b680c I passed a buffer index number (starting from 0) instead of  
a proper Buffer id (which start from 1 for shared buffers) in two  
places.  
  
This wasn't noticed so far as one of those locations isn't compiled at  
all (PrintPinnedBufs) and the other one (InvalidBuffer) requires a  
unlikely, but possible, set of circumstances to trigger a symptom.  
  
To reduce the likelihood of such incidents a bit also convert existing  
open coded mappings from buffer descriptors to buffer ids with  
BufferDescriptorGetBuffer().  
  
Author: Qingqing Zhou  
Reported-By: Qingqing Zhou  
Discussion: CAJjS0u2ai9ooUisKtkV8cuVUtEkMTsbK8c7juNAjv8K11zeCQg@mail.gmail.com  
Backpatch: 9.5 where the private ref count infrastructure was introduced  

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

Fix some possible low-memory failures in regexp compilation.

commit   : 8a0258c31808c514755e3bba03cb052084c4887c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Aug 2015 00:48:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Aug 2015 00:48:11 -0400    

Click here for diff

newnfa() failed to set the regex error state when malloc() fails.  
Several places in regcomp.c failed to check for an error after calling  
subre().  Each of these mistakes could lead to null-pointer-dereference  
crashes in memory-starved backends.  
  
Report and patch by Andreas Seltenreich.  Back-patch to all branches.  

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

Postpone extParam/allParam calculations until the very end of planning.

commit   : 68fa28f77146653f1fcaa530d2f2f161bf5de479    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Aug 2015 23:48:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Aug 2015 23:48:37 -0400    

Click here for diff

Until now we computed these Param ID sets at the end of subquery_planner,  
but that approach depends on subquery_planner returning a concrete Plan  
tree.  We would like to switch over to returning one or more Paths for a  
subquery, and in that representation the necessary details aren't fully  
fleshed out (not to mention that we don't really want to do this work for  
Paths that end up getting discarded).  Hence, refactor so that we can  
compute the param ID sets at the end of planning, just before  
set_plan_references is run.  
  
The main change necessary to make this work is that we need to capture  
the set of outer-level Param IDs available to the current query level  
before exiting subquery_planner, since the outer levels' plan_params lists  
are transient.  (That's not going to pose a problem for returning Paths,  
since all the work involved in producing that data is part of expression  
preprocessing, which will continue to happen before Paths are produced.)  
On the plus side, this change gets rid of several existing kluges.  
  
Eventually I'd like to get rid of SS_finalize_plan altogether in favor of  
doing this work during set_plan_references, but that will require some  
complex rejiggering because SS_finalize_plan needs to visit subplans and  
initplans before the main plan.  So leave that idea for another day.  

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/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/include/nodes/relation.h
M src/include/optimizer/subselect.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Don't include rel.h when relcache.h is sufficient

commit   : 4901b2f49536f439f79d067a9b30a7a837d6c72b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 11 Aug 2015 13:03:14 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 11 Aug 2015 13:03:14 -0300    

Click here for diff

Trivial change to reduce exposure of rel.h.  

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

Fix broken markup, and copy-edit a bit.

commit   : 750fc78bca7c5cff7459d02315cf7fed4f4ce3a9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Aug 2015 10:46:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Aug 2015 10:46:51 -0400    

Click here for diff

Fix docs build failure introduced by commit 6fcd88511f8e69e3.  
I failed to resist the temptation to rearrange the description of  
pg_create_physical_replication_slot(), too.  

M doc/src/sgml/func.sgml

More fixes to allow pg_rewind tests to run on Msys.

commit   : 15c3a1b45b480f6478555e9ddbc6093bd031d12c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 11 Aug 2015 08:58:58 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 11 Aug 2015 08:58:58 -0400    

Click here for diff

M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl

Allow pg_create_physical_replication_slot() to reserve WAL.

commit   : 6fcd88511f8e69e38defb1272e0042ef4bab2feb    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 11 Aug 2015 12:34:31 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 11 Aug 2015 12:34:31 +0200    

Click here for diff

When creating a physical slot it's often useful to immediately reserve  
the current WAL position instead of only doing after the first feedback  
message arrives. That e.g. allows slots to guarantee that all the WAL  
for a base backup will be available afterwards.  
  
Logical slots already have to reserve WAL during creation, so generalize  
that logic into being usable for both physical and logical slots.  
  
Catversion bump because of the new parameter.  
  
Author: Gurjeet Singh  
Reviewed-By: Andres Freund  
Discussion: CABwTF4Wh_dBCzTU=49pFXR6coR4NW1ynb+vBqT+Po=7fuq5iCw@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/replication/slot.h

Introduce macros determining if a replication slot is physical or logical.

commit   : 093d0c83c1d210167d122da92459a0677e04ffc9    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 11 Aug 2015 12:32:48 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 11 Aug 2015 12:32:48 +0200    

Click here for diff

These make the code a bit easier to read, and make it easier to add a  
more explicit notion of a slot's type at some point in the future.  
  
Author: Gurjeet Singh  
Discussion: CABwTF4Wh_dBCzTU=49pFXR6coR4NW1ynb+vBqT+Po=7fuq5iCw@mail.gmail.com  

M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/backend/replication/walsender.c
M src/include/replication/slot.h

commit   : 3b425b7c02ccdabe3fb3a538d9174273a15f1e2e    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 11 Aug 2015 12:32:48 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 11 Aug 2015 12:32:48 +0200    

Click here for diff

Fix a bunch of typos, and remove two superflous includes.  
  
Author: Gurjeet Singh  
Discussion: CABwTF4Wh_dBCzTU=49pFXR6coR4NW1ynb+vBqT+Po=7fuq5iCw@mail.gmail.com  
Backpatch: 9.4  

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

Fix privilege dumping from servers too old to have that type of privilege.

commit   : b861678f50747727c00ffa671e7c2f2f5d25300d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 20:10:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 20:10:15 -0400    

Click here for diff

pg_dump produced fairly silly GRANT/REVOKE commands when dumping types from  
pre-9.2 servers, and when dumping functions or procedural languages from  
pre-7.3 servers.  Those server versions lack the typacl, proacl, and/or  
lanacl columns respectively, and pg_dump substituted default values that  
were in fact incorrect.  We ended up revoking all the owner's own  
privileges for the object while granting all privileges to PUBLIC.  
Of course the owner would then have those privileges again via PUBLIC, so  
long as she did not try to revoke PUBLIC's privileges; which may explain  
the lack of field reports.  Nonetheless this is pretty silly behavior.  
  
The stakes were raised by my recent patch to make pg_dump dump shell types,  
because 9.2 and up pg_dump would proceed to emit bogus GRANT/REVOKE  
commands for a shell type if dumping from a pre-9.2 server; and the server  
will not accept GRANT/REVOKE commands for a shell type.  (Perhaps it  
should, but that's a topic for another day.)  So the resulting dump script  
wouldn't load without errors.  
  
The right thing to do is to act as though these objects have default  
privileges (null ACL entries), which causes pg_dump to print no  
GRANT/REVOKE commands at all for them.  That fixes the silly results  
and also dodges the problem with shell types.  
  
In passing, modify getProcLangs() to be less creatively different about  
how to handle missing columns when dumping from older server versions.  
Every other data-acquisition function in pg_dump does that by substituting  
appropriate default values in the version-specific SQL commands, and I see  
no reason why this one should march to its own drummer.  Its use of  
"SELECT *" was likewise not conformant with anyplace else, not to mention  
it's not considered good SQL style for production queries.  
  
Back-patch to all supported versions.  Although 9.0 and 9.1 pg_dump don't  
have the issue with typacl, they are more likely than newer versions to be  
used to dump from ancient servers, so we ought to fix the proacl/lanacl  
issues all the way back.  

M src/bin/pg_dump/pg_dump.c

Accept alternate spellings of __sparcv7 and __sparcv8.

commit   : 1f64ec6fd28bcd2be9b6b0ad3a5a630e117db601    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 17:34:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 17:34:51 -0400    

Click here for diff

Apparently some versions of gcc prefer __sparc_v7__ and __sparc_v8__.  
Per report from Waldemar Brodkorb.  

M src/include/storage/s_lock.h

commit   : 4200a92862604d6fcb726fbe7a3e2b38c1dc6837    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 17:18:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 17:18:17 -0400    

Click here for diff

Commit 85e5e222b1dd02f135a8c3bf387d0d6d88e669bd turns out not to have taken  
care of all cases of the partially-evaluatable-PlaceHolderVar problem found  
by Andreas Seltenreich's fuzz testing.  I had set it up to check for risky  
PHVs only in the event that we were making a star-schema-based exception to  
the param_source_rels join ordering heuristic.  However, it turns out that  
the problem can occur even in joins that satisfy the param_source_rels  
heuristic, in which case allow_star_schema_join() isn't consulted.  
Refactor so that we check for risky PHVs whenever the proposed join has  
any remaining parameterization.  
  
Back-patch to 9.2, like the previous patch (except for the regression test  
case, which only works back to 9.3 because it uses LATERAL).  
  
Note that this discovery implies that problems of this sort could've  
occurred in 9.2 and up even before the star-schema patch; though I've not  
tried to prove that experimentally.  

M src/backend/optimizer/path/joinpath.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Work around an apparent bug in the Msys DTK perl's regex engine.

commit   : e7293e3271bf618eeb2d4779a15fc516a69fe463    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 10 Aug 2015 10:42:05 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 10 Aug 2015 10:42:05 -0400    

Click here for diff

Several versions of the perl that comes with the Msys DTK have been  
found to have a bug that fails to recognize a ' before a multiline $ in  
some circumstances. To work around the problem, use a character class  
for the '. Another solution would have been to use \n instead of $, but  
that would have changed the test semantics very slightly.  

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

Temporarily(?) remove BRIN isolation test.

commit   : 6a1e14c62b739a754335c088474e12f42a6763bd    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 10:22:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 10:22:37 -0400    

Click here for diff

Commit 2834855cb added a not-very-carefully-thought-out isolation test  
to check a BRIN index bug fix.  The test depended on the availability  
of the pageinspect contrib module, which meant it did not work in  
several common testing scenarios such as "make check-world".  It's not  
clear whether we want a core test depending on a contrib module like  
that, but in any case, failing to deal with the possibility that the  
module isn't present in the installation-under-test is not acceptable.  
  
Remove that test pending some better solution.  

D src/test/isolation/expected/brin-1.out
M src/test/isolation/isolation_schedule
D src/test/isolation/specs/brin-1.spec

Add confirmed_flush column to pg_replication_slots.

commit   : 3f811c2d6f51b13b71adff99e82894dd48cee055    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 10 Aug 2015 13:28:18 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 10 Aug 2015 13:28:18 +0200    

Click here for diff

There's no reason not to expose both restart_lsn and confirmed_flush  
since they have rather distinct meanings. The former is the oldest WAL  
still required and valid for both physical and logical slots, whereas  
the latter is the location up to which a logical slot's consumer has  
confirmed receiving data. Most of the time a slot will require older  
WAL (i.e. restart_lsn) than the confirmed  
position (i.e. confirmed_flush_lsn).  
  
Author: Marko Tiikkaja, editorialized by me  
Discussion: [email protected]  

M contrib/test_decoding/expected/ddl.out
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/logicaldecoding.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/slotfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/rules.out

Fix copy & paste mistake in pg_get_replication_slots().

commit   : 5c4b25accebb5d35358bb0c19b841d8d9b064e46    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 10 Aug 2015 13:28:18 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 10 Aug 2015 13:28:18 +0200    

Click here for diff

XLogRecPtr was compared with InvalidTransactionId instead of  
InvalidXLogRecPtr. As both are defined to the same value this doesn't  
cause any actual problems, but it's still wrong.  
  
Backpatch: 9.4-master, bug was introduced in 9.4  

M src/backend/replication/slotfuncs.c

Don't start to stream after pg_receivexlog --create-slot.

commit   : 70fd0e14e806a4d0ed31b19d92e1f9f140ef686d    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 10 Aug 2015 13:28:18 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 10 Aug 2015 13:28:18 +0200    

Click here for diff

Immediately starting to stream after --create-slot is inconvenient in a  
number of situations (e.g. when configuring a slot for use in  
recovery.conf) and it's easy to just call pg_receivexlog twice in the  
rest of the cases.  
  
Author: Michael Paquier  
Discussion: CAB7nPqQ9qEtuDiKY3OpNzHcz5iUA+DUX9FcN9K8GUkCZvG7+Ew@mail.gmail.com  
Backpatch: 9.5, where the option was introduced  

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

Remove gram.y's precedence declaration for OVERLAPS.

commit   : 1e3e1ae266502eb6a15a788f74d48b7c94196f56    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Aug 2015 19:01:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Aug 2015 19:01:04 -0400    

Click here for diff

The allowed syntax for OVERLAPS, viz "row OVERLAPS row", is sufficiently  
constrained that we don't actually need a precedence declaration for  
OVERLAPS; indeed removing this declaration does not change the generated  
gram.c file at all.  Let's remove it to avoid confusion about whether  
OVERLAPS has precedence or not.  If we ever generalize what we allow for  
OVERLAPS, we might need to put back a precedence declaration for it,  
but we might want some other level than what it has today --- and leaving  
the declaration there would just risk confusion about whether that would  
be an incompatible change.  
  
Likewise, remove OVERLAPS from the documentation's precedence table.  
  
Per discussion with Noah Misch.  Back-patch to 9.5 where we hacked up some  
nearby precedence decisions.  

M doc/src/sgml/syntax.sgml
M src/backend/parser/gram.y

Fix typo in LDAP example

commit   : 2a330d551ca9414a3ccd80420bb8b7071bdf8b00    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 9 Aug 2015 14:49:47 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 9 Aug 2015 14:49:47 +0200    

Click here for diff

Reported by William Meitzen  

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

docs: update major release notes item checklist

commit   : d4aeb3dea217d1e6c004ea3112ad8845db2a5cda    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 8 Aug 2015 22:36:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 8 Aug 2015 22:36:06 -0400    

Click here for diff

M src/tools/RELEASE_CHANGES

Fix broken multibyte regression tests.

commit   : efc1610b64b04e7cf08cc1d6c608ede8b7d5ff07    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Sun, 9 Aug 2015 10:55:41 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Sun, 9 Aug 2015 10:55:41 +0900    

Click here for diff

commit 9043Fe390f4f0b4586cfe59cbd22314b9c3e2957 broke multibyte  
regression tests because the commit removes the warning message when  
temporary hash indexes is created, which has been added by commit  
07af523870bcfe930134054febd3a6a114942e5b.  
  
Back patched to 9.5 stable tree.  

M src/test/mb/expected/big5.out
M src/test/mb/expected/euc_jp.out
M src/test/mb/expected/euc_kr.out
M src/test/mb/expected/euc_tw.out
M src/test/mb/expected/gb18030.out
M src/test/mb/expected/mule_internal.out
M src/test/mb/expected/sjis.out
M src/test/mb/expected/utf8.out

docs: fix typo in rules.sgml

commit   : 08c6178aa42063f4db771c3581a86049dc1c3da2    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 8 Aug 2015 20:40:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 8 Aug 2015 20:40:53 -0400    

Click here for diff

Report by Dean Rasheed  
  
Patch by Dean Rasheed  
  
Backpatch through 9.5  

M doc/src/sgml/rules.sgml

Document items that should appear in the major release notes

commit   : 88a30e8cc00d873627d8e3d58d2130879acf720f    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 8 Aug 2015 17:33:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 8 Aug 2015 17:33:55 -0400    

Click here for diff

M src/tools/RELEASE_CHANGES

9.5 release notes: add increase buffer mapping partitions item

commit   : 03249fe2c1b936af53c4dd78c29f4429fd63cdb1    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 8 Aug 2015 13:38:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 8 Aug 2015 13:38:31 -0400    

Click here for diff

Report by Robert Haas, Andres Freund  
  
Backpatch through 9.5  

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

Attempt to work around a 32bit xlc compiler bug from a different place.

commit   : 5a33650f24f9ad67a22c0f8a98c132c75034cfbf    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 8 Aug 2015 01:19:02 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 8 Aug 2015 01:19:02 +0200    

Click here for diff

In de6fd1c8 I moved the the work around from 53f73879 into the aix  
template. The previous location was removed in the former commit, and I  
thought that it would be nice to emit a warning when running configure.  
  
That didn't turn out to work because at the point the template is  
included we don't know whether we're compiling a 32/64 bit binary and  
it's possible to install compilers for both on a 64 bit kernel/OS.  
  
So go back to a less ambitious approach and define  
PG_FORCE_DISABLE_INLINE in port/aix.h, without emitting a warning. We  
could try a more fancy approach, but it doesn't seem worth it.  
  
This requires moving the check for PG_FORCE_DISABLE_INLINE in c.h to  
after including the system headers included from therein which isn't  
perfect, as it seems slightly more robust to include all system headers  
in a similar environment. Oh well.  
  
Discussion: [email protected]  

M src/include/c.h
M src/include/port/aix.h
M src/template/aix

Fix bug slowing down pgbench when -P is used.

commit   : c2509944b1a090d64a4a18dcd524ff63ee0f0212    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 8 Aug 2015 01:19:02 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 8 Aug 2015 01:19:02 +0200    

Click here for diff

A removed check in ba3deeefb made all threads but the main one busy-loop  
when -P was used. All threads computed the time to the next time the  
progress report should be printed, but only the main thread did so and  
re-scheduled it only for the future.  
  
Reported-By: Jesper Pedersen  
Discussion: [email protected]  

M src/bin/pgbench/pgbench.c

Further adjustments to PlaceHolderVar removal.

commit   : 89db83922a7f8ba223e233e262004b1745ece75d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Aug 2015 14:13:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Aug 2015 14:13:38 -0400    

Click here for diff

A new test case from Andreas Seltenreich showed that we were still a bit  
confused about removing PlaceHolderVars during join removal.  Specifically,  
remove_rel_from_query would remove a PHV that was used only underneath  
the removable join, even if the place where it's used was the join partner  
relation and not the join clause being deleted.  This would lead to a  
"too late to create a new PlaceHolderInfo" error later on.  We can defend  
against that by checking ph_eval_at to see if the PHV could possibly be  
getting used at some partner rel.  
  
Also improve some nearby LATERAL-related logic.  I decided that the check  
on ph_lateral needed to take precedence over the check on ph_needed, in  
case there's a lateral reference underneath the join being considered.  
(That may be impossible, but I'm not convinced of it, and it's easy enough  
to defend against the case.)  Also, I realized that remove_rel_from_query's  
logic for updating LateralJoinInfos is dead code, because we don't build  
those at all until after join removal.  
  
Back-patch to 9.3.  Previous versions didn't have the LATERAL issues, of  
course, and they also didn't attempt to remove PlaceHolderInfos during join  
removal.  (I'm starting to wonder if changing that was really such a great  
idea.)  

M src/backend/optimizer/plan/analyzejoins.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

commit   : 846f8c9483a8f31e45bf949db1721706a2765771    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 7 Aug 2015 09:04:07 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 7 Aug 2015 09:04:07 -0500    

Click here for diff

Spotted by Antonin Houska.  

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

Don't include low level locking code from frontend code.

commit   : 4eda0a64705763854225a29703b606692af50e77    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Aug 2015 15:10:56 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Aug 2015 15:10:56 +0200    

Click here for diff

Some frontend code like e.g. pg_xlogdump or pg_resetxlog, has to use  
backend headers. Unfortunately until now that code includes most of the  
locking code. It's generally not nice to expose such low level details,  
but de6fd1c898 made that a hard problem. We fall back to defining  
'inline' away if the compiler doesn't support it - that can cause linker  
errors like on buildfarm animal pademelon if a inline function  
references backend only code.  
  
To fix that problem separate definitions from lock.h that are required  
from frontend code into lockdefs.h and use it in the relevant  
places. I've only removed the minimal amount of necessary definitions  
for now - it might turn out that we want more for other reasons.  
  
To avoid such details being exposed again put some checks against being  
included from frontend code into atomics.h, lock.h, lwlock.h and  
s_lock.h. It's otherwise fairly easy to indirectly include these  
headers.  
  
Discussion: [email protected]  

M src/backend/utils/hash/hashfn.c
M src/include/access/genam.h
M src/include/access/hash.h
M src/include/access/tuptoaster.h
M src/include/catalog/objectaddress.h
M src/include/port/atomics.h
M src/include/storage/lock.h
A src/include/storage/lockdefs.h
M src/include/storage/lwlock.h
M src/include/storage/procarray.h
M src/include/storage/s_lock.h
M src/include/storage/standby.h

Address points made in post-commit review of replication origins.

commit   : 18e8613564bf0a675d453eec1fceded7bce09988    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Aug 2015 15:08:51 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Aug 2015 15:08:51 +0200    

Click here for diff

Amit reviewed the replication origins patch and made some good  
points. Address them. This fixes typos in error messages, docs and  
comments and adds a missing error check (although in a  
should-never-happen scenario).  
  
Discussion: CAA4eK1JqUBVeWWKwUmBPryFaje4190ug0y-OAUHWQ6tD83V4xg@mail.gmail.com  
Backpatch: 9.5, where replication origins were introduced.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/replication-origins.sgml
M src/backend/access/transam/xloginsert.c
M src/backend/replication/logical/origin.c

9.5 release notes: updates from Andres Freund and Jeff Janes

commit   : d6a8c943ab62317a5fca3b62224582d0d639df6b    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 22:33:15 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 22:33:15 -0400    

Click here for diff

Report by Andres Freund and Jeff Janes  
  
Backpatch through 9.5  

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

Fix old oversight in join removal logic.

commit   : bab163e1218c0c36ccb0c0ef1b8f2d6feb2fc122    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Aug 2015 22:14:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Aug 2015 22:14:07 -0400    

Click here for diff

Commit 9e7e29c75ad441450f9b8287bd51c13521641e3b introduced an Assert that  
join removal didn't reduce the eval_at set of any PlaceHolderVar to empty.  
At first glance it looks like join_is_removable ensures that's true --- but  
actually, the loop in join_is_removable skips PlaceHolderVars that are not  
referenced above the join due to be removed.  So, if we don't want any  
empty eval_at sets, the right thing to do is to delete any now-unreferenced  
PlaceHolderVars from the data structure entirely.  
  
Per fuzz testing by Andreas Seltenreich.  Back-patch to 9.3 where the  
aforesaid Assert was added.  

M src/backend/optimizer/plan/analyzejoins.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

9.5 release notes: mention ON CONFLICT DO NOTHING for FDWs

commit   : 58e09b902418d07545caec675d67265f1d510f4b    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 21:08:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 21:08:08 -0400    

Click here for diff

Report by Peter Geoghegan  
  
Backpatch through 9.5  

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

Fix eclass_useful_for_merging to give valid results for appendrel children.

commit   : cde35cf4ae968d3366ea5358d2a754641e4c06c8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Aug 2015 20:14:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Aug 2015 20:14:37 -0400    

Click here for diff

Formerly, this function would always return "true" for an appendrel child  
relation, because it would think that the appendrel parent was a potential  
join target for the child.  In principle that should only lead to some  
inefficiency in planning, but fuzz testing by Andreas Seltenreich disclosed  
that it could lead to "could not find pathkey item to sort" planner errors  
in odd corner cases.  Specifically, we would think that all columns of a  
child table's multicolumn index were interesting pathkeys, causing us to  
generate a MergeAppend path that sorts by all the columns.  However, if any  
of those columns weren't actually used above the level of the appendrel,  
they would not get added to that rel's targetlist, which would result in  
being unable to resolve the MergeAppend's sort keys against its targetlist  
during createplan.c.  
  
Backpatch to 9.3.  In older versions, columns of an appendrel get added  
to its targetlist even if they're not mentioned above the scan level,  
so that the failure doesn't occur.  It might be worth back-patching this  
fix to older versions anyway, but I'll refrain for the moment.  

M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/pathkeys.c
M src/include/optimizer/paths.h
M src/test/regress/expected/inherit.out
M src/test/regress/sql/inherit.sql

9.5 release notes: mention change to CRC-32C

commit   : c9351f03f380c505cc6d5f2daa3e2d007d9022c1    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 18:03:39 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 18:03:39 -0400    

Click here for diff

Report by Andres Freund  
  
Backpatch through 9.5  

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

9.5 release notes: adjustments suggested by Andres Freund

commit   : c4318c4065731c39eb7f9d14d245d46384880a9b    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 17:34:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 17:34:38 -0400    

Click here for diff

Report by Andres Freund  
  
Backpatch through 9.5  

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

9.5 release notes: add non-LEAKPROOF view pushdown mention

commit   : 68b5163b45e3de569184a5f6d0956f7eccea76ad    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 16:07:27 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 16:07:27 -0400    

Click here for diff

Report by Dean Rasheed  
  
Backpatch through 9.5  

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

Further fixes for degenerate outer join clauses.

commit   : 8703059c6b55c427100e00a09f66534b6ccbfaa1    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Aug 2015 15:35:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Aug 2015 15:35:27 -0400    

Click here for diff

Further testing revealed that commit f69b4b9495269cc4 was still a few  
bricks shy of a load: minor tweaking of the previous test cases resulted  
in the same wrong-outer-join-order problem coming back.  After study  
I concluded that my previous changes in make_outerjoininfo() were just  
accidentally masking the problem, and should be reverted in favor of  
forcing syntactic join order whenever an upper outer join's predicate  
doesn't mention a lower outer join's LHS.  This still allows the  
chained-outer-joins style that is the normally optimizable case.  
  
I also tightened things up some more in join_is_legal().  It seems to me  
on review that what's really happening in the exception case where we  
ignore a mismatched special join is that we're allowing the proposed join  
to associate into the RHS of the outer join we're comparing it to.  As  
such, we should *always* insist that the proposed join be a left join,  
which eliminates a bunch of rather dubious argumentation.  The case where  
we weren't enforcing that was the one that was already known buggy anyway  
(it had a violatable Assert before the aforesaid commit) so it hardly  
deserves a lot of deference.  
  
Back-patch to all active branches, like the previous patch.  The added  
regression test case failed in all branches back to 9.1, and I think it's  
only an unrelated change in costing calculations that kept 9.0 from  
choosing a broken plan.  

M src/backend/optimizer/README
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/initsplan.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Fix incorrect calculation in shm_mq_receive.

commit   : df0a67f754c2c45c99237765f30856c5dd95949d    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 6 Aug 2015 13:25:45 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 6 Aug 2015 13:25:45 -0400    

Click here for diff

If some, but not all, of the length word has already been read, and the  
next attempt to read sees exactly the number of bytes needed to complete  
the length word, or fewer, then we'll incorrectly read less than all of  
the available data.  
  
Antonin Houska  

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

Reduce ProcArrayLock contention by removing backends in batches.

commit   : 0e141c0fbb211bdd23783afa731e3eef95c9ad7a    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 6 Aug 2015 11:52:51 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 6 Aug 2015 11:52:51 -0400    

Click here for diff

When a write transaction commits, it must clear its XID advertised via  
the ProcArray, which requires that we hold ProcArrayLock in exclusive  
mode in order to prevent concurrent processes running GetSnapshotData  
from seeing inconsistent results.  When many processes try to commit  
at once, ProcArrayLock must change hands repeatedly, with each  
concurrent process trying to commit waking up to acquire the lock in  
turn.  To make things more efficient, when more than one backend is  
trying to commit a write transaction at the same time, have just one  
of them acquire ProcArrayLock in exclusive mode and clear the XIDs of  
all processes in the group.  Benchmarking reveals that this is much  
more efficient at very high client counts.  
  
Amit Kapila, heavily revised by me, with some review also from Pavan  
Deolasee.  

M src/backend/access/transam/README
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/proc.h

Fix `make installcheck` for serializable transactions.

commit   : 253de7e1eb9abbcf57e6c229a8a38abd6455c7de    
  
author   : Kevin Grittner <[email protected]>    
date     : Thu, 6 Aug 2015 10:47:47 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Thu, 6 Aug 2015 10:47:47 -0500    

Click here for diff

Commit e5550d5fec66aa74caad1f79b79826ec64898688 added some new  
tests for ALTER TABLE which involved table scans.  When  
default_transaction_isolation = 'serializable' these acquire  
relation-level SIReadLocks.  The test results didn't cope with  
that.  Add SIReadLock as the minimum lock level for purposes of  
these tests.  
  
This could also be fixed by excluding this type of lock from the  
my_locks view, but it would be a bug for SIReadLock to show up for  
a relation which was not otherwise locked, so do it this way to  
allow that sort of condition to cause a regression test failure.  
  
There is some question whether we could avoid taking SIReadLocks  
during these operations, but confirming the safety of that and  
figuring out how to avoid the locks is not trivial, and would be  
a separate patch.  
  
Backpatch to 9.4 where the new tests were added.  

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

Improve includes introduced in the replication origins patch.

commit   : 3a145757a0cd19bfce770abeefa16af674e1bc09    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Aug 2015 12:38:35 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Aug 2015 12:38:35 +0200    

Click here for diff

pg_resetxlog.h contained two superfluous includes, origin.h superfluously  
depended on logical.h, and pg_xlogdump's rmgrdesc.h only indirectly  
included origin.h.  
  
Backpatch: 9.5, where replication origins were introduced.  

M src/bin/pg_resetxlog/pg_resetxlog.c
M src/bin/pg_xlogdump/rmgrdesc.c
M src/include/replication/origin.h

docs: HTML-escape '>' in '=>' using HTML entities

commit   : e641d7b22fae3086c1372fb0d117f629ec174a0b    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 5 Aug 2015 23:03:45 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 5 Aug 2015 23:03:45 -0400    

Click here for diff

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/hstore.sgml
M doc/src/sgml/pgstattuple.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/rules.sgml
M doc/src/sgml/seg.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/xfunc.sgml

Reconcile nodes/*funcs.c with recent work.

commit   : b8fe12a83622b350dc6849f8bb933bd8a86c1424    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 5 Aug 2015 20:44:27 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 5 Aug 2015 20:44:27 -0400    

Click here for diff

A few of the discrepancies had semantic significance, but I did not  
track down the resulting user-visible bugs, if any.  Back-patch to 9.5,  
where all but one discrepancy appeared.  The _equalCreateEventTrigStmt()  
situation dates to 9.3 but does not affect semantics.  
  
catversion bump due to readfuncs.c field order changes.  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/catalog/catversion.h

commit   : c26170668c82eaaf28b6efbf76c5d1c206c27121    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 5 Aug 2015 20:43:07 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 5 Aug 2015 20:43:07 -0400    

Click here for diff

Commit 0ffc201a51395ca71fe429ef86c872850a5850ee included this object  
unconditionally.  Being unprepared for that, most external, single-file  
modules failed to build.  This better aligns the GNU make build system  
with the heuristic in the MSVC build's Project::AddDirResourceFile().  
In-tree, installed modules set PGFILEDESC, so they will see no change.  
Also, under PGXS, omit the nonfunctioning rule to build win32ver.rc.  
Back-patch to 9.5, where the aforementioned commit first appeared.  

M src/makefiles/Makefile.win32
M src/makefiles/pgxs.mk

Allow pg_rewind tap tests to run with older File::Path versions

commit   : 7c29764a354a0e7deb3c28e1d5c38ff6662ee3f9    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 5 Aug 2015 16:21:54 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 5 Aug 2015 16:21:54 -0400    

Click here for diff

Older versions have rmtree but not remove_tree. The one-argument forms  
of these are equivalent, so replace remove_tree with rmtree. This allows  
the tests to be run on oldish Msys systems.  

M src/bin/pg_rewind/RewindTest.pm

Remove carriage returns from certain tap test output under Msys

commit   : ff85fc8d0b3ae88221e20ee9b070c23248eb7921    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 5 Aug 2015 16:19:23 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 5 Aug 2015 16:19:23 -0400    

Click here for diff

These were causing spurious test failures.  

M src/test/perl/TestLib.pm

Fix BRIN to use SnapshotAny during summarization

commit   : 2834855cb9fde734ce12f59694522c10bf0c0205    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 5 Aug 2015 16:20:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 5 Aug 2015 16:20:50 -0300    

Click here for diff

For correctness of summarization results, it is critical that the  
snapshot used during the summarization scan is able to see all tuples  
that are live to all transactions -- including tuples inserted or  
deleted by in-progress transactions.  Otherwise, it would be possible  
for a transaction to insert a tuple, then idle for a long time while a  
concurrent transaction executes summarization of the range: this would  
result in the inserted value not being considered in the summary.  
Previously we were trying to use a MVCC snapshot in conjunction with  
adding a "placeholder" tuple in the index: the snapshot would see all  
committed tuples, and the placeholder tuple would catch insertions by  
any new inserters.  The hole is that prior insertions by transactions  
that are still in progress by the time the MVCC snapshot was taken were  
ignored.  
  
Kevin Grittner reported this as a bogus error message during vacuum with  
default transaction isolation mode set to repeatable read (because the  
error report mentioned a function name not being invoked during), but  
the problem is larger than that.  
  
To fix, tweak IndexBuildHeapRangeScan to have a new mode that behaves  
the way we need using SnapshotAny visibility rules.  This change  
simplifies the BRIN code a bit, mainly by removing large comments that  
were mistaken.  Instead, rely on the SnapshotAny semantics to provide  
what it needs.  (The business about a placeholder tuple needs to remain:  
that covers the case that a transaction inserts a a tuple in a page that  
summarization already scanned.)  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  
  
In passing, remove a couple of unused declarations from brin.h and  
reword a comment to be proper English.  This part submitted by Kevin  
Grittner.  
  
Backpatch to 9.5, where BRIN was introduced.  

M src/backend/access/brin/brin.c
M src/backend/catalog/index.c
M src/include/access/brin.h
M src/include/catalog/index.h
A src/test/isolation/expected/brin-1.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/brin-1.spec

Make real sure we don't reassociate joins into or out of SEMI/ANTI joins.

commit   : 6af9ee4c8c8f31cbf2e76166d1d9868876f60aea    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Aug 2015 14:39:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Aug 2015 14:39:07 -0400    

Click here for diff

Per the discussion in optimizer/README, it's unsafe to reassociate anything  
into or out of the RHS of a SEMI or ANTI join.  An example from Piotr  
Stefaniak showed that join_is_legal() wasn't sufficiently enforcing this  
rule, so lock it down a little harder.  
  
I couldn't find a reasonably simple example of the optimizer trying to  
do this, so no new regression test.  (Piotr's example involved the random  
search in GEQO accidentally trying an invalid case and triggering a sanity  
check way downstream in clause selectivity estimation, which did not seem  
like a sequence of events that would be useful to memorialize in a  
regression test as-is.)  
  
Back-patch to all active branches.  

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

Fix typo in commit de6fd1c.

commit   : 18382ae7ede9a330d997ca4d53cb429ba2c4d5fd    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Aug 2015 18:39:05 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Aug 2015 18:39:05 +0200    

Click here for diff

Per buildfarm members mandrill and hornet.  

M src/template/aix

Rely on inline functions even if that causes warnings in older compilers.

commit   : de6fd1c898f6eca82c2130a9dbb42d00da68d79e    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Aug 2015 18:19:52 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Aug 2015 18:19:52 +0200    

Click here for diff

So far we have worked around the fact that some very old compilers do  
not support 'inline' functions by only using inline functions  
conditionally (or not at all). Since such compilers are very rare by  
now, we have decided to rely on inline functions from 9.6 onwards.  
  
To avoid breaking these old compilers inline is defined away when not  
supported. That'll cause "function x defined but not used" type of  
warnings, but since nobody develops on such compilers anymore that's  
ok.  
  
This change in policy will allow us to more easily employ inline  
functions.  
  
I chose to remove code previously conditional on PG_USE_INLINE as it  
seemed confusing to have code dependent on a define that's always  
defined.  
  
Blacklisting of compilers, like in c53f73879f, now has to be done  
differently. A platform template can define PG_FORCE_DISABLE_INLINE to  
force inline to be defined empty.  
  
Discussion: [email protected]  

M config/c-compiler.m4
D config/test_quiet_include.h
M configure
M configure.in
M src/backend/lib/ilist.c
M src/backend/nodes/list.c
M src/backend/port/atomics.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/sort/sortsupport.c
M src/include/access/gin_private.h
M src/include/c.h
M src/include/lib/ilist.h
M src/include/nodes/pg_list.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port/atomics.h
M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/fallback.h
M src/include/port/atomics/generic-acc.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic-sunpro.h
M src/include/port/atomics/generic-xlc.h
M src/include/port/atomics/generic.h
M src/include/utils/arrayaccess.h
M src/include/utils/palloc.h
M src/include/utils/sortsupport.h
M src/template/aix

Fix debug message output when connecting to a logical slot.

commit   : a855118be3f0682a2061448db5a87dec50717af4    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Aug 2015 13:26:01 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Aug 2015 13:26:01 +0200    

Click here for diff

Previously the message erroneously printed the same LSN twice as the  
assignment to the start_lsn variable was before the message. Correct  
that.  
  
Reported-By: Marko Tiikkaja  
Author: Marko Tiikkaja  
Backpatch: 9.5, where logical decoding was introduced  

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

Fix comment atomics.h.

commit   : 073082bbb1adc4548132915874a001688514e64f    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Aug 2015 13:06:04 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Aug 2015 13:06:04 +0200    

Click here for diff

I appear to accidentally have switched the comments for  
pg_atomic_write_u32 and pg_atomic_read_u32 around. Also fix some minor  
typos I found while fixing.  
  
Noticed-By: Amit Kapila  
Backpatch: 9.5  

M src/include/port/atomics.h

Docs: add an explicit example about controlling overall greediness of REs.

commit   : 1b5d34ca6244a9296215325a9f82fb805e739f9e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 21:09:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 21:09:12 -0400    

Click here for diff

Per discussion of bug #13538.  

M doc/src/sgml/func.sgml

Fix pg_dump to dump shell types.

commit   : 3bdd7f90fc0a038ee8b5b3fd9f9507cf2f07a4b2    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 19:34:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 19:34:12 -0400    

Click here for diff

Per discussion, it really ought to do this.  The original choice to  
exclude shell types was probably made in the dark ages before we made  
it harder to accidentally create shell types; but that was in 7.3.  
  
Also, cause the standard regression tests to leave a shell type behind,  
for convenience in testing the case in pg_dump and pg_upgrade.  
  
Back-patch to all supported branches.  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/test/regress/expected/create_type.out
M src/test/regress/sql/create_type.sql

Fix bogus "out of memory" reports in tuplestore.c.

commit   : 8ea3e7a75c0d22c41c57f59c8b367059b97d0b66    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 18:18:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 18:18:46 -0400    

Click here for diff

The tuplesort/tuplestore memory management logic assumed that the chunk  
allocation overhead for its memtuples array could not increase when  
increasing the array size.  This is and always was true for tuplesort,  
but we (I, I think) blindly copied that logic into tuplestore.c without  
noticing that the assumption failed to hold for the much smaller array  
elements used by tuplestore.  Given rather small work_mem, this could  
result in an improper complaint about "unexpected out-of-memory situation",  
as reported by Brent DeSpain in bug #13530.  
  
The easiest way to fix this is just to increase tuplestore's initial  
array size so that the assumption holds.  Rather than relying on magic  
constants, though, let's export a #define from aset.c that represents  
the safe allocation threshold, and make tuplestore's calculation depend  
on that.  
  
Do the same in tuplesort.c to keep the logic looking parallel, even though  
tuplesort.c isn't actually at risk at present.  This will keep us from  
breaking it if we ever muck with the allocation parameters in aset.c.  
  
Back-patch to all supported versions.  The error message doesn't occur  
pre-9.3, not so much because the problem can't happen as because the  
pre-9.3 tuplestore code neglected to check for it.  (The chance of  
trouble is a great deal larger as of 9.3, though, due to changes in the  
array-size-increasing strategy.)  However, allowing LACKMEM() to become  
true unexpectedly could still result in less-than-desirable behavior,  
so let's patch it all the way back.  

M src/backend/utils/mmgr/aset.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplestore.c
M src/include/utils/memutils.h

commit   : 85e5e222b1dd02f135a8c3bf387d0d6d88e669bd    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 14:55:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 14:55:32 -0400    

Click here for diff

In commit b514a7460d9127ddda6598307272c701cbb133b7, I changed the planner  
so that it would allow nestloop paths to remain partially parameterized,  
ie the inner relation might need parameters from both the current outer  
relation and some upper-level outer relation.  That's fine so long as we're  
talking about distinct parameters; but the patch also allowed creation of  
nestloop paths for cases where the inner relation's parameter was a  
PlaceHolderVar whose eval_at set included the current outer relation and  
some upper-level one.  That does *not* work.  
  
In principle we could allow such a PlaceHolderVar to be evaluated at the  
lower join node using values passed down from the upper relation along with  
values from the join's own outer relation.  However, nodeNestloop.c only  
supports simple Vars not arbitrary expressions as nestloop parameters.  
createplan.c is also a few bricks shy of being able to handle such cases;  
it misplaces the PlaceHolderVar parameters in the plan tree, which is why  
the visible symptoms of this bug are "plan should not reference subplan's  
variable" and "failed to assign all NestLoopParams to plan nodes" planner  
errors.  
  
Adding the necessary complexity to make this work doesn't seem like it  
would be repaid in significantly better plans, because in cases where such  
a PHV exists, there is probably a corresponding join order constraint that  
would allow a good plan to be found without using the star-schema exception.  
Furthermore, adding complexity to nodeNestloop.c would create a run-time  
penalty even for plans where this whole consideration is irrelevant.  
So let's just reject such paths instead.  
  
Per fuzz testing by Andreas Seltenreich; the added regression test is based  
on his example query.  Back-patch to 9.2, like the previous patch.  

M src/backend/optimizer/path/joinpath.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Cap wal_buffers to avoid a server crash when it's set very large.

commit   : 369342cf70972a81e6be99b31593f31b73479d7f    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 4 Aug 2015 12:58:54 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 4 Aug 2015 12:58:54 -0400    

Click here for diff

It must be possible to multiply wal_buffers by XLOG_BLCKSZ without  
overflowing int, or calculations in StartupXLOG will go badly wrong  
and crash the server.  Avoid that by imposing a maximum value on  
wal_buffers.  This will be just under 2GB, assuming the usual value  
for XLOG_BLCKSZ.  
  
Josh Berkus, per an analysis by Andrew Gierth.  

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

Tab completion for CREATE SEQUENCE.

commit   : 158e3bc8e2507244b0d1e87ee334f39b7400098a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 4 Aug 2015 12:29:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 4 Aug 2015 12:29:20 -0400    

Click here for diff

Vik Fearing, reviewed by Brendan Jurd, Michael Paquier, and myself  

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

Update comment to match behavior of latest code.

commit   : a6a235782083a98588e41a1298c8fcd89cfaa6b3    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 4 Aug 2015 11:45:29 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 4 Aug 2015 11:45:29 -0400    

Click here for diff

Peter Geoghegan  

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

Share transition state between different aggregates when possible.

commit   : 804163bc25e979fcd91b02e58fa2d1c6b587cc65    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 4 Aug 2015 17:53:10 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 4 Aug 2015 17:53:10 +0300    

Click here for diff

If there are two different aggregates in the query with same inputs, and  
the aggregates have the same initial condition and transition function,  
only calculate the state value once, and only call the final functions  
separately. For example, AVG(x) and SUM(x) aggregates have the same  
transition function, which accumulates the sum and number of input tuples.  
For a query like "SELECT AVG(x), SUM(x) FROM x", we can therefore  
accumulate the state function only once, which gives a nice speedup.  
  
David Rowley, reviewed and edited by me.  

M src/backend/executor/execQual.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/parser/parse_agg.c
M src/include/nodes/execnodes.h
M src/include/parser/parse_agg.h
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

RLS: Keep deny policy when only restrictive exist

commit   : dee0200f0276c0f9da930a2c926f90f5615f2d64    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 3 Aug 2015 15:32:49 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 3 Aug 2015 15:32:49 -0400    

Click here for diff

Only remove the default deny policy when a permissive policy exists  
(either from the hook or defined by the user).  If only restrictive  
policies exist then no rows will be visible, as restrictive policies  
shouldn't make rows visible.  To address this requirement, a single  
"USING (true)" permissive policy can be created.  
  
Update the test_rls_hooks regression tests to create the necessary  
"USING (true)" permissive policy.  
  
Back-patch to 9.5 where RLS was added.  
  
Per discussion with Dean.  

M src/backend/rewrite/rowsecurity.c
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/modules/test_rls_hooks/test_rls_hooks.c

Update 9.5 release notes through today.

commit   : ecc2d16bc97d160d3b4beecfc46676bbaaf157a5    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2015 12:29:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2015 12:29:10 -0400    

Click here for diff

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

Fix psql \d output of policies.

commit   : c3cc844feb4a52fc57f53d129f33782d55f29340    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 3 Aug 2015 09:07:47 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 3 Aug 2015 09:07:47 -0700    

Click here for diff

psql neglected to wrap parenthesis around USING and WITH CHECK  
expressions -- fixed. Back-patched to 9.5 where RLS policies were  
introduced.  

M src/bin/psql/describe.c

Make recovery rename tablespace_map to *.old if backup_label is not present.

commit   : dd85acf0c49ee6ea86b2ea0d4ff851b89c1f355a    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 3 Aug 2015 23:04:41 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 3 Aug 2015 23:04:41 +0900    

Click here for diff

If tablespace_map file is present without backup_label file, there is  
no use of such file.  There is no harm in retaining it, but it is better  
to get rid of the map file so that we don't have any redundant file  
in data directory and it will avoid any sort of confusion. It seems  
prudent though to just rename the file out of the way rather than  
delete it completely, also we ignore any error that occurs in rename  
operation as even if map file is present without backup_label file,  
it is harmless.  
  
Back-patch to 9.5 where tablespace_map file was introduced.  
  
Amit Kapila, reviewed by Robert Haas, Alvaro Herrera and me.  

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

Fix pg_rewind when pg_xlog is a symlink.

commit   : 0e42397f42b370798461cbf3358185b520329f9f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Aug 2015 15:32:06 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Aug 2015 15:32:06 +0300    

Click here for diff

pg_xlog is often a symlink, typically to a different filesystem. Don't  
get confused and comlain about by that, and just always pretend that it's a  
normal directory, even if it's really a symlink.  
  
Also add a test case for this.  
  
Backpatch to 9.5.  

M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
A src/bin/pg_rewind/t/004_pg_xlog_symlink.pl

Clean up pg_rewind regression test script.

commit   : 69b7a35c9ad8d8a467b5be5ab6ab2db7935e9b28    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Aug 2015 13:06:47 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Aug 2015 13:06:47 +0300    

Click here for diff

Since commit 01f6bb4b2, TestLib.pm has exported path to tmp_check directory,  
so let's use that also for the pg_rewind test clusters etc.  
  
Also, in master, the $tempdir_short variable has not been used since commit  
13d856e17, which moved the initdb-running code to TestLib.pm.  
  
Backpatch to 9.5.  

M src/bin/pg_rewind/RewindTest.pm

Make modules/test_ddl_deparse/.gitignore match its siblings.

commit   : e2b49db0f0c55196ae336e28bc142dddd38cad1e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2015 00:02:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2015 00:02:26 -0400    

Click here for diff

Not sure why /tmp_check/ was omitted from this one, but even if it  
isn't really needed right now, it's inconsistent not to include it.  

M src/test/modules/test_ddl_deparse/.gitignore

contrib/isn now needs a .gitignore file.

commit   : fd7ed26c1a2353923be067dd84059f3ce3a5aff4    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 23:57:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 23:57:32 -0400    

Click here for diff

Oversight in commit cb3384a0cb4cf900622b77865f60e31259923079.  
Back-patch to 9.1, like that commit.  

A contrib/isn/.gitignore

Fix a number of places that produced XX000 errors in the regression tests.

commit   : 09cecdf285ea9f51aed669f9ea1ba840197d49d0    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 23:49:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 23:49:19 -0400    

Click here for diff

It's against project policy to use elog() for user-facing errors, or to  
omit an errcode() selection for errors that aren't supposed to be "can't  
happen" cases.  Fix all the violations of this policy that result in  
ERRCODE_INTERNAL_ERROR log entries during the standard regression tests,  
as errors that can reliably be triggered from SQL surely should be  
considered user-facing.  
  
I also looked through all the files touched by this commit and fixed  
other nearby problems of the same ilk.  I do not claim to have fixed  
all violations of the policy, just the ones in these files.  
  
In a few places I also changed existing ERRCODE choices that didn't  
seem particularly appropriate; mainly replacing ERRCODE_SYNTAX_ERROR  
by something more specific.  
  
Back-patch to 9.5, but no further; changing ERRCODE assignments in  
stable branches doesn't seem like a good idea.  

M contrib/tablefunc/tablefunc.c
M src/backend/access/common/reloptions.c
M src/backend/access/heap/heapam.c
M src/backend/commands/copy.c
M src/backend/commands/vacuum.c
M src/backend/executor/execQual.c
M src/backend/utils/adt/txid.c
M src/pl/plperl/plperl.c
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_exec.c
M src/pl/tcl/pltcl.c
M src/test/regress/expected/txid.out
M src/test/regress/regress.c

Allow TAP tests to run under Msys

commit   : 690ed2b76ab91eb79ea04ee2bfbdc8a2693f2a37    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 2 Aug 2015 20:58:18 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 2 Aug 2015 20:58:18 -0400    

Click here for diff

The Msys DTK perl, which is required to run TAP tests under Msys as a  
native perl won't recognize the correct virtual paths, has its osname  
recorded in the Config module as 'msys' instead of 'MSWin32'. To avoid  
having to repeat the test a variable is created that is true iff the  
osname is either of these values, and is then used everywhere that  
matters.  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/test/perl/TestLib.pm

Avoid calling memcpy() with a NULL source pointer and count == 0.

commit   : 13bba02271dce865cd20b6f49224889c73fed4e7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 15:48:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 15:48:27 -0400    

Click here for diff

As in commit 0a52d378b03b7d5a, avoid doing something that has undefined  
results according to the C standard, even though in practice there does  
not seem to be any problem with it.  
  
This fixes two places in numeric.c that demonstrably could call memcpy()  
with such arguments.  I looked through that file and didn't see any other  
places with similar hazards; this is not to claim that there are not such  
places in other files.  
  
Per report from Piotr Stefaniak.  Back-patch to 9.5 which is where the  
previous commit was added.  We're more or less setting a precedent that  
we will not worry about this type of issue in pre-9.5 branches unless  
someone demonstrates a problem in the field.  

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

Fix output of ISBN-13 numbers beginning with 979.

commit   : cb3384a0cb4cf900622b77865f60e31259923079    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 2 Aug 2015 22:12:33 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 2 Aug 2015 22:12:33 +0300    

Click here for diff

An EAN beginning with 979 (but not 9790 - those are ISMN's) are accepted  
as ISBN numbers, but they cannot be represented in the old, 10-digit ISBN  
format. They must be output in the new 13-digit ISBN-13 format. We printed  
out an incorrect value for those.  
  
Also add a regression test, to test this and some other basic functionality  
of the module.  
  
Patch by Fabien Coelho. This fixes bug #13442, reported by B.Z. Backpatch  
to 9.1, where we started to recognize ISBN-13 numbers.  

M contrib/isn/Makefile
A contrib/isn/expected/isn.out
M contrib/isn/isn.c
A contrib/isn/sql/isn.sql

Fix incorrect order of lock file removal and failure to close() sockets.

commit   : d73d14c271653dff10c349738df79ea03b85236c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 14:54:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 14:54:44 -0400    

Click here for diff

Commit c9b0cbe98bd783e24a8c4d8d8ac472a494b81292 accidentally broke the  
order of operations during postmaster shutdown: it resulted in removing  
the per-socket lockfiles after, not before, postmaster.pid.  This creates  
a race-condition hazard for a new postmaster that's started immediately  
after observing that postmaster.pid has disappeared; if it sees the  
socket lockfile still present, it will quite properly refuse to start.  
This error appears to be the explanation for at least some of the  
intermittent buildfarm failures we've seen in the pg_upgrade test.  
  
Another problem, which has been there all along, is that the postmaster  
has never bothered to close() its listen sockets, but has just allowed them  
to close at process death.  This creates a different race condition for an  
incoming postmaster: it might be unable to bind to the desired listen  
address because the old postmaster is still incumbent.  This might explain  
some odd failures we've seen in the past, too.  (Note: this is not related  
to the fact that individual backends don't close their client communication  
sockets.  That behavior is intentional and is not changed by this patch.)  
  
Fix by adding an on_proc_exit function that closes the postmaster's ports  
explicitly, and (in 9.3 and up) reshuffling the responsibility for where  
to unlink the Unix socket files.  Lock file unlinking can stay where it  
is, but teach it to unlink the lock files in reverse order of creation.  

M src/backend/libpq/pqcomm.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/init/miscinit.c
M src/include/libpq/libpq.h

Fix race condition that lead to WALInsertLock deadlock with commit_delay.

commit   : 358cde320b17535011b0a912e5c9ce1453666ed1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 2 Aug 2015 20:08:10 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 2 Aug 2015 20:08:10 +0300    

Click here for diff

If a call to WaitForXLogInsertionsToFinish() returned a value in the middle  
of a page, and another backend then started to insert a record to the same  
page, and then you called WaitXLogInsertionsToFinish() again, the second  
call might return a smaller value than the first call. The problem was in  
GetXLogBuffer(), which always updated the insertingAt value to the  
beginning of the requested page, not the actual requested location. Because  
of that, the second call might return a xlog pointer to the beginning of  
the page, while the first one returned a later position on the same page.  
XLogFlush() performs two calls to WaitXLogInsertionsToFinish() in  
succession, and holds WALWriteLock on the second call, which can deadlock  
if the second call to WaitXLogInsertionsToFinish() blocks.  
  
Reported by Spiros Ioannou. Backpatch to 9.4, where the more scalable  
WALInsertLock mechanism, and this bug, was introduced.  

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

Micro optimize LWLockAttemptLock() a bit.

commit   : a4b09af3e93707351f1d4b8efafabfa135c0f70b    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 31 Jul 2015 20:50:35 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 31 Jul 2015 20:50:35 +0200    

Click here for diff

LWLockAttemptLock pointlessly read the lock's state in every loop  
iteration, even though pg_atomic_compare_exchange_u32() returns the old  
value. Instead do that only once before the loop iteration.  
  
Additionally there's no need to have the expected_state variable,  
old_state mostly had the same value anyway.  
  
Noticed-By: Heikki Linnakangas  
Backpatch: 9.5, no reason to let the branches diverge at this point  

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

Fix issues around the "variable" support in the lwlock infrastructure.

commit   : 7039760114da45552043f8fa229928e071650173    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 31 Jul 2015 20:20:43 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 31 Jul 2015 20:20:43 +0200    

Click here for diff

The lwlock scalability work introduced two race conditions into the  
lwlock variable support provided for xlog.c. First, and harmlessly on  
most platforms, it set/read the variable without the spinlock in some  
places. Secondly, due to the removal of the spinlock, it was possible  
that a backend missed changes to the variable's state if it changed in  
the wrong moment because checking the lock's state, the variable's state  
and the queuing are not protected by a single spinlock acquisition  
anymore.  
  
To fix first move resetting the variable's from LWLockAcquireWithVar to  
WALInsertLockRelease, via a new function LWLockReleaseClearVar. That  
prevents issues around waiting for a variable's value to change when a  
new locker has acquired the lock, but not yet set the value. Secondly  
re-check that the variable hasn't changed after enqueing, that prevents  
the issue that the lock has been released and already re-acquired by the  
time the woken up backend checks for the lock's state.  
  
Reported-By: Jeff Janes  
Analyzed-By: Heikki Linnakangas  
Reviewed-By: Heikki Linnakangas  
Discussion: [email protected]  
Backpatch: 9.5, where the lwlock scalability went in  

M src/backend/access/transam/xlog.c
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h

Fix some planner issues with degenerate outer join clauses.

commit   : f69b4b9495269cc4957bac0f10aaada4d4cfa61e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Aug 2015 20:57:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Aug 2015 20:57:41 -0400    

Click here for diff

An outer join clause that didn't actually reference the RHS (perhaps only  
after constant-folding) could confuse the join order enforcement logic,  
leading to wrong query results.  Also, nested occurrences of such things  
could trigger an Assertion that on reflection seems incorrect.  
  
Per fuzz testing by Andreas Seltenreich.  The practical use of such cases  
seems thin enough that it's not too surprising we've not heard field  
reports about it.  
  
This has been broken for a long time, so back-patch to all active branches.  

M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/initsplan.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Teach predtest.c that "foo" implies "foo IS NOT NULL".

commit   : dea1491ffb448d20764a5f2cec8ae33b64dd39f8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Aug 2015 14:31:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Aug 2015 14:31:46 -0400    

Click here for diff

Per complaint from Peter Holzer.  It's useful to cover this special case,  
since for a boolean variable "foo", earlier parts of the planner will have  
reduced variants like "foo = true" to just "foo", and thus we may fail  
to recognize the applicability of a partial index with predicate  
"foo IS NOT NULL".  
  
Back-patch to 9.5, but not further; given the lack of previous complaints  
this doesn't seem like behavior to change in stable branches.  

M src/backend/optimizer/util/predtest.c

Fix an oversight in checking whether a join with LATERAL refs is legal.

commit   : a6492ff8970b06b9e27cc314c7d1aa574fcc7b04    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Jul 2015 19:26:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Jul 2015 19:26:33 -0400    

Click here for diff

In many cases, we can implement a semijoin as a plain innerjoin by first  
passing the righthand-side relation through a unique-ification step.  
However, one of the cases where this does NOT work is where the RHS has  
a LATERAL reference to the LHS; that makes the RHS dependent on the LHS  
so that unique-ification is meaningless.  joinpath.c understood this,  
and so would not generate any join paths of this kind ... but join_is_legal  
neglected to check for the case, so it would think that we could do it.  
The upshot would be a "could not devise a query plan for the given query"  
failure once we had failed to generate any join paths at all for the bogus  
join pair.  
  
Back-patch to 9.3 where LATERAL was added.  

M src/backend/optimizer/path/joinrels.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Clean up Makefile.win32 "-I" flag additions.

commit   : 16c4e6d8dc8fb98cd32d9af473fb06a730fb40d3    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 30 Jul 2015 20:48:46 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 30 Jul 2015 20:48:46 -0400    

Click here for diff

The PGXS-case directory does not exist in the non-PGXS case, and vice  
versa.  Add one or the other, not both.  This is essentially cosmetic.  
It makes Makefile.win32 more like the similar Makefile.global code.  

M src/makefiles/Makefile.win32

Consolidate makefile code for setting top_srcdir, srcdir and VPATH.

commit   : 5da944fb4683762b8ccebbf7599f79db01e63132    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 30 Jul 2015 20:48:41 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 30 Jul 2015 20:48:41 -0400    

Click here for diff

Responsibility was formerly split between Makefile.global and pgxs.mk.  
As a result of commit b58233c71b93a32fcab7219585cafc25a27eb769, in the  
PGXS case, these variables were unset while parsing Makefile.global and  
callees.  Inclusion of Makefile.custom did not work from PGXS, and the  
subtle difference seemed like a recipe for future bugs.  Back-patch to  
9.4, where that commit first appeared.  

M src/Makefile.global.in
M src/makefiles/pgxs.mk

Fix volatility marking of commit timestamp functions

commit   : e8e86fbc8b3619da54c485cf05272ccf1dac1a7d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Jul 2015 15:19:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Jul 2015 15:19:49 -0300    

Click here for diff

They are marked stable, but since they act on instantaneous state and it  
is possible to consult state of transactions as they commit, the results  
could change mid-query.  They need to be marked volatile, and this  
commit does so.  
  
There would normally be a catversion bump here, but this is so much a  
niche feature and I don't believe there's real damage from the incorrect  
marking, that I refrained.  
  
Backpatch to 9.5, where commit timestamps where introduced.  
  
Per note from Fujii Masao.  

M src/include/catalog/pg_proc.h

Fix broken assertion in BRIN code

commit   : c81276241b61d8759e024ed803e8f3f251d8e7c9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Jul 2015 15:07:19 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Jul 2015 15:07:19 -0300    

Click here for diff

The code was assuming that any NULL value in scan keys was due to IS  
NULL or IS NOT NULL, but it turns out to be possible to get them with  
other operators too, if they are used in contrived-enough ways.  Easiest  
way out of the problem seems to check explicitely for the IS NOT NULL  
flag, instead of assuming it must be set if the IS NULL flag is not set,  
when a null scan key is found; if neither flag is set, follow the lead  
of other index AMs and assume that all indexable operators must be  
strict, and thus the query is never satisfiable.  
  
Also, add a comment to try and lure some future hacker into improving  
analysis of scan keys in brin.  
  
Per report from Andreas Seltenreich; diagnosis by Tom Lane.  
Backpatch to 9.5.  
  
Discussion: http://www.postgresql.org/message-id/[email protected]  

M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c

Improve CREATE FUNCTION doc WRT to LEAKPROOF RLS interaction.

commit   : d6314b20cd872a542d71738df54a906d2962abb8    
  
author   : Joe Conway <[email protected]>    
date     : Thu, 30 Jul 2015 10:16:36 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Thu, 30 Jul 2015 10:16:36 -0700    

Click here for diff

Patch by Dean Rasheed. Back-patched to 9.5 where RLS was introduced.  

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

Use appropriate command type when retrieving relation's policies.

commit   : 1e15b212290bf6daff752f20e9e0356e4dac6e09    
  
author   : Joe Conway <[email protected]>    
date     : Thu, 30 Jul 2015 09:38:15 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Thu, 30 Jul 2015 09:38:15 -0700    

Click here for diff

When retrieving policies, if not working on the root target relation,  
we actually want the relation's SELECT policies, regardless of  
the top level query command type. For example in UPDATE t1...FROM t2  
we need to apply t1's UPDATE policies and t2's SELECT policies.  
Previously top level query command type was applied to all relations,  
which was wrong. Add some regression coverage to ensure we don't  
violate this principle in the future.  
  
Report and patch by Dean Rasheed. Cherry picked from larger refactoring  
patch and tweaked by me. Back-patched to 9.5 where RLS was introduced.  

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

Avoid some zero-divide hazards in the planner.

commit   : 8693ebe37d65ec1bc1ebeab36f60b38f18fb25d6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Jul 2015 12:11:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Jul 2015 12:11:23 -0400    

Click here for diff

Although I think on all modern machines floating division by zero  
results in Infinity not SIGFPE, we still don't want infinities  
running around in the planner's costing estimates; too much risk  
of that leading to insane behavior.  
  
grouping_planner() failed to consider the possibility that final_rel  
might be known dummy and hence have zero rowcount.  (I wonder if it  
would be better to set a rows estimate of 1 for dummy relations?  
But at least in the back branches, changing this convention seems  
like a bad idea, so I'll leave that for another day.)  
  
Make certain that get_variable_numdistinct() produces a nonzero result.  
The case that can be shown to be broken is with stadistinct < 0.0 and  
small ntuples; we did not prevent the result from rounding to zero.  
For good luck I applied clamp_row_est() to all the nonconstant return  
values.  
  
In ExecChooseHashTableSize(), Assert that we compute positive nbuckets  
and nbatch.  I know of no reason to think this isn't the case, but it  
seems like a good safety check.  
  
Per reports from Piotr Stefaniak.  Back-patch to all active branches.  

M src/backend/executor/nodeHash.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/adt/selfuncs.c

Fix calculation of latency of pgbench backslash commands.

commit   : 5515ec0b3a9425a0c0e36e26b5774c1568f22b3a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 30 Jul 2015 14:50:51 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 30 Jul 2015 14:50:51 +0300    

Click here for diff

When we loop back to the top of doCustom after processing a backslash  
command, we must reset the "now" timestamp, because that's used to  
calculate the time spent executing the previous command.  
  
Report and fix by Fabien Coelho. Backpatch to 9.5, where this was broken.  

M src/bin/pgbench/pgbench.c

Update ax_pthread.m4 to an experimental draft version from upstream.

commit   : a2932283c2a39efd2f713f647c9f7f3d34123bb3    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 30 Jul 2015 14:14:50 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 30 Jul 2015 14:14:50 +0300    

Click here for diff

The current version is adding a spurious -pthread option on some Darwin  
systems that don't need it, which leads to a bunch of "unrecognized option  
'-pthread'" warnings. There is a proposed fix for that in the upstream  
autoconf archive's bug tracker, see https://savannah.gnu.org/patch/?8186.  
This commit updates our version of ax_pthread.m4 to the "draft2" version  
proposed there by Daniel Richard G. I'm using our buildfarm to help Daniel  
to test this, before he commits this to the upstream repository.  

M config/ax_pthread.m4
M configure

Blacklist xlc 32-bit inlining.

commit   : c53f73879f552a3c7cc57d2d6a49d38cd80cf267    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:49:48 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:49:48 -0400    

Click here for diff

Per a suggestion from Tom Lane.  Back-patch to 9.0 (all supported  
versions).  While only 9.4 and up have code known to elicit this  
compiler bug, we were disabling inlining by accident until commit  
43d89a23d59c487bc9258fad7a6187864cb8c0c0.  

M config/test_quiet_include.h

Remove redundant "make install" from pg_upgrade test suite.

commit   : 021a56989aa5cbf10854ae3a0a17722e6ce1f9f9    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:49:36 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:49:36 -0400    

Click here for diff

A top-level "make install" includes pg_upgrade since commit  
9fa8b0ee90c44c0f97d16bf65e94322988c94864.  Back-patch to 9.5, where that  
commit first appeared.  

M src/bin/pg_upgrade/test.sh

MSVC: Revert most 9.5 changes to pre-9.5 vcregress.pl tests.

commit   : e6ea46c30ec9d086d3317d293b1e249f21e43fbc    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:48:56 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:48:56 -0400    

Click here for diff

The reverted changes did not narrow the semantic gap between the MSVC  
build system and the GNU make build system.  For targets old and new  
that run multiple suites (contribcheck, modulescheck, tapcheck), restore  
vcregress.pl to mimicking "make -k" rather than the "make -S" default.  
Lack of "-k" would be more burdensome than lack of "-S".  Keep changes  
reflecting contemporary changes to the GNU make build system, and keep  
updates to Makefile parsing.  Keep the loss of --psqldir in "check" and  
"ecpgcheck" targets; it had been a no-op when used alongside  
--temp-install.  No log message mentioned any of the reverted changes.  
Based on a germ by Michael Paquier.  Back-patch to 9.5.  

M src/tools/msvc/vcregress.pl

MSVC: Remove duplicate PATH entry in test harness.

commit   : d6ab14674d636490cec40c9dfc16104f380ced70    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:48:43 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:48:43 -0400    

Click here for diff

Back-patch to 9.5, where commit 4cb7d671fddc8855c8def2de51fb23df1c8ac0af  
introduced it.  

M src/tools/msvc/vcregress.pl

MSVC: Future-proof installation file skip logic.

commit   : d69252285c618cf2e4bf660dbae7c6f4d15e9ce4    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:48:25 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:48:25 -0400    

Click here for diff

This code relied on knowing exactly where in the source tree temporary  
installations might appear.  A reasonable hacker may not think to update  
this code when adding use of a temporary installation, making it  
fragile.  Observe that commit 9fa8b0ee90c44c0f97d16bf65e94322988c94864  
broke it unnoticed, and commit dcae5faccab64776376d354decda0017c648bb53  
fixed it unnoticed.  Back-patch to 9.5 only; use of temporary  
installations is unlikely to change in released versions.  

M src/tools/msvc/Install.pm

Add IF NOT EXISTS processing to ALTER TABLE ADD COLUMN

commit   : 2cd40adb85d1d5a7fd448721b326e73c1e318750    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 29 Jul 2015 21:30:00 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 29 Jul 2015 21:30:00 -0400    

Click here for diff

Fabrízio de Royes Mello, reviewed by Payal Singh, Alvaro Herrera and  
Michael Paquier.  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Create new ParseExprKind for use by policy expressions.

commit   : 632cd9f892119858bc5b617bb60c0377a8a2ed13    
  
author   : Joe Conway <[email protected]>    
date     : Wed, 29 Jul 2015 15:37:48 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Wed, 29 Jul 2015 15:37:48 -0700    

Click here for diff

Policy USING and WITH CHECK expressions were using EXPR_KIND_WHERE for  
parse analysis, which results in inappropriate ERROR messages when  
the expression contains unsupported constructs such as aggregates.  
Create a new ParseExprKind called EXPR_KIND_POLICY and tailor the  
related messages to fit.  
  
Reported by Noah Misch. Reviewed by Dean Rasheed, Alvaro Herrera,  
and Robert Haas. Back-patch to 9.5 where RLS was introduced.  

M src/backend/commands/policy.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_expr.c
M src/include/parser/parse_node.h
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Fix incorrect comment.

commit   : f04ce3147560de90d5250ae822d8d714b76f61cd    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Jul 2015 16:47:12 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Jul 2015 16:47:12 -0400    

Click here for diff

Amit Langote  

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

Flesh out the background worker documentation.

commit   : 38d4ce6b055ec7c26c421dcf1ced07e4d4220292    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Jul 2015 14:41:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Jul 2015 14:41:07 -0400    

Click here for diff

Make it more clear that bgw_main is usually not what you want.  Put the  
background worker flags in a variablelist rather than having them as  
part of a paragraph.  Explain important limits on how bgw_main_arg can  
be used.  
  
Craig Ringer, substantially revised by me.  

M doc/src/sgml/bgworker.sgml

Fix TAP tests with "make installcheck".

commit   : c7f0b28c7a67a8602c65d6b38d40b38d07548fbd    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 29 Jul 2015 20:59:24 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 29 Jul 2015 20:59:24 +0300    

Click here for diff

I neglected that the prove_installcheck rule also needs to also define  
PG_REGRESS, like prove_check does.  

M src/Makefile.global.in

Add some test coverage of EvalPlanQual with non-locked tables.

commit   : 342a1ffa2177c0b260b68d7891b0d04598a58432    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Jul 2015 13:27:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Jul 2015 13:27:15 -0400    

Click here for diff

A Salesforce colleague of mine griped that the regression tests don't  
exercise EvalPlanQualFetchRowMarks() and allied routines.  Which is  
a fair complaint.  Add test cases that go through the REFERENCE and COPY  
code paths.  Unfortunately we don't have sufficient infrastructure right  
now to exercise the FDW code path in the isolation tests, but this is  
surely better than before.  

M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

Add missing post create and alter hooks to policy objects.

commit   : efe72a82aa5e0d6f907a5d21f1a99b677f44f817    
  
author   : Joe Conway <[email protected]>    
date     : Wed, 29 Jul 2015 09:47:49 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Wed, 29 Jul 2015 09:47:49 -0700    

Click here for diff

AlterPolicy() and CreatePolicy() lacked their respective hook invocations.  
Noted by Noah Misch, review by Dean Rasheed. Back-patch to 9.5 where  
RLS was introduced.  

M src/backend/commands/policy.c

Make TAP tests work on Windows.

commit   : 13d856e177e69083f543d6383eeda9e12ce3c55c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 29 Jul 2015 19:17:02 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 29 Jul 2015 19:17:02 +0300    

Click here for diff

On Windows, use listen_address=127.0.0.1 to allow TCP connections. We were  
already using "pg_regress --config-auth" to set up HBA appropriately. The  
standard_initdb helper function now sets up the server's  
unix_socket_directories or listen_addresses in the config file, so that  
they don't need to be specified in the pg_ctl command line anymore. That  
way, the pg_ctl invocations in test programs don't need to differ between  
Windows and Unix.  
  
Add another helper function to configure the server's pg_hba.conf to allow  
replication connections. The configuration is done similarly to "pg_regress  
--config-auth": trust on domain sockets on Unix, and SSPI authentication on  
Windows.  
  
Replace calls to "cat" and "touch" programs with built-in perl code, as  
those programs don't normally exist on Windows.  
  
Add instructions in the docs on how to install IPC::Run on Windows. Adjust  
vcregress.pl to not replace PERL5LIB completely in vcregress.pl, because  
otherwise cannot install IPC::Run in a non-standard location easily.  
  
Michael Paquier, reviewed by Noah Misch, some additional tweaking by me.  

M doc/src/sgml/install-windows.sgml
M src/Makefile.global.in
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_rewind/RewindTest.pm
M src/test/perl/TestLib.pm
M src/tools/msvc/clean.bat
M src/tools/msvc/vcregress.pl

Document how to build the docs using the website style.

commit   : 5f1066074cd85b829371a4123839d16f52553c3d    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Jul 2015 11:16:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Jul 2015 11:16:55 -0400    

Click here for diff

Craig Ringer  

M doc/src/sgml/docguide.sgml

Remove outdated comment in LWLockDequeueSelf's header.

commit   : 3bc9356ddd52443e209fb60b94a2c29d66259d62    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 29 Jul 2015 10:13:10 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 29 Jul 2015 10:13:10 +0200    

Click here for diff

Noticed-By: Robert Haas  
Backpatch: 9.5, where the function was added  

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

Fix typo in comment.

commit   : a309ebd6b9940ca466c7748eeefc93c86ba2c9d4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 29 Jul 2015 10:55:43 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 29 Jul 2015 10:55:43 +0300    

Click here for diff

Amit Langote  

M src/backend/commands/tablecmds.c

pg_basebackup: Add --slot option

commit   : 0dc848b0314d63188919f1ce943730eac684dccd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Jul 2015 21:06:45 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Jul 2015 21:06:45 -0400    

Click here for diff

This option specifies a replication slot for WAL streaming (-X stream),  
so that there can be continuous replication slot use between WAL  
streaming during the base backup and the start of regular streaming  
replication.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/ref/pg_basebackup.sgml
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/test/perl/TestLib.pm

pg_basebackup: Add tests for -X option

commit   : 90102bb538831fca734cc9fa1450b97c7d4e1190    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 30 Jun 2015 21:15:29 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 30 Jun 2015 21:15:29 -0400    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/test/perl/TestLib.pm

pg_basebackup: Add tests for -R option

commit   : 36dc30aa7e0ab9628a5a975a921b8ff82e8f31bf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 30 Jun 2015 21:15:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 30 Jun 2015 21:15:05 -0400    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/test/perl/TestLib.pm

Prevent platform-dependent output row ordering in a new test query.

commit   : 5d0e8bc9e036bffb88b7598aa4d46b7368a10f0c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 20:00:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 20:00:13 -0400    

Click here for diff

Buildfarm indicates this is necessary.  

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

Suppress "variable may be used uninitialized" warning.

commit   : 2c698f438acc0b4ebc73b27da734e488a5a967cc    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 19:55:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 19:55:59 -0400    

Click here for diff

Also re-pgindent, just because I'm a neatnik.  

M src/backend/commands/policy.c

Disallow converting a table to a view if row security is present.

commit   : d824e2800f66f6180189d973c720611855c6f619    
  
author   : Joe Conway <[email protected]>    
date     : Tue, 28 Jul 2015 16:24:01 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Tue, 28 Jul 2015 16:24:01 -0700    

Click here for diff

When DefineQueryRewrite() is about to convert a table to a view, it checks  
the table for features unavailable to views.  For example, it rejects tables  
having triggers.  It omits to reject tables having relrowsecurity or a  
pg_policy record. Fix that. To faciliate the repair, invent  
relation_has_policies() which indicates the presence of policies on a  
relation even when row security is disabled for that relation.  
  
Reported by Noah Misch. Patch by me, review by Stephen Frost. Back-patch  
to 9.5 where RLS was introduced.  

M src/backend/commands/policy.c
M src/backend/rewrite/rewriteDefine.c
M src/include/commands/policy.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Create a pg_shdepend entry for each role in TO clause of policies.

commit   : f781a0f1d88411978c9df5f05cbb4f46aabe3d24    
  
author   : Joe Conway <[email protected]>    
date     : Tue, 28 Jul 2015 16:01:53 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Tue, 28 Jul 2015 16:01:53 -0700    

Click here for diff

CreatePolicy() and AlterPolicy() omit to create a pg_shdepend entry for  
each role in the TO clause. Fix this by creating a new shared dependency  
type called SHARED_DEPENDENCY_POLICY and assigning it to each role.  
  
Reported by Noah Misch. Patch by me, reviewed by Alvaro Herrera.  
Back-patch to 9.5 where RLS was introduced.  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/pg_shdepend.c
M src/backend/commands/policy.c
M src/include/catalog/dependency.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Update our documentation concerning where to create data directories.

commit   : 8c72a7fab47a7f501d211468d6e477e1f3a20599    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 18:42:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 18:42:59 -0400    

Click here for diff

Although initdb has long discouraged use of a filesystem mount-point  
directory as a PG data directory, this point was covered nowhere in the  
user-facing documentation.  Also, with the popularity of pg_upgrade,  
we really need to recommend that the PG user own not only the data  
directory but its parent directory too.  (Without a writable parent  
directory, operations such as "mv data data.old" fail immediately.  
pg_upgrade itself doesn't do that, but wrapper scripts for it often do.)  
  
Hence, adjust the "Creating a Database Cluster" section to address  
these points.  I also took the liberty of wordsmithing the discussion  
of NFS a bit.  
  
These considerations aren't by any means new, so back-patch to all  
supported branches.  

M doc/src/sgml/runtime.sgml

Only adjust negative indexes in json_get up to the length of the path.

commit   : 6d10f4e9d7f0051afb60c42409f2fe61cf4da348    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 28 Jul 2015 17:54:13 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 28 Jul 2015 17:54:13 -0400    

Click here for diff

The previous code resulted in memory access beyond the path bounds. The  
cure is to move it into a code branch that checks the value of lex_level  
is within the correct bounds.  
  
Bug reported and diagnosed by Piotr Stefaniak.  

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

Reduce chatter from signaling of autovacuum workers.

commit   : d8f15c95bec50f552ad0b13ea6eafb6975126184    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 17:34:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 17:34:00 -0400    

Click here for diff

Don't print a WARNING if we get ESRCH from a kill() that's attempting  
to cancel an autovacuum worker.  It's possible (and has been seen in the  
buildfarm) that the worker is already gone by the time we are able to  
execute the kill, in which case the failure is harmless.  About the only  
plausible reason for reporting such cases would be to help debug corrupted  
lock table contents, but this is hardly likely to be the most important  
symptom if that happens.  Moreover issuing a WARNING might scare users  
more than is warranted.  
  
Also, since sending a signal to an autovacuum worker is now entirely a  
routine thing, and the worker will log the query cancel on its end anyway,  
reduce the message saying we're doing that from LOG to DEBUG1 level.  
  
Very minor cosmetic cleanup as well.  
  
Since the main practical reason for doing this is to avoid unnecessary  
buildfarm failures, back-patch to all active branches.  

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

Bump catversion so that HEAD is beyond 9.5

commit   : 1e2bd43b31cdb6d0425430f1568814bce588d8fd    
  
author   : Joe Conway <[email protected]>    
date     : Tue, 28 Jul 2015 13:59:23 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Tue, 28 Jul 2015 13:59:23 -0700    

Click here for diff

As pointed out by Tom, since HEAD has progressed beyond 9.5 in terms of  
its catalog, we need to be sure catversion of HEAD is advanced beyond  
that of 9.5. Corrects my mistake in the pg_stats view commit cfa928ff.  

M src/include/catalog/catversion.h

commit   : 7b4bfc87d5e73c94ae1591c482f626a011498915    
  
author   : Joe Conway <[email protected]>    
date     : Tue, 28 Jul 2015 13:21:22 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Tue, 28 Jul 2015 13:21:22 -0700    

Click here for diff

The pg_stats view is supposed to be restricted to only show rows  
about tables the user can read. However, it sometimes can leak  
information which could not otherwise be seen when row level security  
is enabled. Fix that by not showing pg_stats rows to users that would  
be subject to RLS on the table the row is related to. This is done  
by creating/using the newly introduced SQL visible function,  
row_security_active().  
  
Along the way, clean up three call sites of check_enable_rls(). The second  
argument of that function should only be specified as other than  
InvalidOid when we are checking as a different user than the current one,  
as in when querying through a view. These sites were passing GetUserId()  
instead of InvalidOid, which can cause the function to return incorrect  
results if the current user has the BYPASSRLS privilege and row_security  
has been set to OFF.  
  
Additionally fix a bug causing RI Trigger error messages to unintentionally  
leak information when RLS is enabled, and other minor cleanup and  
improvements. Also add WITH (security_barrier) to the definition of pg_stats.  
  
Bumped CATVERSION due to new SQL functions and pg_stats view definition.  
  
Back-patch to 9.5 where RLS was introduced. Reported by Yaroslav.  
Patch by Joe Conway and Dean Rasheed with review and input by  
Michael Paquier and Stephen Frost.  

M doc/src/sgml/func.sgml
M src/backend/access/index/genam.c
M src/backend/catalog/system_views.sql
M src/backend/executor/execMain.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/rls.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/miscadmin.h
M src/include/utils/builtins.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/rowsecurity.sql

Remove ssl renegotiation support.

commit   : 426746b93093a0fef53b23ce4b6421bed28e5c60    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 28 Jul 2015 21:39:32 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 28 Jul 2015 21:39:32 +0200    

Click here for diff

While postgres' use of SSL renegotiation is a good idea in theory, it  
turned out to not work well in practice. The specification and openssl's  
implementation of it have lead to several security issues. Postgres' use  
of renegotiation also had its share of bugs.  
  
Additionally OpenSSL has a bunch of bugs around renegotiation, reported  
and open for years, that regularly lead to connections breaking with  
obscure error messages. We tried increasingly complex workarounds to get  
around these bugs, but we didn't find anything complete.  
  
Since these connection breakages often lead to hard to debug problems,  
e.g. spuriously failing base backups and significant latency spikes when  
synchronous replication is used, we have decided to change the default  
setting for ssl renegotiation to 0 (disabled) in the released  
backbranches and remove it entirely in 9.5 and master.  
  
Author: Andres Freund  
Discussion: [email protected]  
Backpatch: 9.5 and master, 9.0-9.4 get a different patch  

M doc/src/sgml/config.sgml
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/libpq/libpq-be.h

Make tap tests store postmaster logs and handle vpaths correctly

commit   : 01f6bb4b2dcc571ad0cc6a404595de4b03157534    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 28 Jul 2015 15:34:35 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 28 Jul 2015 15:34:35 -0400    

Click here for diff

Given this it is possible that the buildfarm animals running these tests  
will be able to capture adequate logging to allow diagnosis of failures.  

M src/Makefile.global.in
M src/bin/pg_rewind/RewindTest.pm
M src/test/perl/TestLib.pm

Centralize decision-making about where to get a backend's PGPROC.

commit   : 6f2871f12e9fba5deec4296cfe12e85c140261c4    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 28 Jul 2015 14:51:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 28 Jul 2015 14:51:57 -0400    

Click here for diff

This code was originally written as part of parallel query effort, but  
it seems to have independent value, because if we make one decision  
about where to get a PGPROC when we allocate and then put it back on a  
different list at backend-exit time, bad things happen.  This isn't  
just a theoretical risk; we fixed an actual problem of this type in  
commit e280c630a87e1b8325770c6073097d109d79a00f.  

M src/backend/storage/lmgr/proc.c
M src/include/storage/proc.h

Remove an unsafe Assert, and explain join_clause_is_movable_into() better.

commit   : 95f4e59c3286671656aff7db45b322f14a7bb8cc    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 13:20:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 13:20:39 -0400    

Click here for diff

join_clause_is_movable_into() is approximate, in the sense that it might  
sometimes return "false" when actually it would be valid to push the given  
join clause down to the specified level.  This is okay ... but there was  
an Assert in get_joinrel_parampathinfo() that's only safe if the answers  
are always exact.  Comment out the Assert, and add a bunch of commentary  
to clarify what's going on.  
  
Per fuzz testing by Andreas Seltenreich.  The added regression test is  
a pretty silly query, but it's based on his crasher example.  
  
Back-patch to 9.2 where the faulty logic was introduced.  

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

Fix bug in collecting total_latencies from all threads in pgbench.

commit   : b2ed8edeecd715c8a23ae462da843578e5cde7f4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 28 Jul 2015 11:30:23 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 28 Jul 2015 11:30:23 +0300    

Click here for diff

This was broken in 1bc90f7a, which removed the thread-emulation. With modest  
-j and -c settings the result were usually close enough that you wouldn't  
notice it easily, but with a high enough thread count it would access  
uninitialized memory and crash.  
  
Per report from Andres Freund offlist.  

M src/bin/pgbench/pgbench.c

Another attempt at fixing memory leak in xlogreader.

commit   : 5e65f45c6eff8278e2901511da61d3a265adc874    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 28 Jul 2015 09:05:46 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 28 Jul 2015 09:05:46 +0300    

Click here for diff

max_block_id is also reset between reading records.  
  
Michael Paquier  

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

Fix pg_dump output of policies.

commit   : e0d4a290f4a24b0a0a46af4d0f8551f8ee5e5513    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 27 Jul 2015 20:24:18 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 27 Jul 2015 20:24:18 -0700    

Click here for diff

pg_dump neglected to wrap parenthesis around USING and WITH CHECK  
expressions -- fixed. Reported by Noah Misch.  

M src/bin/pg_dump/pg_dump.c

Improve RLS handling in copy.c

commit   : 3d5cb31c9a17bad8bbc587c09404b2aa1e6c3aac    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 27 Jul 2015 16:48:26 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 27 Jul 2015 16:48:26 -0400    

Click here for diff

To avoid a race condition where the relation being COPY'd could be  
changed into a view or otherwise modified, keep the original lock  
on the relation.  Further, fully qualify the relation when building  
the query up.  
  
Also remove the poorly thought-out Assert() and check the entire  
relationOids list as, post-RLS, there can certainly be multiple  
relations involved and the planner does not guarantee their ordering.  
  
Per discussion with Noah and Andres.  
  
Back-patch to 9.5 where RLS was introduced.  

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

Further code review for pg_stat_ssl patch.

commit   : 4c8f8ffaca42bb5678a0858ce56f9a384c21c583    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Jul 2015 16:29:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Jul 2015 16:29:14 -0400    

Click here for diff

Fix additional bogosity in commit 9029f4b37406b21a.  Include the  
BackendSslStatusBuffer in the BackendStatusShmemSize calculation,  
avoid ugly and error-prone casts to char* and back, put related  
code stanzas into a consistent order (and fix a couple of previous  
instances of that sin).  All cosmetic except for the size oversight.  

M src/backend/postmaster/pgstat.c

Fix pointer-arithmetic thinko in pg_stat_ssl patch.

commit   : 7d791ed49be28f2dfdd31e262dc35c4595718267    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Jul 2015 15:58:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Jul 2015 15:58:46 -0400    

Click here for diff

Nasty memory-stomp bug in commit 9029f4b37406b21a.  It's not apparent how  
this survived even cursory testing :-(.  Per report from Peter Holzer.  

M src/backend/postmaster/pgstat.c

Don't assume that 'char' is signed.

commit   : 5533a272ddecff18f16e9b6c307dcb2e130538f4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 21:48:51 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 21:48:51 +0300    

Click here for diff

On some platforms, notably ARM and PowerPC, 'char' is unsigned by  
default. This fixes an assertion failure at WAL replay on such platforms.  
  
Reported by Noah Misch. Backpatch to 9.5, where this was broken.  

M src/include/access/spgist_private.h

Fix memory leaks in pg_rewind. Several PQclear() calls were missing.

commit   : d7fd22a38ff48372c6813983317fc8d1e07fcf87    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 20:38:44 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 20:38:44 +0300    

Click here for diff

Originally reported by Vladimir Borodin in the pg_rewind github project,  
patch by Michael Paquier.  

M src/bin/pg_rewind/libpq_fetch.c

Don't assume that PageIsEmpty() returns true on an all-zeros page.

commit   : 820d1ced1b308702b3f811647810b4030f974d89    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 18:54:09 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 18:54:09 +0300    

Click here for diff

It does currently, and I don't see us changing that any time soon, but we  
don't make that assumption anywhere else.  
  
Per Tom Lane's suggestion. Backpatch to 9.2, like the previous patch that  
added this assumption.  

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

Fix memory leak in xlogreader facility.

commit   : 61a65c53bd3e48e7ff7661a528d1791dfd956957    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 18:27:27 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 18:27:27 +0300    

Click here for diff

XLogReaderFree failed to free the per-block data buffers, when they  
happened to not be used by the latest read WAL record.  
  
Michael Paquier. Backpatch to 9.5, where the per-block buffers were added.  

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

Reuse all-zero pages in GIN.

commit   : 334445179c82ba304480ecbd00ae4237587e4baf    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 12:30:26 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 12:30:26 +0300    

Click here for diff

In GIN, an all-zeros page would be leaked forever, and never reused. Just  
add them to the FSM in vacuum, and they will be reinitialized when grabbed  
from the FSM. On master and 9.5, attempting to access the page's opaque  
struct also caused an assertion failure, although that was otherwise  
harmless.  
  
Reported by Jeff Janes. Backpatch to all supported versions.  

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

Fix handling of all-zero pages in SP-GiST vacuum.

commit   : 023430abf72eb7d335430e241065d5ed19ddd94b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 12:28:21 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 12:28:21 +0300    

Click here for diff

SP-GiST initialized an all-zeros page at vacuum, but that was not  
WAL-logged, which is not safe. You might get a torn page write, when it gets  
flushed to disk, and end-up with a half-initialized index page. To fix,  
leave it in the all-zeros state, and add it to the FSM. It will be  
initialized when reused. Also don't set the page-deleted flag when recycling  
an empty page. That was also not WAL-logged, and a torn write of that would  
cause the page to have an invalid checksum.  
  
Backpatch to 9.2, where SP-GiST indexes were added.  

M src/backend/access/spgist/spgvacuum.c
M src/include/access/spgist_private.h

Avoid calling PageGetSpecialPointer() on an all-zeros page.

commit   : 65c384c5abee7df6d27f98135790ea24c1b9578b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 12:24:27 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 12:24:27 +0300    

Click here for diff

That was otherwise harmless, but tripped the new assertion in  
PageGetSpecialPointer().  
  
Reported by Amit Langote. Backpatch to 9.5, where the assertion was added.  

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

Remove false comment about speculative insertion.

commit   : e3a9a194b7cb70a8c01deeff9f876a2631f1be06    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 11:46:11 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 11:46:11 +0300    

Click here for diff

There is no full discussion of speculative insertions in the executor  
README. There is a high-level explanation in execIndexing.c, but it doesn't  
seem necessary to refer it from here.  
  
Peter Geoghegan  

M src/backend/executor/nodeModifyTable.c

Fix oversight in flattening of subqueries with empty FROM.

commit   : fca8e59c1c582030dd7a3c870e1c3c70e8a193aa    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Jul 2015 17:44:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Jul 2015 17:44:27 -0400    

Click here for diff

I missed a restriction that commit f4abd0241de20d5d6a79b84992b9e88603d44134  
should have enforced: we can't pull up an empty-FROM subquery if it's under  
an outer join, because then we'd need to wrap its output columns in  
PlaceHolderVars.  As the code currently stands, the PHVs end up with empty  
relid sets, which doesn't work (and is correctly caught by an Assert).  
  
It's possible that this could be fixed by assigning the PHVs the relid  
sets of the parent FromExpr/JoinExpr, but getting that to work is more  
complication than I care to add right now; indeed it's likely that  
we'll never bother, since pulling up empty-FROM subqueries is a rather  
marginal optimization anyway.  
  
Per report from Andreas Seltenreich.  Back-patch to 9.5 where the faulty  
code was added.  

M src/backend/optimizer/prep/prepjointree.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Make entirely-dummy appendrels get marked as such in set_append_rel_size.

commit   : 358eaa01bf95935f9af968faf5b08d9914f6a445    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Jul 2015 16:19:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Jul 2015 16:19:08 -0400    

Click here for diff

The planner generally expects that the estimated rowcount of any relation  
is at least one row, *unless* it has been proven empty by constraint  
exclusion or similar mechanisms, which is marked by installing a dummy path  
as the rel's cheapest path (cf. IS_DUMMY_REL).  When I split up  
allpaths.c's processing of base rels into separate set_base_rel_sizes and  
set_base_rel_pathlists steps, the intention was that dummy rels would get  
marked as such during the "set size" step; this is what justifies an Assert  
in indxpath.c's get_loop_count that other relations should either be dummy  
or have positive rowcount.  Unfortunately I didn't get that quite right  
for append relations: if all the child rels have been proven empty then  
set_append_rel_size would come up with a rowcount of zero, which is  
correct, but it didn't then do set_dummy_rel_pathlist.  (We would have  
ended up with the right state after set_append_rel_pathlist, but that's  
too late, if we generate indexpaths for some other rel first.)  
  
In addition to fixing the actual bug, I installed an Assert enforcing this  
convention in set_rel_size; that then allows simplification of a couple  
of now-redundant tests for zero rowcount in set_append_rel_size.  
  
Also, to cover the possibility that third-party FDWs have been careless  
about not returning a zero rowcount estimate, apply clamp_row_est to  
whatever an FDW comes up with as the rows estimate.  
  
Per report from Andreas Seltenreich.  Back-patch to 9.2.  Earlier branches  
did not have the separation between set_base_rel_sizes and  
set_base_rel_pathlists steps, so there was no intermediate state where an  
appendrel would have had inconsistent rowcount and pathlist.  It's possible  
that adding the Assert to set_rel_size would be a good idea in older  
branches too; but since they're not under development any more, it's likely  
not worth the trouble.  

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

Check the relevant index element in ON CONFLICT unique index inference.

commit   : 159cff58cf3b565be3c17901698a74238e9e23f8    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 18:20:41 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 18:20:41 +0200    

Click here for diff

ON CONFLICT unique index inference had a thinko that could affect cases  
where the user-supplied inference clause required that an attribute  
match a particular (user specified) collation and/or opclass.  
  
infer_collation_opclass_match() has to check for opclass and/or  
collation matches and that the attribute is in the list of attributes or  
expressions known to be in the definition of the index under  
consideration. The bug was that these two conditions weren't necessarily  
evaluated for the same index attribute.  
  
Author: Peter Geoghegan  
Discussion: CAM3SWZR4uug=WvmGk7UgsqHn2MkEzy9YU-+8jKGO4JPhesyeWg@mail.gmail.com  
Backpatch: 9.5, where ON CONFLICT was introduced  

M src/backend/optimizer/util/plancat.c
M src/test/regress/expected/insert_conflict.out
M src/test/regress/sql/insert_conflict.sql

Fix flattening of nested grouping sets.

commit   : faab14ecb8c1b4ea2bee3723d4fa04f47275abd3    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 16:37:49 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 16:37:49 +0200    

Click here for diff

Previously nested grouping set specifications accidentally weren't  
flattened, but instead contained the nested specification as a element  
in the outer list.  
  
Fix this by, as actually documented in comments, concatenating the  
nested set specification into the outer one. Also add tests to prevent  
this from breaking again.  
  
Author: Andrew Gierth, with tests from Jeevan Chalke  
Reported-By: Jeevan Chalke  
Discussion: CAM2+6=V5YvuxB+EyN4iH=GbD-XTA435TCNvnDFSD--YvXs+pww@mail.gmail.com  
Backpatch: 9.5, where grouping sets were introduced  

M src/backend/parser/parse_clause.c
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/groupingsets.sql

Allow to push down clauses from HAVING to WHERE when grouping sets are used.

commit   : 61444bfb809d3a088a270a59f383af3d4cd157b0    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 15:56:26 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 15:56:26 +0200    

Click here for diff

Previously we disallowed pushing down quals to WHERE in the presence of  
grouping sets. That's overly restrictive.  
  
We now instead copy quals to WHERE if applicable, leaving the  
one in HAVING in place. That's because, at that stage of the planning  
process, it's nontrivial to determine if it's safe to remove the one in  
HAVING.  
  
Author: Andrew Gierth  
Discussion: [email protected]  
Backpatch: 9.5, where grouping sets were introduced. This isn't exactly  
    a bugfix, but it seems better to keep the branches in sync at this point.  

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

Recognize GROUPING() as a aggregate expression.

commit   : e6d8cb77c029b8122607e3d2eb1f3fca36d7b1db    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 15:34:29 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 15:34:29 +0200    

Click here for diff

Previously GROUPING() was not recognized as a aggregate expression,  
erroneously allowing the planner to move it from HAVING to WHERE.  
  
Author: Jeevan Chalke  
Reviewed-By: Andrew Gierth  
Discussion: CAM2+6=WG9omG5rFOMAYBweJxmpTaapvVp5pCeMrE6BfpCwr4Og@mail.gmail.com  
Backpatch: 9.5, where grouping sets were introduced  

M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/groupingsets.sql

Build column mapping for grouping sets in all required cases.

commit   : 144666f65b500fef864bca318f6245b03c0f457c    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 15:17:44 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 15:17:44 +0200    

Click here for diff

The previous coding frequently failed to fail because for one it's  
unusual to have rollup clauses with one column, and for another  
sometimes the wrong mapping didn't cause obvious problems.  
  
Author: Jeevan Chalke  
Reviewed-By: Andrew Gierth  
Discussion: CAM2+6=W=9=hQOipH0HAPbkun3Z3TFWij_EiHue0_6UX=oR=1kw@mail.gmail.com  
Backpatch: 9.5, where grouping sets were introduced  

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

Improve markup for row_security.

commit   : cf80ddee57103bb3b454c1607d100a4551d7a48c    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 25 Jul 2015 17:46:04 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 25 Jul 2015 17:46:04 -0700    

Click here for diff

Wrap the literals on, off, force, and BYPASSRLS with appropriate  
markup. Per Kevin Grittner.  

M doc/src/sgml/config.sgml

Dodge portability issue (apparent compiler bug) in new tablesample code.

commit   : d9476b83808a39d9985845071bf0a150a3063b37    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 19:42:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 19:42:32 -0400    

Click here for diff

Some of the older OS X critters in the buildfarm are failing regression,  
with symptoms showing that a request for 100% sampling in BERNOULLI or  
SYSTEM methods actually gets only around 50% of the table.  gdb revealed  
that the computation of the "cutoff" number was producing 0x7FFFFFFF  
rather than the expected 0x100000000.  Inspecting the assembly code,  
it looks like gcc is trying to use lrint() instead of rint() and then  
fumbling the conversion from long double to uint64.  This seems like a  
clear compiler bug, but assigning the intermediate result into a plain  
double variable works around it, so let's just do that.  (Another idea  
would be to give up one bit of hash width so that we don't need to use  
a uint64 cutoff, but let's see if this is enough.)  

M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c

Restore use of zlib default compression in pg_dump directory mode.

commit   : caef94d59fcfa1087be36d4a8b5ed4523872bf55    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 25 Jul 2015 17:14:36 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 25 Jul 2015 17:14:36 -0400    

Click here for diff

This was broken by commit 0e7e355f27302b62af3e1add93853ccd45678443 and  
friends, which ignored the fact that gzopen() will treat "-1" in the  
mode argument as an invalid character, which it ignores, and a flag for  
compression level 1. Now, when this value is encountered no compression  
level flag is passed  to gzopen, leaving it to use the zlib default.  
  
Also, enforce the documented allowed range for pg_dump's -Z option,  
namely 0 .. 9, and remove some consequently dead code from  
pg_backup_tar.c.  
  
Problem reported by Marc Mamin.  
  
Backpatch to 9.1, like the patch that introduced the bug.  

M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c

Some platforms now need contrib/tsm_system_time to be linked with libm.

commit   : c879d51c5918ab5fc8feb9624aa4eae10ee93094    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 16:37:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 16:37:12 -0400    

Click here for diff

Buildfarm member hornet, at least, seems to want -lm in the link command.  
Probably this is due to the just-added use of isnan().  

M contrib/tsm_system_time/Makefile

In pg_ctl, report unexpected failure to stat() the postmaster.pid file.

commit   : b7b5a1899aa3caeef30117f8e36c1f0e68e8847a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 15:58:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 15:58:14 -0400    

Click here for diff

Any error other than ENOENT is a bit suspicious here, and perhaps should  
not be grounds for assuming the postmaster has failed.  For the moment  
though, just report it, and don't change the behavior otherwise.  The  
intent is mainly to try to determine why we are seeing intermittent  
failures in this area on some buildfarm members.  
  
Back-patch to 9.5 where some of these failures have happened.  

M src/bin/pg_ctl/pg_ctl.c

Update oidjoins regression test for 9.5.

commit   : 158d61534e98638106d85bdb1de5dbdb56bc8057    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 15:46:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 15:46:26 -0400    

Click here for diff

New FK relationships for pg_transform.  Also findoidjoins now detects a few  
relationships it didn't before for pre-existing catalogs, as a result of  
new regression tests leaving entries in those catalogs that weren't there  
before.  

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

Redesign tablesample method API, and do extensive code review.

commit   : dd7a8f66ed278eef2f001a98e2312336c61ee527    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 14:39:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 14:39:00 -0400    

Click here for diff

The original implementation of TABLESAMPLE modeled the tablesample method  
API on index access methods, which wasn't a good choice because, without  
specialized DDL commands, there's no way to build an extension that can  
implement a TSM.  (Raw inserts into system catalogs are not an acceptable  
thing to do, because we can't undo them during DROP EXTENSION, nor will  
pg_upgrade behave sanely.)  Instead adopt an API more like procedural  
language handlers or foreign data wrappers, wherein the only SQL-level  
support object needed is a single handler function identified by having  
a special return type.  This lets us get rid of the supporting catalog  
altogether, so that no custom DDL support is needed for the feature.  
  
Adjust the API so that it can support non-constant tablesample arguments  
(the original coding assumed we could evaluate the argument expressions at  
ExecInitSampleScan time, which is undesirable even if it weren't outright  
unsafe), and discourage sampling methods from looking at invisible tuples.  
Make sure that the BERNOULLI and SYSTEM methods are genuinely repeatable  
within and across queries, as required by the SQL standard, and deal more  
honestly with methods that can't support that requirement.  
  
Make a full code-review pass over the tablesample additions, and fix  
assorted bugs, omissions, infelicities, and cosmetic issues (such as  
failure to put the added code stanzas in a consistent ordering).  
Improve EXPLAIN's output of tablesample plans, too.  
  
Back-patch to 9.5 so that we don't have to support the original API  
in production.  

M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/tsm_system_rows/Makefile
M contrib/tsm_system_rows/expected/tsm_system_rows.out
M contrib/tsm_system_rows/sql/tsm_system_rows.sql
M contrib/tsm_system_rows/tsm_system_rows–1.0.sql
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_rows/tsm_system_rows.control
M contrib/tsm_system_time/Makefile
M contrib/tsm_system_time/expected/tsm_system_time.out
M contrib/tsm_system_time/sql/tsm_system_time.sql
M contrib/tsm_system_time/tsm_system_time–1.0.sql
M contrib/tsm_system_time/tsm_system_time.c
M contrib/tsm_system_time/tsm_system_time.control
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/tablesample-method.sgml
M doc/src/sgml/tsm-system-rows.sgml
M doc/src/sgml/tsm-system-time.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/tablesample/Makefile
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c
M src/backend/access/tablesample/tablesample.c
M src/backend/catalog/Makefile
M src/backend/catalog/dependency.c
M src/backend/commands/explain.c
M src/backend/executor/execAmi.c
M src/backend/executor/nodeSamplescan.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/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_func.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/errcodes.txt
M src/backend/utils/misc/sampling.c
M src/bin/psql/tab-complete.c
M src/include/access/heapam.h
D src/include/access/tablesample.h
A src/include/access/tsmapi.h
M src/include/catalog/catversion.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_proc.h
D src/include/catalog/pg_tablesample_method.h
M src/include/catalog/pg_type.h
M src/include/executor/nodeSamplescan.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/cost.h
M src/include/parser/parse_func.h
M src/include/port.h
M src/include/utils/builtins.h
M src/include/utils/lsyscache.h
M src/include/utils/syscache.h
M src/port/erand48.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/tablesample.out
M src/test/regress/output/misc.source
M src/test/regress/serial_schedule
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/tablesample.sql

Make RLS work with UPDATE ... WHERE CURRENT OF

commit   : b26e3d660df51a088d14c3c2cfce5990c13c1195    
  
author   : Joe Conway <[email protected]>    
date     : Fri, 24 Jul 2015 12:55:30 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Fri, 24 Jul 2015 12:55:30 -0700    

Click here for diff

UPDATE ... WHERE CURRENT OF would not work in conjunction with  
RLS. Arrange to allow the CURRENT OF expression to be pushed down.  
Issue noted by Peter Geoghegan. Patch by Dean Rasheed. Back patch  
to 9.5 where RLS was introduced.  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Fix treatment of nulls in jsonb_agg and jsonb_object_agg

commit   : d9a356ff2e6bb7ed5fb1145af49fa3e51e68a98a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 24 Jul 2015 09:40:46 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 24 Jul 2015 09:40:46 -0400    

Click here for diff

The wrong is_null flag was being passed to datum_to_json. Also, null  
object key values are not permitted, and this was not being checked  
for. Add regression tests covering these cases, and also add those tests  
to the json set, even though it was doing the right thing.  
  
Fixes bug #13514, initially diagnosed by Tom Lane.  

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

Fix bug around assignment expressions containing indirections.

commit   : c1ca3a19df376bcbb6d651d15b9a4ffcaa377ff1    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 24 Jul 2015 11:48:53 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 24 Jul 2015 11:48:53 +0200    

Click here for diff

Handling of assigned-to expressions with indirection (e.g. set f1[1] =  
3) was broken for ON CONFLICT DO UPDATE.  The problem was that  
ParseState was consulted to determine if an INSERT-appropriate or  
UPDATE-appropriate behavior should be used when transforming expressions  
with indirections. When the wrong path was taken the old row was  
substituted with NULL, leading to wrong results..  
  
To fix remove p_is_update and only use p_is_insert to decide how to  
transform the assignment expression, and uset p_is_insert while parsing  
the on conflict statement. This isn't particularly pretty, but it's not  
any worse than before.  
  
Author: Peter Geoghegan, slightly edited by me  
Discussion: CAM3SWZS8RPvA=KFxADZWw3wAHnnbxMxDzkEC6fNaFc7zSm411w@mail.gmail.com  
Backpatch: 9.5, where the feature was introduced  

M src/backend/parser/analyze.c
M src/include/parser/parse_node.h
M src/test/regress/expected/arrays.out
M src/test/regress/sql/arrays.sql

Redirect install output of make check into a log file

commit   : 16c33c50e122e3e7d03fc7ddd5cbd105c0118234    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 23 Jul 2015 09:44:20 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 23 Jul 2015 09:44:20 -0400    

Click here for diff

dbf2ec1a changed make check so that the installation logs get directed  
to stdout and stderr. Per discussion on -hackers, this patch restores  
saving it to a file. It is now saved in /tmp_install/log, which is  
created once per invocation of any make target doing regression tests.  
  
Along the way, add a missing /log/ entry to test_ddl_deparse's  
.gitignore.  
  
Michael Paquier.  

M src/Makefile.global.in
M src/test/modules/test_ddl_deparse/.gitignore

Fix off-by-one error in calculating subtrans/multixact truncation point.

commit   : 766dcfb16ca385274d510eaed01724bb3836efdd    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 23 Jul 2015 01:29:59 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 23 Jul 2015 01:29:59 +0300    

Click here for diff

If there were no subtransactions (or multixacts) active, we would calculate  
the oldestxid == next xid. That's correct, but if next XID happens to be  
on the next pg_subtrans (pg_multixact) page, the page does not exist yet,  
and SimpleLruTruncate will produce an "apparent wraparound" warning. The  
warning is harmless in this case, but looks very alarming to users.  
  
Backpatch to all supported versions. Patch and analysis by Thomas Munro.  

M src/backend/access/transam/multixact.c
M src/backend/access/transam/subtrans.c

Fix add_rte_to_flat_rtable() for recent feature additions.

commit   : 46d0a9bfac3d5221702318cc1cf119221d729c84    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Jul 2015 20:03:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Jul 2015 20:03:58 -0400    

Click here for diff

The TABLESAMPLE and row security patches each overlooked this function,  
though their errors of omission were opposite: RLS failed to zero out the  
securityQuals field, leading to wasteful copying of useless expression  
trees in finished plans, while TABLESAMPLE neglected to add a comment  
saying that it intentionally *isn't* deleting the tablesample subtree.  
There probably should be a similar comment about ctename, too.  
  
Back-patch as appropriate.  

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

Add selectivity estimation functions for intarray operators.

commit   : c6fbe6d6fb828f50b9d67627588eb5ab8bd25e47    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 21 Jul 2015 20:54:18 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 21 Jul 2015 20:54:18 +0300    

Click here for diff

Uriy Zhuravlev and Alexander Korotkov, reviewed by Jeff Janes, some cleanup  
by me.  

M contrib/intarray/Makefile
A contrib/intarray/_int_selfuncs.c
M contrib/intarray/expected/_int.out
A contrib/intarray/intarray–1.0–1.1.sql
R088 contrib/intarray/intarray–1.0.sql contrib/intarray/intarray–1.1.sql
M contrib/intarray/intarray.control
M contrib/intarray/sql/_int.sql

Fix some oversights in BRIN patch.

commit   : 434873806a9b1c0edd53c2a9df7c93a8ba021147    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Jul 2015 13:38:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Jul 2015 13:38:24 -0400    

Click here for diff

Remove HeapScanDescData.rs_initblock, which wasn't being used for anything  
in the final version of the patch.  
  
Fix IndexBuildHeapScan so that it supports syncscan again; the patch  
broke synchronous scanning for index builds by forcing rs_startblk  
to zero even when the caller did not care about that and had asked  
for syncscan.  
  
Add some commentary and usage defenses to heap_setscanlimits().  
  
Fix heapam so that asking for rs_numblocks == 0 does what you would  
reasonably expect.  As coded it amounted to requesting a whole-table  
scan, because those "--x <= 0" tests on an unsigned variable would  
behave surprisingly.  

M src/backend/access/heap/heapam.c
M src/backend/catalog/index.c
M src/include/access/relscan.h

Fix location of output logs of pg_regress

commit   : 9faa6ae14f6098e4b55f0131f7ec2694a381fb87    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 21 Jul 2015 09:53:16 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 21 Jul 2015 09:53:16 -0400    

Click here for diff

initdb.log and postmaster.log were moved to within the temporary instance  
path by commit dcae5fa. This directory now gets removed at the end  
of the run of pg_regress when there are no failures found, which makes  
analysis of after-run issues difficult in some cases, and reduces the  
output verbosity of the buildfarm after a run.  
  
Fix by Michael Paquier  
  
Backpatch to 9.5  

M src/test/regress/pg_regress.c

Fix omission of OCLASS_TRANSFORM in object_classes[]

commit   : 149b1dd84069a9b57962fdb4621754aed5dfb63e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Jul 2015 13:20:53 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Jul 2015 13:20:53 +0200    

Click here for diff

This was forgotten in cac76582053e (and its fixup ad89a5d115).  Since it  
seems way too easy to miss this, this commit also introduces a mechanism  
to enforce that the array is consistent with the enum.  
  
Problem reported independently by Robert Haas and Jaimin Pan.  
Patches proposed by Jaimin Pan, Jim Nasby, Michael Paquier and myself,  
though I didn't use any of these and instead went with a cleaner  
approach suggested by Tom Lane.  
  
Backpatch to 9.5.  
  
Discussion:  
https://www.postgresql.org/message-id/CA+Tgmoa6SgDaxW_n_7SEhwBAc=mniYga+obUj5fmw4rU9_mLvA@mail.gmail.com  
https://www.postgresql.org/message-id/[email protected]  

M src/backend/catalog/dependency.c
M src/backend/commands/event_trigger.c
M src/include/catalog/dependency.h

Sanity-check that a page zeroed by redo routine is marked with WILL_INIT.

commit   : eb11de8ff5eac3592d539ad7ca3059c02e4d3e99    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 20 Jul 2015 16:02:28 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 20 Jul 2015 16:02:28 +0300    

Click here for diff

There was already a sanity-check in the other direction: if a page was  
marked with WILL_INIT, it had to be initialized by the redo routine. It's  
not strictly necessary for correctness that a page is marked with WILL_INIT  
if it's going to be initialized at redo, but it's a missed optimization if  
nothing else.  
  
Fix a few instances of this issue in SP-GiST, where a block in WAL record  
was not marked with WILL_INIT, but was in fact always initialized at redo.  
We were creating a full-page image of the page unnecessarily in those  
cases.  
  
Backpatch to 9.5, where the new WILL_INIT flag was added.  

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

Don't handle PUBLIC/NONE separately

commit   : e52b690cf55f303839f12f8f1f136d2366d36298    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 18:47:15 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 18:47:15 +0200    

Click here for diff

Since those role specifiers are checked in the grammar, there's no need  
for the old checks to remain in place after 31eae6028ec.  Remove them.  
  
Backpatch to 9.5.  
  
Noted and patch by Jeevan Chalke  

M src/backend/commands/user.c

This supports the triconsistent function for pg_trgm GIN opclass to make it faster to implement indexed queries where some keys are common and some are rare.

commit   : 97f3014647a5bd570032abd2b809d3233003f13f    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 20 Jul 2015 18:18:48 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 20 Jul 2015 18:18:48 +0300    

Click here for diff

Patch by Jeff Janes  

M contrib/pg_trgm/Makefile
A contrib/pg_trgm/pg_trgm–1.1–1.2.sql
R092 contrib/pg_trgm/pg_trgm–1.1.sql contrib/pg_trgm/pg_trgm–1.2.sql
M contrib/pg_trgm/pg_trgm.control
M contrib/pg_trgm/trgm_gin.c

Improve tab-completion for DROP POLICY

commit   : 1a5118008003b3c42f5cbb37980dabdb6a718e6f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 15:37:17 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 15:37:17 +0200    

Click here for diff

Backpatch to 9.5.  
  
Author: Pavel Stěhule  

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

Fix (some of) pltcl memory usage

commit   : f8d67ca8d4cbbbd6c6b3319d531089880d332534    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 19 Jul 2015 12:26:14 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 19 Jul 2015 12:26:14 +0200    

Click here for diff

As reported by Bill Parker, PL/Tcl did not validate some malloc() calls  
against NULL return.  Fix by using palloc() in a new long-lived memory  
context instead.  This allows us to simplify error handling too, by  
simply deleting the memory context instead of doing retail frees.  
  
There's still a lot that could be done to improve PL/Tcl's memory  
handling ...  
  
This is pretty ancient, so backpatch all the way back.  
  
Author: Michael Paquier and Álvaro Herrera  
Discussion: https://www.postgresql.org/message-id/CAFrbyQwyLDYXfBOhPfoBGqnvuZO_Y90YgqFM11T2jvnxjLFmqw@mail.gmail.com  

M src/pl/tcl/pltcl.c

Improve BRIN documentation somewhat

commit   : 8d9073692430a222939e7f2e436c80f0c271f116    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 12:16:40 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 12:16:40 +0200    

Click here for diff

This removes some info about support procedures being used, which was  
obsoleted by commit db5f98ab4f, as well as add some more documentation  
on how to create new opclasses using the Minmax infrastructure.  
(Hopefully we can get something similar for Inclusion as well.)  
  
In passing, fix some obsolete mentions of "mmtuples" in source code  
comments.  
  
Backpatch to 9.5, where BRIN was introduced.  

M doc/src/sgml/brin.sgml
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_xlog.c

Fix mis-merge in previous commit

commit   : b7ca57ac0e80b8b511780ef1f19fa2124c901efb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 11:59:31 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 11:59:31 +0200    

Click here for diff

M src/test/modules/test_ddl_deparse/test_ddl_deparse.c

Add some comments to test_ddl_deparse and a README

commit   : 8f612b7f0042a33f59cd4a18144b4d74e78b6859    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 11:20:40 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 11:20:40 +0200    

Click here for diff

Per comments from Heikki Linnakangas.  
  
Backpatch to 9.5, where this module was introduced.  

A src/test/modules/test_ddl_deparse/README
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c

Handle AT_ReAddComment in test_ddl_deparse, and add a catch-all default.

commit   : 13f2db2ffb2fac24fcb57ecc56e030e1145df127    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 20 Jul 2015 10:19:22 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 20 Jul 2015 10:19:22 +0300    

Click here for diff

In the passing, also move AT_ReAddComment to more logical position in the  
enum, after all the Constraint-related subcommands.  
  
This fixes a compiler warning, added by commit e42375fc. Backpatch to 9.5,  
like that patch.  

M src/include/nodes/parsenodes.h
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c

Remove dead code.

commit   : 9aa663463bbf123e9d38dab88eeaef981fbc6caf    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 19 Jul 2015 13:19:38 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 19 Jul 2015 13:19:38 -0400    

Click here for diff

Defect noticed by Coverity.  

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

Make WaitLatchOrSocket's timeout detection more robust.

commit   : 576a95b3a1ce465066c38d6859ccf64fca656e49    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Jul 2015 11:47:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Jul 2015 11:47:13 -0400    

Click here for diff

In the previous coding, timeout would be noticed and reported only when  
poll() or socket() returned zero (or the equivalent behavior on Windows).  
Ordinarily that should work well enough, but it seems conceivable that we  
could get into a state where poll() always returns a nonzero value --- for  
example, if it is noticing a condition on one of the file descriptors that  
we do not think is reason to exit the loop.  If that happened, we'd be in a  
busy-wait loop that would fail to terminate even when the timeout expires.  
  
We can make this more robust at essentially no cost, by deciding to exit  
of our own accord if we compute a zero or negative time-remaining-to-wait.  
Previously the code noted this but just clamped the time-remaining to zero,  
expecting that we'd detect timeout on the next loop iteration.  
  
Back-patch to 9.2.  While 9.1 had a version of WaitLatchOrSocket, it was  
primitive compared to later versions, and did not guarantee reliable  
detection of timeouts anyway.  (Essentially, this is a refinement of  
commit 3e7fdcffd6f77187, which was back-patched only as far as 9.2.)  

M src/backend/port/unix_latch.c
M src/backend/port/win32_latch.c

Enable transforms modules to build and test on Cygwin.

commit   : 00eff86cb8c2c9de9197197b4176362d1433f8f6    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 18 Jul 2015 10:09:04 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 18 Jul 2015 10:09:04 -0400    

Click here for diff

This still doesn't work correctly with Python 3, but I am committing  
this so we can get Cygwin buildfarm members building with Python 2.  

M contrib/hstore_plperl/Makefile
M contrib/hstore_plpython/Makefile
M contrib/ltree_plpython/Makefile

Release note compatibility item

commit   : 473865048517c7808ddcf2299d054d8fe30fc6d5    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 17 Jul 2015 21:08:03 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 17 Jul 2015 21:08:03 -0400    

Click here for diff

Note that json and jsonb extraction operators no longer consider a  
negative subscript to be invalid.  

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

Support JSON negative array subscripts everywhere

commit   : e02d44b8a74810341c90add4cd49e428b9d406b9    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 17 Jul 2015 20:56:13 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 17 Jul 2015 20:56:13 -0400    

Click here for diff

Previously, there was an inconsistency across json/jsonb operators that  
operate on datums containing JSON arrays -- only some operators  
supported negative array count-from-the-end subscripting.  Specifically,  
only a new-to-9.5 jsonb deletion operator had support (the new "jsonb -  
integer" operator).  This inconsistency seemed likely to be  
counter-intuitive to users.  To fix, allow all places where the user can  
supply an integer subscript to accept a negative subscript value,  
including path-orientated operators and functions, as well as other  
extraction operators.  This will need to be called out as an  
incompatibility in the 9.5 release notes, since it's possible that users  
are relying on certain established extraction operators changed here  
yielding NULL in the event of a negative subscript.  
  
For the json type, this requires adding a way of cheaply getting the  
total JSON array element count ahead of time when parsing arrays with a  
negative subscript involved, necessitating an ad-hoc lex and parse.  
This is followed by a "conversion" from a negative subscript to its  
equivalent positive-wise value using the count.  From there on, it's as  
if a positive-wise value was originally provided.  
  
Note that there is still a minor inconsistency here across jsonb  
deletion operators.  Unlike the aforementioned new "-" deletion operator  
that accepts an integer on its right hand side, the new "#-" path  
orientated deletion variant does not throw an error when it appears like  
an array subscript (input that could be recognized by as an integer  
literal) is being used on an object, which is wrong-headed.  The reason  
for not being stricter is that it could be the case that an object pair  
happens to have a key value that looks like an integer; in general,  
these two possibilities are impossible to differentiate with rhs path  
text[] argument elements.  However, we still don't allow the "#-"  
path-orientated deletion operator to perform array-style subscripting.  
Rather, we just return the original left operand value in the event of a  
negative subscript (which seems analogous to how the established  
"jsonb/json #> text[]" path-orientated operator may yield NULL in the  
event of an invalid subscript).  
  
In passing, make SetArrayPath() stricter about not accepting cases where  
there is trailing non-numeric garbage bytes rather than a clean NUL  
byte.  This means, for example, that strings like "10e10" are now not  
accepted as an array subscript of 10 by some new-to-9.5 path-orientated  
jsonb operators (e.g. the new #- operator).  Finally, remove dead code  
for jsonb subscript deletion; arguably, this should have been done in  
commit b81c7b409.  
  
Peter Geoghegan and Andrew Dunstan  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonfuncs.c
M src/include/utils/jsonapi.h
M src/test/regress/expected/json.out
M src/test/regress/expected/json_1.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Repair mishandling of cached cast-expression trees in plpgsql.

commit   : 0fc94a5bab4d0155db5d15197ed3bd8cb435eb21    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Jul 2015 15:53:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Jul 2015 15:53:09 -0400    

Click here for diff

In commit 1345cc67bbb014209714af32b5681b1e11eaf964, I introduced caching  
of expressions representing type-cast operations into plpgsql.  However,  
I supposed that I could cache both the expression trees and the evaluation  
state trees derived from them for the life of the session.  This doesn't  
work, because we execute the expressions in plpgsql's simple_eval_estate,  
which has an ecxt_per_query_memory that is only transaction-lifespan.  
Therefore we can end up putting pointers into the evaluation state tree  
that point to transaction-lifespan memory; in particular this happens if  
the cast expression calls a SQL-language function, as reported by Geoff  
Winkless.  
  
The minimum-risk fix seems to be to treat the state trees the same way  
we do for "simple expression" trees in plpgsql, ie create them in the  
simple_eval_estate's ecxt_per_query_memory, which means recreating them  
once per transaction.  
  
Since I had to introduce bookkeeping overhead for that anyway, I bought  
back some of the added cost by sharing the read-only expression trees  
across all functions in the session, instead of using a per-function  
table as originally.  The simple-expression bookkeeping takes care of  
the recursive-usage risk that I was concerned about avoiding before.  
  
At some point we should take a harder look at how all this works,  
and see if we can't reduce the amount of tree reinitialization needed.  
But that won't happen for 9.5.  

M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Fix entirely broken permissions test in new alter_operator regression test.

commit   : 266e771435bfed648138f6b684c895c8225dc8fc    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Jul 2015 14:10:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Jul 2015 14:10:52 -0400    

Click here for diff

Not only did this test fail to test what it was supposed to test, but it  
left a user definition lying around, which caused subsequent runs of the  
regression tests to fail.  

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

Add new function pg_notification_queue_usage.

commit   : a04bb65f70dafdf462e0478ad19e6de56df89bfc    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 17 Jul 2015 09:12:03 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 17 Jul 2015 09:12:03 -0400    

Click here for diff

This tells you what fraction of NOTIFY's queue is currently filled.  
  
Brendan Jurd, reviewed by Merlin Moncure and Gurjeet Singh.  A few  
further tweaks by me.  

M doc/src/sgml/func.sgml
M doc/src/sgml/ref/notify.sgml
M src/backend/commands/async.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/commands/async.h
A src/test/isolation/expected/async-notify.out
A src/test/isolation/specs/async-notify.spec
M src/test/regress/expected/async.out
M src/test/regress/sql/async.sql

AIX: Test the -qlonglong option before use.

commit   : 43d89a23d59c487bc9258fad7a6187864cb8c0c0    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 17 Jul 2015 03:01:14 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 17 Jul 2015 03:01:14 -0400    

Click here for diff

xlc provides "long long" unconditionally at C99-compatible language  
levels, and this option provokes a warning.  The warning interferes with  
"configure" tests that fail in response to any warning.  Notably, before  
commit 85a2a8903f7e9151793308d0638621003aded5ae, it interfered with the  
test for -qnoansialias.  Back-patch to 9.0 (all supported versions).  

M configure
M configure.in
M src/template/aix

Fix a low-probability crash in our qsort implementation.

commit   : 9d6077abf9d6efd992a59f05ef5aba981ea32096    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Jul 2015 22:57:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Jul 2015 22:57:46 -0400    

Click here for diff

It's standard for quicksort implementations, after having partitioned the  
input into two subgroups, to recurse to process the smaller partition and  
then handle the larger partition by iterating.  This method guarantees  
that no more than log2(N) levels of recursion can be needed.  However,  
Bentley and McIlroy argued that checking to see which partition is smaller  
isn't worth the cycles, and so their code doesn't do that but just always  
recurses on the left partition.  In most cases that's fine; but with  
worst-case input we might need O(N) levels of recursion, and that means  
that qsort could be driven to stack overflow.  Such an overflow seems to  
be the only explanation for today's report from Yiqing Jin of a SIGSEGV  
in med3_tuple while creating an index of a couple billion entries with a  
very large maintenance_work_mem setting.  Therefore, let's spend the few  
additional cycles and lines of code needed to choose the smaller partition  
for recursion.  
  
Also, fix up the qsort code so that it properly uses size_t not int for  
some intermediate values representing numbers of items.  This would only  
be a live risk when sorting more than INT_MAX bytes (in qsort/qsort_arg)  
or tuples (in qsort_tuple), which I believe would never happen with any  
caller in the current core code --- but perhaps it could happen with  
call sites in third-party modules?  In any case, this is trouble waiting  
to happen, and the corrected code is probably if anything shorter and  
faster than before, since it removes sign-extension steps that had to  
happen when converting between int and size_t.  
  
In passing, move a couple of CHECK_FOR_INTERRUPTS() calls so that it's  
not necessary to preserve the value of "r" across them, and prettify  
the output of gen_qsort_tuple.pl a little.  
  
Back-patch to all supported branches.  The odds of hitting this issue  
are probably higher in 9.4 and up than before, due to the new ability  
to allocate sort workspaces exceeding 1GB, but there's no good reason  
to believe that it's impossible to crash older branches this way.  

M src/backend/utils/sort/gen_qsort_tuple.pl
M src/port/qsort.c
M src/port/qsort_arg.c

Fix spelling error

commit   : 828df727a673d718265766611e59aa5189d102ba    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 16 Jul 2015 10:31:58 +0300    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 16 Jul 2015 10:31:58 +0300    

Click here for diff

David Rowley  

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

Fix copy/past error in comment

commit   : 64c9d8a6c8810796ab9f09d435c248ea516c5f3c    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 16 Jul 2015 10:28:44 +0300    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 16 Jul 2015 10:28:44 +0300    

Click here for diff

David Christensen  

M src/backend/utils/init/miscinit.c

commit   : 7193436744819270eeb772f6ada4ec7a388c0b5f    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 15 Jul 2015 21:00:26 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 15 Jul 2015 21:00:26 -0400    

Click here for diff

The result closely resembles linking of these modules for the "win32"  
port.  Augment the $(exports_file) header so the file is also usable as  
an import file.  Unfortunately, relocating an AIX installation will now  
require adding $(pkglibdir) to LD_LIBRARY_PATH.  Back-patch to 9.5,  
where the modules were introduced.  

M contrib/hstore_plperl/Makefile
M contrib/hstore_plpython/Makefile
M contrib/ltree_plpython/Makefile
M src/Makefile.shlib

commit   : bcd7c41206faf6d9654aa6e3766f87770d4fb305    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 15 Jul 2015 21:00:26 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 15 Jul 2015 21:00:26 -0400    

Click here for diff

This allows PostgreSQL modules and their dependencies to have undefined  
symbols, resolved at runtime.  Perl module shared objects rely on that  
in Perl 5.8.0 and later.  This fixes the crash when PL/PerlU loads such  
modules, as the hstore_plperl test suite does.  Module authors can link  
using -Wl,-G to permit undefined symbols; by default, linking will fail  
as it has.  Back-patch to 9.0 (all supported versions).  

M src/backend/Makefile

commit   : 736c1f238b3eeaf0f1cecf1753eb5194367fbad9    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 15 Jul 2015 21:00:26 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 15 Jul 2015 21:00:26 -0400    

Click here for diff

The MSVC build system already did this, and building against Python 3  
requires it.  Back-patch to 9.5, where the module was introduced.  

M contrib/ltree_plpython/Makefile

Mention table_rewrite as valid event trigger tag

commit   : b1b667172242aaffa33f91360d9448fe98b65697    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 15 Jul 2015 17:08:46 +0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 15 Jul 2015 17:08:46 +0300    

Click here for diff

This was forgotten in 618c9430a8.  

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

Remove regression test added on auto-pilot.

commit   : aa6b2e629cb5debc432e0dcca8ffdcb8d8e6da39    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Jul 2015 16:19:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Jul 2015 16:19:44 -0400    

Click here for diff

Test does not match the comment which precedes it.  
  
Peter Geoghegan  

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

Fix event trigger support for the new ALTER OPERATOR command.

commit   : d5c0495cd4b9c78fdfc00961f4ae14c39f877f59    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 19:50:18 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 19:50:18 +0300    

Click here for diff

Also, the lock on pg_operator should not be released until end of  
transaction.  

M src/backend/commands/operatorcmds.c

Add ALTER OPERATOR command, for changing selectivity estimator functions.

commit   : 321eed5f0f7563a0cabb3d7a98132856287c1ad1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 18:17:55 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 18:17:55 +0300    

Click here for diff

Other options cannot be changed, as it's not totally clear if cached plans  
would need to be invalidated if one of the other options change. Selectivity  
estimator functions only change plan costs, not correctness of plans, so  
those should be safe.  
  
Original patch by Uriy Zhuravlev, heavily edited by me.  

M doc/src/sgml/ref/alter_operator.sgml
M src/backend/commands/operatorcmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/include/commands/defrem.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
A src/test/regress/expected/alter_operator.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/alter_operator.sql

Prevent pgstattuple() from reporting BRIN as unknown index.

commit   : 705d397cd9cede1fd6fb1260d1689570bf6142d4    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 14 Jul 2015 22:36:51 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 14 Jul 2015 22:36:51 +0900    

Click here for diff

Also this patch removes obsolete comment.  
  
Back-patch to 9.5 where BRIN index was added.  

M contrib/pgstattuple/pgstattuple.c

Make regression test output stable.

commit   : 1a56498e5f6db949a066fb125199a7389a798421    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 16:16:23 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 16:16:23 +0300    

Click here for diff

In the test query I added for ALTER TABLE retaining comments, the order of  
the result rows was not stable, and varied across systems. Add an ORDER BY  
to make the order predictable. This should fix the buildfarm failures.  

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

Retain comments on indexes and constraints at ALTER TABLE ... TYPE ...

commit   : e42375fc8124e99c33fa330c53c2b4b502fa0baf    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 11:40:22 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 11:40:22 +0300    

Click here for diff

When a column's datatype is changed, ATExecAlterColumnType() rebuilds all  
the affected indexes and constraints, and the comments from the old  
indexes/constraints were not carried over.  
  
To fix, create a synthetic COMMENT ON command in the work queue, to re-add  
any comments on constraints. For indexes, there's a comment field in  
IndexStmt that is used.  
  
This fixes bug #13126, reported by Kirill Simonov. Original patch by  
Michael Paquier, reviewed by Petr Jelinek and me. This bug is present in  
all versions, but only backpatch to 9.5. Given how minor the issue is, it  
doesn't seem worth the work and risk to backpatch further than that.  

M src/backend/commands/tablecmds.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Reformat code in ATPostAlterTypeParse.

commit   : 1ab9faaecb03e685aeeb16143c19c0a24d6b0048    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 11:38:08 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 11:38:08 +0300    

Click here for diff

The code in ATPostAlterTypeParse was very deeply indented, mostly because  
there were two nested switch-case statements, which add a lot of  
indentation. Use if-else blocks instead, to make the code less indented  
and more readable.  
  
This is in preparation for next patch that makes some actualy changes to  
the function. These cosmetic parts have been separated to make it easier  
to see the real changes in the other patch.  

M src/backend/commands/tablecmds.c

release notes: markup: vacuumdb is an application, not command

commit   : 716f97f96663bdb8b64db9ed26121e2d399e06e0    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 12 Jul 2015 17:41:57 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 12 Jul 2015 17:41:57 -0400    

Click here for diff

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

Fix assorted memory leaks.

commit   : bcc87b6b00de5b36984e0b43a78a8377a3577548    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Jul 2015 16:25:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Jul 2015 16:25:51 -0400    

Click here for diff

Per Coverity (not that any of these are so non-obvious that they should not  
have been caught before commit).  The extent of leakage is probably minor  
to unnoticeable, but a leak is a leak.  Back-patch as necessary.  
  
Michael Paquier  

M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/scripts/vacuumdb.c

For consistency add a pfree to ON CONFLICT set_plan_refs code.

commit   : 3ed26e5f87a90bedaa3d7feb9e197e0d9f3fb252    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 12 Jul 2015 22:18:57 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 12 Jul 2015 22:18:57 +0200    

Click here for diff

Backpatch to 9.5 where ON CONFLICT was introduced.  
  
Author: Peter Geoghegan  

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

Optionally don't error out due to preexisting slots in commandline utilities.

commit   : ff27db5dd2fc096d89d3f995d3f650ec6d3bc147    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 12 Jul 2015 22:06:27 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 12 Jul 2015 22:06:27 +0200    

Click here for diff

pg_receivexlog and pg_recvlogical error out when --create-slot is  
specified and a slot with the same name already exists. In some cases,  
especially with pg_receivexlog, that's rather annoying and requires  
additional scripting.  
  
Backpatch to 9.5 as slot control functions have newly been added to  
pg_receivexlog, and there doesn't seem much point leaving it in a less  
useful state.  
  
Discussion: [email protected]  

M doc/src/sgml/ref/pg_receivexlog.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h

Add now-required #include.

commit   : 0a0fe2ff6ef65e3a1cf4d83d96eab144477a0220    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Jul 2015 23:34:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Jul 2015 23:34:41 -0400    

Click here for diff

Fixes compiler warning induced by 808ea8fc7bb259ddd810353719cac66e85a608c8.  

M src/backend/commands/policy.c

doc: fix typo in CREATE POLICY manual page

commit   : 57057e2124730b4663a02391369f0ac979791e32    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 11 Jul 2015 22:46:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 11 Jul 2015 22:46:28 -0400    

Click here for diff

Backpatch through 9.5  

M doc/src/sgml/ref/create_policy.sgml

Add assign_expr_collations() to CreatePolicy() and AlterPolicy().

commit   : 808ea8fc7bb259ddd810353719cac66e85a608c8    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 11 Jul 2015 14:19:31 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 11 Jul 2015 14:19:31 -0700    

Click here for diff

As noted by Noah Misch, CreatePolicy() and AlterPolicy() omit to call  
assign_expr_collations() on the node trees. Fix the omission and add  
his test case to the rowsecurity regression test.  

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

Copy-edit the docs changes of OWNER TO CURRENT/SESSION_USER additions.

commit   : cba045b0bd25285242936fd678bc443bfd0d5b83    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 10 Jul 2015 14:28:34 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 10 Jul 2015 14:28:34 +0300    

Click here for diff

Commit 31eae602 added new syntax to many DDL commands to use CURRENT_USER  
or SESSION_USER instead of role name in ALTER ... OWNER TO, but because  
of a misplaced '{', the syntax in the docs implied that the syntax was  
"ALTER ... CURRENT_USER", instead of "ALTER ... OWNER TO CURRENT_USER".  
Fix that, and also the funny indentation in some of the modified syntax  
blurps.  

M doc/src/sgml/ref/alter_large_object.sgml
M doc/src/sgml/ref/alter_opclass.sgml
M doc/src/sgml/ref/alter_operator.sgml
M doc/src/sgml/ref/alter_opfamily.sgml

Improve documentation about array concat operator vs. underlying functions.

commit   : e4f29ce32391525629c75aade86f2f939956c69c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Jul 2015 18:50:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Jul 2015 18:50:31 -0400    

Click here for diff

The documentation implied that there was seldom any reason to use the  
array_append, array_prepend, and array_cat functions directly.  But that's  
not really true, because they can help make it clear which case is meant,  
which the || operator can't do since it's overloaded to represent all three  
cases.  Add some discussion and examples illustrating the potentially  
confusing behavior that can ensue if the parser misinterprets what was  
meant.  
  
Per a complaint from Michael Herold.  Back-patch to 9.2, which is where ||  
started to behave this way.  

M doc/src/sgml/array.sgml

Fix postmaster's handling of a startup-process crash.

commit   : 45811be94e8539190b5e1a4f2cbdfef97fa391b5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Jul 2015 13:22:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Jul 2015 13:22:22 -0400    

Click here for diff

Ordinarily, a failure (unexpected exit status) of the startup subprocess  
should be considered fatal, so the postmaster should just close up shop  
and quit.  However, if we sent the startup process a SIGQUIT or SIGKILL  
signal, the failure is hardly "unexpected", and we should attempt restart;  
this is necessary for recovery from ordinary backend crashes in hot-standby  
scenarios.  I attempted to implement the latter rule with a two-line patch  
in commit 442231d7f71764b8c628044e7ce2225f9aa43b67, but it now emerges that  
that patch was a few bricks shy of a load: it failed to distinguish the  
case of a signaled startup process from the case where the new startup  
process crashes before reaching database consistency.  That resulted in  
infinitely respawning a new startup process only to have it crash again.  
  
To handle this properly, we really must track whether we have sent the  
*current* startup process a kill signal.  Rather than add yet another  
ad-hoc boolean to the postmaster's state, I chose to unify this with the  
existing RecoveryError flag into an enum tracking the startup process's  
state.  That seems more consistent with the postmaster's general state  
machine design.  
  
Back-patch to 9.0, like the previous patch.  

M src/backend/postmaster/postmaster.c

Fix obsolete comment regarding NOTICE message level.

commit   : 6ba365aa4621b0e4c4c0920cbdf56348875a46a2    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 9 Jul 2015 22:52:36 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 9 Jul 2015 22:52:36 +0900    

Click here for diff

By default NOTICE message is not sent to server log because  
the default value of log_min_messages is WARNING since 8.4.  
  
Pavel Stehule  

M src/include/utils/elog.h

Make wal_compression PGC_SUSET rather than PGC_USERSET.

commit   : c2e5f4d1c16faa84a19906706481cf149769f320    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 9 Jul 2015 22:30:52 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 9 Jul 2015 22:30:52 +0900    

Click here for diff

When enabling wal_compression, there is a risk to leak data similarly to  
the BREACH and CRIME attacks on SSL where the compression ratio of  
a full page image gives a hint of what is the existing data of this page.  
This vulnerability is quite cumbersome to exploit in practice, but doable.  
  
So this patch makes wal_compression PGC_SUSET in order to prevent  
non-superusers from enabling it and exploiting the vulnerability while  
DBA thinks the risk very seriously and disables it in postgresql.conf.  
  
Back-patch to 9.5 where wal_compression was introduced.  

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

Use --debug flag in "remote" pg_rewind regression tests.

commit   : 23b8928829038ef3fba5a04e4f2707c6034464c4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 16:15:09 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 16:15:09 +0300    

Click here for diff

Gives more information in the log, to debug possible failures.  

M src/bin/pg_rewind/RewindTest.pm

commit   : aaec6a6d37b664199fd7744b976a7dc912ae000a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 16:00:14 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 16:00:14 +0300    

Click here for diff

Tom fixed another one of these in commit 7f32dbcd, but there was another  
almost identical one in libpq docs. Per his comment:  
  
HP's web server has apparently become case-sensitive sometime recently.  
Per bug #13479 from Daniel Abraham.  Corrected link identified by Alvaro.  

M doc/src/sgml/libpq.sgml

Improve logging of TAP tests.

commit   : 1ea06203b82b98b5098808667f6ba652181ef5b2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 13:19:10 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 13:19:10 +0300    

Click here for diff

Create a log file for each test run. Stdout and stderr of the test script,  
as well as any subprocesses run as part of the test, are redirected to  
the log file. This makes it a lot easier to debug test failures. Also print  
the test output (ok 12 - ... messages) to the log file, and the command  
line of any external programs executed with the system_or_bail and run_log  
functions. This makes it a lot easier to debug failing tests.  
  
Modify some of the pg_ctl and other command invocations to not use 'silent'  
or 'quiet' options, and don't redirect output to /dev/null, so that you get  
all the information in the log instead.  
  
In the passing, construct some command lines in a way that works if $tempdir  
contains quote-characters. I haven't systematically gone through all of  
them or tested that, so I don't know if this is enough to make that work.  
  
pg_rewind tests had a custom mechanism for creating a similar log file. Use  
the new generic facility instead.  
  
Michael Paquier and me.  

M src/Makefile.global.in
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_rewind/.gitignore
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
A src/test/perl/SimpleTee.pm
M src/test/perl/TestLib.pm
M src/test/ssl/ServerSetup.pm

Use AS_IF rather than plain shell "if" in pthread-check.

commit   : 01051a9879fcd353eaf0d3788a911e774b52798c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 11:38:34 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 11:38:34 +0300    

Click here for diff

Autoconf generates additional code for the first AC_CHECK_HEADERS call in  
the script. If the first call is within an if-block, the additional code is  
put inside the if-block too, even though it is needed by subsequent  
AC_CHECK_HEADERS checks and should always be executed. When I moved the  
pthread-related checks earlier in the script, the pthread.h test inside  
the block became the very first AC_CHECK_HEADERS call in the script,  
triggering that problem.  
  
To fix, use AS_IF instead of plain shell if. AS_IF knows about that issue,  
and makes sure the additional code is always executed. To be completely  
safe from this issue (and others), we should always be using AS_IF instead  
of plain if, but that seems like excessive caution given that this is the  
first time we have trouble like this. Plain if-then is more readable than  
AS_IF.  
  
This should fix compilation with --disable-thread-safety, and hopefully the  
buildfarm failure on forgmouth, related to mingw standard headers, too.  
I backpatched the previous fixes to 9.5, but it's starting to look like  
these changes are too fiddly to backpatch, so commit this to master only,  
and revert all the pthread-related configure changes in 9.5.  

M configure
M configure.in

Add .gitignore entries for AIX-specific intermediate build artifacts.

commit   : bfb4cf12abc14a99b29c9c3f768b0c7f568c262d    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:22 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:22 -0400    

Click here for diff

M .gitignore
M src/backend/.gitignore

commit   : 0689cfc34b09136b9daee9c60c85fbed21b62370    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:22 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:22 -0400    

Click here for diff

The AIX 7.1 libm is static, and AIX postgres executables do not export  
symbols acquired from libraries.  Back-patch to 9.5, where commit  
cfe12763c32437bc708a64ce88a90c7544f16185 added a sqrt() call.  

M contrib/pg_stat_statements/Makefile

Given a gcc-compatible xlc compiler, prefer xlc-style atomics.

commit   : 1e700e0fa02b3fd8990d4eaa8bd51b9352cc9736    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    

Click here for diff

This evades a ppc64le "IBM XL C/C++ for Linux" compiler bug.  Back-patch  
to 9.5, where the atomics facility was introduced.  

M src/include/port/atomics.h

Finish generic-xlc.h draft atomics implementation.

commit   : 0d32d2e693ed69b3080be91f734c547f703b49ad    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    

Click here for diff

Back-patch to 9.5, where commit b64d92f1a5602c55ee8b27a7ac474f03b7aee340  
introduced this file.  

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

Revoke support for strxfrm() that write past the specified array length.

commit   : be8b06c364db315258fb074e9bfbf5db04ab2c5f    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    

Click here for diff

This formalizes a decision implicit in commit  
4ea51cdfe85ceef8afabceb03c446574daa0ac23 and adds clean detection of  
affected systems.  Vendor updates are available for each such known bug.  
Back-patch to 9.5, where the aforementioned commit first appeared.  

M src/backend/main/main.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/init/postinit.c
M src/include/utils/pg_locale.h

Replace use of "diff -q".

commit   : b28244abe58382be980d9b9577276c0700dd2cbc    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    

Click here for diff

POSIX does not specify the -q option, and many implementations do not  
offer it.  Don't bother changing the MSVC build system, because having  
non-GNU diff on Windows is vanishingly unlikely.  Back-patch to 9.2,  
where this invocation was introduced.  

M src/bin/pg_upgrade/test.sh

Fix null pointer dereference in "\c" psql command.

commit   : e135c3d99f4fcb03efa7b0b64445853ee2a74857    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    

Click here for diff

The psql crash happened when no current connection existed.  (The second  
new check is optional given today's undocumented NULL argument handling  
in PQhost() etc.)  Back-patch to 9.0 (all supported versions).  

M src/bin/psql/command.c

Move pthread-tests earlier in the autoconf script.

commit   : 3b14a17c8e60e8ae9227b9533667743508056c35    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 00:05:45 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 00:05:45 +0300    

Click here for diff

On some Linux systems, "-lrt" exposed pthread-functions, so that linking  
with -lrt was seemingly enough to make a program that uses pthreads to  
work. However, when linking libpq, the dependency to libpthread was not  
marked correctly, so that when an executable was linked with -lpq but  
without -pthread, you got errors about undefined pthread_* functions from  
libpq.  
  
To fix, test for the flags required to use pthreads earlier in the autoconf  
script, before checking any other libraries.  
  
This should fix the failure on buildfarm member shearwater. gharial is also  
failing; hopefully this fixes that too although the failure looks somewhat  
different.  

M configure
M configure.in

Replace our hacked version of ax_pthread.m4 with latest upstream version.

commit   : e97af6c8bfc80d084bca5bf41f036de944b63efe    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Jul 2015 20:36:06 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Jul 2015 20:36:06 +0300    

Click here for diff

Our version was different from the upstream version in that we tried to use  
all possible pthread-related flags that the compiler accepts, rather than  
just the first one that works. That change was made in commit  
e48322a6d6cfce1ec52ab303441df329ddbc04d1, to work-around a bug affecting GCC  
versions 3.2 and below (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=8888),  
although we didn't realize that it was a GCC bug at the time. We hardly care  
about that old GCC versions anymore, so we no longer need that workaround.  
  
This fixes the macro for compilers that print warnings with the chosen  
flags. That's pretty annoying on its own right, but it also inconspicuously  
disabled thread-safety, because we refused to use any pthread-related flags  
if the compiler produced warnings. Max Filippov reported that problem when  
linking with uClibc and OpenSSL. The warnings-check was added because the  
workaround for the GCC bug caused warnings otherwise, so it's no longer  
needed either. We can just use the upstream version as is.  
  
If you really want to compile with GCC version 3.2 or older, you can still  
work-around it manually by setting PTHREAD_CFLAGS="-pthread -lpthread"  
manually on the configure command line.  
  
Backpatch to 9.5. I don't want to unnecessarily rock the boat on stable  
branches, but 9.5 seems like fair game.  

M aclocal.m4
D config/acx_pthread.m4
A config/ax_pthread.m4
M configure
M configure.in

Improve regression test coverage of table lock modes vs permissions.

commit   : e66a45344ff33d64aa6ff50673ff9fe8577ea6db    
  
author   : Joe Conway <[email protected]>    
date     : Tue, 7 Jul 2015 14:35:35 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Tue, 7 Jul 2015 14:35:35 -0700    

Click here for diff

Test the interactions with permissions and LOCK TABLE. Specifically  
ROW EXCLUSIVE, ACCESS SHARE, and ACCESS EXCLUSIVE modes against  
SELECT, INSERT, UPDATE, DELETE, and TRUNCATE permissions. Discussed  
by Stephen Frost and Michael Paquier, patch by the latter. Backpatch  
to 9.5 where matching behavior was first committed.  

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

Fix incorrect path in pg_regress log messages.

commit   : 61fc420b5710036f3124a44c26a3664a9cc7cdcf    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 8 Jul 2015 01:54:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 8 Jul 2015 01:54:17 +0900    

Click here for diff

Back-patch to 9.5 where the bug was introduced.  
  
David Christensen  

M src/test/regress/pg_regress.c

Fix portability issue in pg_upgrade test script: avoid $PWD.

commit   : 9a8f58331067e18a5dc10670e687f21ae6a2172e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Jul 2015 12:49:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Jul 2015 12:49:18 -0400    

Click here for diff

SUSv2-era shells don't set the PWD variable, though anything more modern  
does.  In the buildfarm environment this could lead to test.sh executing  
with PWD pointing to $HOME or another high-level directory, so that there  
were conflicts between concurrent executions of the test in different  
branch subdirectories.  This appears to be the explanation for recent  
intermittent failures on buildfarm members binturong and dingo (and might  
well have something to do with the buildfarm script's failure to capture  
log files from pg_upgrade tests, too).  
  
To fix, just use `pwd` in place of $PWD.  AFAICS test.sh is the only place  
in our source tree that depended on $PWD.  Back-patch to all versions  
containing this script.  
  
Per buildfarm.  Thanks to Oskari Saarenmaa for diagnosing the problem.  

M src/bin/pg_upgrade/test.sh

Improve handling of out-of-memory in libpq.

commit   : 414bef30bfab20451e15fe799642b52166db8c34    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Jul 2015 18:37:45 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Jul 2015 18:37:45 +0300    

Click here for diff

If an allocation fails in the main message handling loop, pqParseInput3  
or pqParseInput2, it should not be treated as "not enough data available  
yet". Otherwise libpq will wait indefinitely for more data to arrive from  
the server, and gets stuck forever.  
  
This isn't a complete fix - getParamDescriptions and getCopyStart still  
have the same issue, but it's a step in the right direction.  
  
Michael Paquier and me. Backpatch to all supported versions.  

M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-protocol3.c

Add tab-completion for psql meta-commands.

commit   : c81c956477c270c4dd816c2f659743ebcae02b77    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 7 Jul 2015 23:34:18 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 7 Jul 2015 23:34:18 +0900    

Click here for diff

Based on the original code from David Christensen, modified by me.  

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

Refer to %p in the psql docs as 'process ID' not 'pid'.

commit   : 4af04f96bc9f604a57bf829469b26d8513fd6401    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 7 Jul 2015 16:23:55 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 7 Jul 2015 16:23:55 +0200    

Click here for diff

Per Tom.  

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

Add psql PROMPT variable showing the pid of the connected to backend.

commit   : 275f05c990c46f8dfe3cb46a3279521bda9e9e27    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 7 Jul 2015 13:40:44 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 7 Jul 2015 13:40:44 +0200    

Click here for diff

The substitution for the pid is %p.  
  
Author: Julien Rouhaud  
Discussion: [email protected]  

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

Fix logical decoding bug leading to inefficient reopening of files.

commit   : b2f6f749c7a5936adbb555e248e8e4df35c00a4a    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 7 Jul 2015 13:05:41 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 7 Jul 2015 13:05:41 +0200    

Click here for diff

When spilling transaction data to disk a simple typo caused the output  
file to be closed and reopened for every serialized change. That happens  
to not have a huge impact on linux, which is why it probably wasn't  
noticed so far, but on windows that appears to trigger actual disk  
writes after every change. Not fun.  
  
The bug fortunately does not have any impact besides speed. A change  
could end up being in the wrong segment (last instead of next), but  
since we read all files to the end, that's just ugly, not really  
problematic. It's not a problem to upgrade, since transaction spill  
files do not persist across restarts.  
  
Bug: #13484  
Reported-By: Olivier Gosseaume  
Discussion: [email protected]  
  
Backpatch to 9.4, where logical decoding was added.  

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

Fix pg_recvlogical not to fsync output when it's a tty or pipe.

commit   : 5c0de384d2ceceb07e77e1368e07868244be6762    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 7 Jul 2015 12:47:44 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 7 Jul 2015 12:47:44 +0200    

Click here for diff

The previous coding tried to handle possible failures when fsyncing a  
tty or pipe fd by accepting EINVAL - but apparently some  
platforms (windows, OSX) don't reliably return that. So instead check  
whether the output fd refers to a pipe or a tty when opening it.  
  
Reported-By: Olivier Gosseaume, Marko Tiikkaja  
Discussion: [email protected]  
  
Backpatch to 9.4, where pg_recvlogical was added.  

M src/bin/pg_basebackup/pg_recvlogical.c

commit   : 02eac01f91923592f93abf8d325ab806b058f948    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 6 Jul 2015 19:16:53 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 6 Jul 2015 19:16:53 -0700    

Click here for diff

Also updated regression expected output to match. Noted and patch by Daniele Varrazzo.  

M src/backend/commands/policy.c
M src/backend/commands/user.c
M src/test/regress/expected/rowsecurity.out

Turn install.bat into a pure one line wrapper fort he perl script.

commit   : 6c534fd68568452adcc9ccecb557eff74f6f0f4d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 6 Jul 2015 22:18:26 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 6 Jul 2015 22:18:26 +0300    

Click here for diff

Build.bat and vcregress.bat got similar treatment years ago. I'm not sure  
why install.bat wasn't treated at the same time, but it seems like a good  
idea anyway.  
  
The immediate problem with the old install.bat was that it had quoting  
issues, and wouldn't work if the target directory's name contained spaces.  
This fixes that problem.  

M src/tools/msvc/install.bat
M src/tools/msvc/install.pl

Call getsockopt() on the correct socket.

commit   : 8e33fc1784cbd657a7238ab5639ee1f8f54a3ec0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 6 Jul 2015 16:36:48 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 6 Jul 2015 16:36:48 +0300    

Click here for diff

We're interested in the buffer size of the socket that's connected to the  
client, not the one that's listening for new connections. It happened to  
work, as default buffer size is the same on both, but it was clearly not  
wrong.  
  
Spotted by Tom Lane  

M src/backend/libpq/pqcomm.c

Don't set SO_SNDBUF on recent Windows versions that have a bigger default.

commit   : 4f33621f3f50286e607a3cdcc1f7a7d51075af95    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 6 Jul 2015 16:10:58 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 6 Jul 2015 16:10:58 +0300    

Click here for diff

It's unnecessary to set it if the default is higher in the first place.  
Furthermore, setting SO_SNDBUF disables the so-called "dynamic send  
buffering" feature, which hurts performance further. This can be seen  
especially when the network between the client and the server has high  
latency.  
  
Chen Huajun  

M src/backend/libpq/pqcomm.c

Remove incorrect warning from pg_archivecleanup document.

commit   : 906e9249494bda975914b78fdd743609e1f83016    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 6 Jul 2015 20:58:58 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 6 Jul 2015 20:58:58 +0900    

Click here for diff

The .backup file name can be passed to pg_archivecleanup even if  
it includes the extension which is specified in -x option.  
However, previously the document incorrectly warned a user  
not to do that.  
  
Back-patch to 9.2 where pg_archivecleanup's -x option and  
the warning were added.  

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

Make a editorial pass over pgbench's error messages.

commit   : 22ba5563adacd162d97ff3c80eac4893574f1e17    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 19:36:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 19:36:57 -0400    

Click here for diff

The lack of consistency, and lack of attention to our message style  
guidelines, was a bit striking.  Try to make 'em better.  

M src/bin/pgbench/pgbench.c

Fix some typos in regression test comments.

commit   : 551654977022097ac408b483b3be9887a99f0ce0    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 13:14:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 13:14:38 -0400    

Click here for diff

Back-patch to avoid unnecessary cross-branch differences.  
  
CharSyam  

M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/alter_generic.sql
M src/test/regress/sql/jsonb.sql

Further reduce overhead for passing plpgsql variables to the executor.

commit   : 6c82d8d1fdb1f1265f93d89640edcbd0ae22c627    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 12:57:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 12:57:17 -0400    

Click here for diff

This builds on commit 21dcda2713656a7483e3280ac9d2ada20a87a9a9 by keeping  
a plpgsql function's shared ParamListInfo's entries for simple variables  
(PLPGSQL_DTYPE_VARs) valid at all times.  That adds a few cycles to each  
assignment to such variables, but saves significantly more cycles each time  
they are used; so except in the pathological case of many dead stores, this  
should always be a win.  Initial testing says it's good for about a 10%  
speedup of simple calculations; more in large functions with many datums.  
  
We can't use this method for row/record references unfortunately, so what  
we do for those is reset those ParamListInfo slots after use; which we  
can skip doing unless some of them were actually evaluated during the  
previous evaluation call.  So this should frequently be a win as well,  
while worst case is that it's similar cost to the previous approach.  
  
Also, closer study suggests that the previous method of instantiating a  
new ParamListInfo array per evaluation is actually probably optimal for  
cursor-opening executor calls.  The reason is that whatever is visible in  
the array is going to get copied into the cursor portal via copyParamList.  
So if we used the function's main ParamListInfo for those calls, we'd end  
up with all of its DTYPE_VAR vars getting copied, which might well include  
large pass-by-reference values that the cursor actually has no need for.  
To avoid a possible net degradation in cursor cases, go back to creating  
and filling a private ParamListInfo in those cases (which therefore will be  
exactly the same speed as before 21dcda271365).  We still get some benefit  
out of this though, because this approach means that we only have to defend  
against copyParamList's try-to-fetch-every-slot behavior in the case of an  
unshared ParamListInfo; so plpgsql_param_fetch() can skip testing  
expr->paramnos in the common case.  
  
To ensure that the main ParamListInfo's image of a DTYPE_VAR datum is  
always valid, all assignments to such variables are now funneled through  
assign_simple_var().  But this makes for cleaner and shorter code anyway.  

M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h

Fix bad grammar in brin.sgml.

commit   : 252404625aa98fa5f93a45a8dcffdc179981820a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 12:08:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 12:08:15 -0400    

Click here for diff

Christoph Berg  

M doc/src/sgml/brin.sgml

Add documentation and regression tests concerning rounding of numerics.

commit   : 5e7c3d91bf24a212b42c912234c6cb37d75e0292    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Jul 2015 17:04:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Jul 2015 17:04:39 -0400    

Click here for diff

Michael Paquier, reviewed by Fabien Coelho  

M doc/src/sgml/datatype.sgml
M src/test/regress/expected/int2.out
M src/test/regress/expected/int4.out
M src/test/regress/expected/int8-exp-three-digits.out
M src/test/regress/expected/int8.out
M src/test/regress/expected/numeric.out
M src/test/regress/sql/int2.sql
M src/test/regress/sql/int4.sql
M src/test/regress/sql/int8.sql
M src/test/regress/sql/numeric.sql

Add psql \ev and \sv commands for editing and showing view definitions.

commit   : 8eb6407aaeb6cbd972839e356b436bb698f51cff    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Jul 2015 15:48:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Jul 2015 15:48:18 -0400    

Click here for diff

These are basically just like the \ef and \sf commands for functions.  
  
Petr Korobeinikov, reviewed by Jeevan Chalke, some changes by me  

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

Remove thread-emulation support from pgbench.

commit   : 1bc90f7a7b7441a88e2c6d4a0e9b6f9c1499ad30    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 3 Jul 2015 11:48:54 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 3 Jul 2015 11:48:54 +0300    

Click here for diff

You can no longer use pgbench with multiple threads when compiled without  
--enable-thread-safety. That's an acceptable limitation these days; it  
still works fine with -j1, and all modern platforms support threads anyway.  
This makes future maintenance and development of the code easier.  
  
Fabien Coelho  

M src/bin/pgbench/pgbench.c

Fix pgbench progress report behaviour when pgbench or a query gets stuck.

commit   : 9031ff91a110f29e8bd4b74ddf2b5ced3ecbeaf4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 3 Jul 2015 11:04:57 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 3 Jul 2015 11:04:57 +0300    

Click here for diff

There were two issues here. First, if a query got stuck so that it took  
e.g. 5 seconds, and progress interval was 1 second, no progress reports were  
printed until the query returned. Fix so that we wake up specifically to  
print the progress report. Secondly, if pgbench got stuck so that it would  
nevertheless not print a progress report on time, and enough time passes  
that it's already time to print the next progress report, just skip the one  
that was missed. Before this patch, it would print the missed one with 0 TPS  
immediately after the previous one.  
  
Fabien Coelho. Backpatch to 9.4, where progress reports were added.  

M src/bin/pgbench/pgbench.c

Lift the limitation that # of clients must be a multiple of # of threads

commit   : ba3deeefb0fb9e8810b454bc7b41f27965c24aa8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 3 Jul 2015 10:45:40 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 3 Jul 2015 10:45:40 +0300    

Click here for diff

Fabien Coelho  

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

commit   : 8650d161ae4369ec64a6fc7b7cbd0e6e55c3a7aa    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 3 Jul 2015 11:53:58 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 3 Jul 2015 11:53:58 +0900    

Click here for diff

Commit de76884 changed an archive recovery so that the last WAL  
segment with old timeline was renamed with suffix .partial. It should  
have updated WAL-related utilities so that they can handle such  
.paritial WAL files, but we forgot that.  
  
This patch changes pg_archivecleanup so that it can clean up even  
archived WAL files with .partial suffix. Also it allows us to specify  
.partial WAL file name as the command-line argument "oldestkeptwalfile".  
  
This patch also changes pg_resetxlog so that it can remove .partial  
WAL files in pg_xlog directory.  
  
pg_xlogdump cannot handle .partial WAL files. Per discussion,  
we decided only to document that limitation instead of adding the fix.  
Because a user can easily work around the limitation (i.e., just remove  
.partial suffix from the file name) and the fix seems complicated for  
very narrow use case.  
  
Back-patch to 9.5 where the problem existed.  
  
Review by Michael Paquier.  
Discussion: http://www.postgresql.org/message-id/CAHGQGwGxMKnVHGgTfiig2Bt_2djec0in3-DLJmtg7+nEiidFdQ@mail.gmail.com  

M doc/src/sgml/ref/pg_xlogdump.sgml
M doc/src/sgml/ref/pgarchivecleanup.sgml
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_resetxlog/pg_resetxlog.c

Improve pg_restore's -t switch to match all types of relations.

commit   : 5671aaca87c47128f6a1e0556ce9c7512096ad87    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Jul 2015 18:13:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Jul 2015 18:13:34 -0400    

Click here for diff

-t will now match views, foreign tables, materialized views, and sequences,  
not only plain tables.  This is more useful, and also more consistent with  
the behavior of pg_dump's -t switch, which has always matched all relation  
types.  
  
We're still not there on matching pg_dump's behavior entirely, so mention  
that in the docs.  
  
Craig Ringer, reviewed by Pavel Stehule  

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

Make numeric form of PG version number readily available in Makefiles.

commit   : a5d489ccb7e613c7ca3be6141092b8c1d2c13fa7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Jul 2015 17:24:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Jul 2015 17:24:36 -0400    

Click here for diff

Expose PG_VERSION_NUM (e.g., "90600") as a Make variable; but for  
consistency with the other Make variables holding similar info,  
call the variable just VERSION_NUM not PG_VERSION_NUM.  
  
There was some discussion of making this value available as a pg_config  
value as well.  However, that would entail substantially more work than  
this two-line patch.  Given that there was not exactly universal consensus  
that we need this at all, let's just do a minimal amount of work for now.  
  
Michael Paquier, reviewed by Pavel Stehule  

M configure
M configure.in
M src/Makefile.global.in

Fix misuse of TextDatumGetCString().

commit   : ac50f84866b22f239025bf37c9c7492cc4ce2dfd    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Jul 2015 17:02:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Jul 2015 17:02:08 -0400    

Click here for diff

"TextDatumGetCString(PG_GETARG_TEXT_P(x))" is formally wrong: a text*  
is not a Datum.  Although this coding will accidentally fail to fail on  
all known platforms, it risks leaking memory if a detoast step is needed,  
unlike "TextDatumGetCString(PG_GETARG_DATUM(x))" which is what's used  
elsewhere.  Make pg_get_object_address() fall in line with other uses.  
  
Noted while reviewing two-arg current_setting() patch.  

M src/backend/catalog/objectaddress.c

Add an optional missing_ok argument to SQL function current_setting().

commit   : 10fb48d66de76e7dc1e36ef18af502ed9600352f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Jul 2015 16:40:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Jul 2015 16:40:55 -0400    

Click here for diff

This allows convenient checking for existence of a GUC from SQL, which is  
particularly useful when dealing with custom variables.  
  
David Christensen, reviewed by Jeevan Chalke  

M contrib/tsearch2/tsearch2.c
M doc/src/sgml/func.sgml
M src/backend/utils/misc/guc.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h
M src/include/utils/guc.h
M src/test/regress/expected/guc.out
M src/test/regress/sql/guc.sql

Remove obsolete heap_formtuple/modifytuple/deformtuple functions.

commit   : 726117243022178e72966cbffdfb9147ec6dbbcc    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 21:18:04 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 21:18:04 +0300    

Click here for diff

These variants used the old-style 'n'/' ' NULL indicators. The new-style  
functions have been available since version 8.1. That should be long enough  
that if there is still any old external code using these functions, they  
can just switch to the new functions without worrying about backwards  
compatibility  
  
Peter Geoghegan  

M src/backend/access/common/heaptuple.c
M src/include/access/htup_details.h

Remove "const" from convertTSFunction()'s return type.

commit   : a3fd7afe3090a5098f93408d47da70b47fb59e7b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 21:10:26 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 21:10:26 +0300    

Click here for diff

There's no particular reason to mark it as such. The other convert*  
functions have no const either.  

M src/bin/pg_dump/pg_dump.c

Plug some trivial memory leaks in pg_dump and pg_upgrade.

commit   : f712289ffad7c3fb6eb3be4f81adb0aa0981c9f7    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 20:58:51 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 20:58:51 +0300    

Click here for diff

There's no point in trying to free every small allocation in these  
programs that are used in a one-shot fashion, but these ones seems like  
an improvement on readability grounds.  
  
Michael Paquier, per Coverity report.  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_upgrade/check.c

Whitespace fix - replace tab with spaces in CREATE TABLE command.

commit   : 1fd0d5ec0373666fe00db4f641490d9e82f53e01    
  
author   : Joe Conway <[email protected]>    
date     : Thu, 2 Jul 2015 09:45:53 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Thu, 2 Jul 2015 09:45:53 -0700    

Click here for diff

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

Replace obsolete autoconf macros with their modern replacements.

commit   : a2edb023d08778c3346bbbf4ca82ef7f6e9283eb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 19:21:23 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 19:21:23 +0300    

Click here for diff

AC_TRY_COMPILE(...) -> AC_COMPILE_IFELSE([AC_LANG_PROGRAM(...)])  
AC_TRY_LINK(...) -> AC_LINK_IFELSE([AC_LANG_PROGRAM(...)])  
AC_TRY_RUN(...) -> AC_RUN_IFELSE([AC_LANG_PROGRAM(...)])  
AC_LANG_SAVE/RESTORE -> AC_LANG_PUSH/POP  
AC_DECL_SYS_SIGLIST -> AC_CHECK_DECLS(...) (per snippet in autoconf manual)  
  
Also use AC_LANG_SOURCE instead of AC_LANG_PROGRAM, where the main()  
function is not needed.  
  
With these changes, autoconf -Wall doesn't complain anymore.  
  
Andreas Karlsson  

M config/ac_func_accept_argtypes.m4
M config/acx_pthread.m4
M config/c-compiler.m4
M config/c-library.m4
M config/programs.m4
M configure
M configure.in

Don't emit a spurious space at end of line in pg_dump of event triggers.

commit   : 7b156c1e0746a46d083d7dbcd28afb303b3484ef    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:50:29 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:50:29 +0300    

Click here for diff

Backpatch to 9.3 and above, where event triggers were added.  

M src/bin/pg_dump/pg_dump.c

Use appendStringInfoString/Char et al where appropriate.

commit   : f92d6a540ac443f85f0929b284edff67da14687a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:32:48 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:32:48 +0300    

Click here for diff

Patch by David Rowley. Backpatch to 9.5, as some of the calls were new in  
9.5, and keeping the code in sync with master makes future backpatching  
easier.  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/transam/xlog.c
M src/backend/lib/pairingheap.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/xml.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c
M src/bin/scripts/clusterdb.c
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c

Fix name of argument to pg_stat_file.

commit   : 7931622d1d942dbbba8d0eab77f18f69f1ce5de0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:12:05 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:12:05 +0300    

Click here for diff

It's called "missing_ok" in the docs and in the C code.  
  
I refrained from doing a catversion bump for this, because the name of an  
input argument is just documentation, it has no effect on any callers.  
  
Michael Paquier  

M src/include/catalog/pg_proc.h

Use American spelling for "behavior".

commit   : 5b1b6bf49b44f9b26f0c9eb6d97e84973e71a0ae    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:11:32 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:11:32 +0300    

Click here for diff

For consistency with the rest of the docs.  
  
Michael Paquier  

M doc/src/sgml/func.sgml

Allow MSVC's contribcheck and modulescheck to run independently.

commit   : d5d00294b05a54396f83db8abdf37c379a739794    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 1 Jul 2015 23:28:41 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 1 Jul 2015 23:28:41 -0400    

Click here for diff

These require a temp install to have been done, so we now make sure it  
is done before proceeding.  
  
Michael Paquier.  

M src/tools/msvc/vcregress.pl

commit   : fb174687f7a730edcf301949785a6ac0dbfd70d0    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 2 Jul 2015 10:35:38 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 2 Jul 2015 10:35:38 +0900    

Click here for diff

Commit 179cdd09 added macros to check if a filename is a WAL segment  
or other such file. However there were still some instances of the  
strlen + strspn combination to check for that in WAL-related utilities  
like pg_archivecleanup. Those checks can be replaced with the macros.  
  
This patch makes use of the macros in those utilities and  
which would make the code a bit easier to read.  
  
Back-patch to 9.5.  
  
Michael Paquier  

M contrib/pg_standby/pg_standby.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/include/access/xlog_internal.h

Don't leave pg_hba and pg_ident data lying around in running backends.

commit   : 1e24cf645d24aab3ea39a9d259897fd0cae4e4b6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Jul 2015 18:55:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Jul 2015 18:55:39 -0400    

Click here for diff

Free the contexts holding this data after we're done using it, by the  
expedient of attaching them to the PostmasterContext which we were  
already taking care to delete (and where, indeed, this data used to live  
before commits e5e2fc842c418432 and 7c45e3a3c682f855).  This saves a  
probably-usually-negligible amount of space per running backend.  It also  
avoids leaving potentially-security-sensitive data lying around in memory  
in processes that don't need it.  You'd have to be unusually paranoid to  
think that that amounts to a live security bug, so I've not gone so far as  
to forcibly zero the memory; but there surely isn't a good reason to keep  
this data around.  
  
Arguably this is a memory management bug in the aforementioned commits,  
but it doesn't seem important enough to back-patch.  

M src/backend/libpq/hba.c
M src/backend/utils/init/postinit.c

Make sampler_random_fract() actually obey its API contract.

commit   : d7c19d68550eb6018e8581a73a351905f4cc435c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Jul 2015 18:07:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Jul 2015 18:07:48 -0400    

Click here for diff

This function is documented to return a value in the range (0,1),  
which is what its predecessor anl_random_fract() did.  However, the  
new version depends on pg_erand48() which returns a value in [0,1).  
The possibility of returning zero creates hazards of division by zero  
or trying to compute log(0) at some call sites, and it might well  
break third-party modules using anl_random_fract() too.  So let's  
change it to never return zero.  Spotted by Coverity.  
  
Michael Paquier, cosmetically adjusted by me  

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

Make XLogFileCopy() look the same as in 9.4.

commit   : 8217370864c950ea28c7f940442fe48c701461c2    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 1 Jul 2015 10:54:47 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 1 Jul 2015 10:54:47 +0900    

Click here for diff

XLogFileCopy() was changed heavily in commit de76884. However it was  
partially reverted in commit 7abc685 and most of those changes to  
XLogFileCopy() were no longer needed. Then commit 7cbee7c removed  
those unnecessary code, but XLogFileCopy() looked different in master  
and 9.4 though the contents are almost the same.  
  
This patch makes XLogFileCopy() look the same in master and back-branches,  
which makes back-patching easier, per discussion on pgsql-hackers.  
Back-patch to 9.5.  
  
Discussion: [email protected]  
  
Michael Paquier  

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

commit   : 7f32dbcd73b9a75d09db386fa81c31f42e6f0d3a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 30 Jun 2015 18:47:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 30 Jun 2015 18:47:32 -0400    

Click here for diff

HP's web server has apparently become case-sensitive sometime recently.  
Per bug #13479 from Daniel Abraham.  Corrected link identified by Alvaro.  

M doc/src/sgml/runtime.sgml

Fix typo and omission in my earlier 9.5 release notes commit.

commit   : 1561b541fd43b492ed9fe1b5c907bd88f54d1053    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 30 Jun 2015 21:09:51 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 30 Jun 2015 21:09:51 +0200    

Click here for diff

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

Improve 9.5 release notes.

commit   : c0b0501925eacbf2d9c10cd231bf8a14e7c9ef4c    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 30 Jun 2015 21:00:12 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 30 Jun 2015 21:00:12 +0200    

Click here for diff

1) Add sgml comments referencing commits. This is useful to search for  
   missing items etc.  
  
   The comments containing the commit notes are an excerpt from:  
   git log --date=short \  
       --pretty='format:%cd [%h] %<(8,trunc)%cN: %<(48,trunc)%s%n%n%w(,4,4)%b%n' \  
       $(git merge-base origin/master upstream/REL9_4_STABLE)..origin/master  
2) Improve a handful of existing notes  
3) Add missing entries about a couple features.  
4) Add a bunch of straight-forward FIXMEs  

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

Stamp shared-library minor version numbers for 9.6.

commit   : 019f7813da69da05484faa63b6a29a8df773d19b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 30 Jun 2015 14:06:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 30 Jun 2015 14:06:04 -0400    

Click here for diff

M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/libpq/Makefile
M src/tools/msvc/Mkvcbuild.pm

Stamp HEAD as 9.6devel.

commit   : cf8d65de10ebd026f6534eeb275cae46d7bffb4f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 30 Jun 2015 14:01:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 30 Jun 2015 14:01:15 -0400    

Click here for diff

Let the hacking begin ...  

M configure
M configure.in
M doc/bug.template
M src/include/pg_config.h.win32
M src/interfaces/libpq/libpq.rc.in
M src/port/win32ver.rc
M src/tools/git_changelog
M src/tools/version_stamp.pl