PostgreSQL 10.0 commit log

Stamp 10.0.

commit   : 5df0e99bea1c3e5fbffa7fbd0982da88ea149bb6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Oct 2017 17:09:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Oct 2017 17:09:15 -0400    

Click here for diff

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

Translation updates

commit   : 1f19550a874d02c6e9f6192ed1a97995f9598f53    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 2 Oct 2017 12:03:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 2 Oct 2017 12:03:01 -0400    

Click here for diff

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

M src/backend/po/de.po
M src/backend/po/fr.po
M src/backend/po/it.po
M src/backend/po/ko.po
M src/backend/po/ru.po
M src/bin/pg_archivecleanup/po/ko.po
M src/bin/pg_archivecleanup/po/ru.po
M src/bin/pg_basebackup/po/ko.po
M src/bin/pg_basebackup/po/ru.po
M src/bin/pg_ctl/po/ru.po
M src/bin/pg_dump/po/ko.po
M src/bin/pg_dump/po/ru.po
M src/bin/pg_dump/po/sv.po
M src/bin/pg_resetwal/po/ru.po
M src/bin/pg_rewind/po/ko.po
M src/bin/pg_rewind/po/ru.po
M src/bin/pg_test_fsync/po/ko.po
M src/bin/pg_test_fsync/po/ru.po
M src/bin/pg_test_timing/po/es.po
M src/bin/pg_test_timing/po/ko.po
M src/bin/pg_test_timing/po/ru.po
M src/bin/pg_upgrade/po/ko.po
M src/bin/pg_upgrade/po/ru.po
M src/bin/pg_waldump/nls.mk
A src/bin/pg_waldump/po/ko.po
A src/bin/pg_waldump/po/ru.po
M src/bin/psql/po/de.po
M src/bin/psql/po/fr.po
M src/bin/psql/po/it.po
M src/bin/psql/po/ko.po
M src/bin/psql/po/ru.po
M src/bin/psql/po/sv.po
M src/interfaces/libpq/po/ko.po
M src/interfaces/libpq/po/ru.po
M src/pl/plpgsql/src/po/sv.po
M src/pl/plpython/po/ru.po
M src/pl/tcl/nls.mk
A src/pl/tcl/po/ko.po

Expand collation documentation

commit   : b6cbd30582a5a58ef0ce7a16c2b003b318d63619    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Sep 2017 13:51:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Sep 2017 13:51:01 -0400    

Click here for diff

Document better how to create custom collations and what locale strings  
ICU accepts.  Explain the ICU examples in more detail.  Also update the  
text on the CREATE COLLATION reference page a bit to take ICU more into  
account.  

M doc/src/sgml/charset.sgml
M doc/src/sgml/ref/create_collation.sgml

Update v10 release notes, and set the official release date.

commit   : 086fda9073d37b519519926136c9fe5418451c0e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 1 Oct 2017 13:32:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 1 Oct 2017 13:32:26 -0400    

Click here for diff

Last(?) round of changes for 10.0.  

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

Use a longer connection timeout in pg_isready test.

commit   : 1a6b2b16565aa70f663f83aa6c47b4cbc545eeb2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 1 Oct 2017 12:43:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 1 Oct 2017 12:43:47 -0400    

Click here for diff

Buildfarm members skink and sungazer have both recently failed this  
test, with symptoms indicating that the default 3-second timeout  
isn't quite enough for those very slow systems.  There's no reason  
to be miserly with this timeout, so boost it to 60 seconds.  
  
Back-patch to all versions containing this test.  That may be overkill,  
because the failure has only been observed in the v10 branch, but  
I don't feel like having to revisit this later.  

M src/bin/scripts/t/080_pg_isready.pl

Add list of acknowledgments to release notes

commit   : e775dd6a4b1b87cd367a725f8840f068f2daae27    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 1 Oct 2017 08:51:20 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 1 Oct 2017 08:51:20 -0400    

Click here for diff

This contains all individuals mentioned in the commit messages during  
PostgreSQL 10 development.  
  
current through babf18579455e85269ad75e1ddb03f34138f77b6  
  
Discussion: https://www.postgresql.org/message-id/flat/54ad0e42-770e-dfe1-123e-bce9361ad452%402ndquadrant.com  

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

Fix busy-wait in pgbench, with --rate.

commit   : babf18579455e85269ad75e1ddb03f34138f77b6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 1 Oct 2017 09:29:27 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 1 Oct 2017 09:29:27 +0300    

Click here for diff

If --rate was used to throttle pgbench, it failed to sleep when it had  
nothing to do, leading to a busy-wait with 100% CPU usage. This bug was  
introduced in the refactoring in v10. Before that, sleep() was called with  
a timeout, even when there were no file descriptors to wait for.  
  
Reported by Jeff Janes, patch by Fabien COELHO. Backpatch to v10.  
  
Discussion: https://www.postgresql.org/message-id/CAMkU%3D1x5hoX0pLLKPRnXCy0T8uHoDvXdq%2B7kAM9eoC9_z72ucw%40mail.gmail.com  

M src/bin/pgbench/pgbench.c

Fix inadequate locking during get_rel_oids().

commit   : 2aab70205be012d06f7d077dd1fa5e6afea9d19c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Sep 2017 16:26:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Sep 2017 16:26:21 -0400    

Click here for diff

get_rel_oids used to not take any relation locks at all, but that stopped  
being a good idea with commit 3c3bb9933, which inserted a syscache lookup  
into the function.  A concurrent DROP TABLE could now produce "cache lookup  
failed", which we don't want to have happen in normal operation.  The best  
solution seems to be to transiently take a lock on the relation named by  
the RangeVar (which also makes the result of RangeVarGetRelid a lot less  
spongy).  But we shouldn't hold the lock beyond this function, because we  
don't want VACUUM to lock more than one table at a time.  (That would not  
be a big problem right now, but it will become one after the pending  
feature patch to allow multiple tables to be named in VACUUM.)  
  
In passing, adjust vacuum_rel and analyze_rel to document that we don't  
trust the passed RangeVar to be accurate, and allow the RangeVar to  
possibly be NULL --- which it is anyway for a whole-database VACUUM,  
though we accidentally didn't crash for that case.  
  
The passed RangeVar is in fact inaccurate when dealing with a child  
partition, as of v10, and it has been wrong for a whole long time in the  
case of vacuum_rel() recursing to a TOAST table.  None of these things  
present visible bugs up to now, because the passed RangeVar is in fact  
only consulted for autovacuum logging, and in that particular context it's  
always accurate because autovacuum doesn't let vacuum.c expand partitions  
nor recurse to toast tables.  Still, this seems like trouble waiting to  
happen, so let's nail the door at least partly shut.  (Further cleanup  
is planned, in HEAD only, as part of the pending feature patch.)  
  
Fix some sadly inaccurate/obsolete comments too.  Back-patch to v10.  
  
Michael Paquier and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/analyze.c
M src/backend/commands/vacuum.c

pgbench: If we fail to send a command to the server, fail.

commit   : 434146d21666dd2023705fb26582918212e124d1    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Sep 2017 13:51:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Sep 2017 13:51:14 -0400    

Click here for diff

This beats the old behavior of busy-waiting hands down.  
  
Oversight in commit 12788ae49e1933f463bc59a6efe46c4a01701b76.  
  
Report by Pavan Deolasee. Patch by Fabien Coelho.  Reviewed by  
Pavan Deolasee.  
  
Discussion: http://postgr.es/m/CABOikdPhfXTypckMC1Ux6Ko+hKBWwUBA=EXsvamXYSg8M9J94w@mail.gmail.com  

M src/bin/pgbench/pgbench.c

psql: Update \d sequence display

commit   : 5cc5987cedd8c60c738135abcb25df5247db7d1e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 25 Sep 2017 11:59:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 25 Sep 2017 11:59:46 -0400    

Click here for diff

For \d sequencename, the psql code just did SELECT * FROM sequencename  
to get the information to display, but this does not contain much  
interesting information anymore in PostgreSQL 10, because the metadata  
has been moved to a separate system catalog.  
  
This patch creates a newly designed sequence display that is not merely  
an extension of the general relation/table display as it was previously.  
  
Example:  
  
PostgreSQL 9.6:  
  
=> \d foobar  
           Sequence "public.foobar"  
    Column     |  Type   |        Value  
---------------+---------+---------------------  
 sequence_name | name    | foobar  
 last_value    | bigint  | 1  
 start_value   | bigint  | 1  
 increment_by  | bigint  | 1  
 max_value     | bigint  | 9223372036854775807  
 min_value     | bigint  | 1  
 cache_value   | bigint  | 1  
 log_cnt       | bigint  | 0  
 is_cycled     | boolean | f  
 is_called     | boolean | f  
  
PostgreSQL 10 before this change:  
  
=> \d foobar  
   Sequence "public.foobar"  
   Column   |  Type   | Value  
------------+---------+-------  
 last_value | bigint  | 1  
 log_cnt    | bigint  | 0  
 is_called  | boolean | f  
  
New:  
  
=> \d foobar  
                           Sequence "public.foobar"  
  Type  | Start | Minimum |       Maximum       | Increment | Cycles? | Cache  
--------+-------+---------+---------------------+-----------+---------+-------  
 bigint |     1 |       1 | 9223372036854775807 |         1 | no      |     1  
  
Reviewed-by: Fabien COELHO <[email protected]>  

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

Fix freezing of a dead HOT-updated tuple

commit   : 46c35116ae1acc8826705ef2a7b5d9110f9d6e84    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 28 Sep 2017 16:44:01 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 28 Sep 2017 16:44:01 +0200    

Click here for diff

Vacuum calls page-level HOT prune to remove dead HOT tuples before doing  
liveness checks (HeapTupleSatisfiesVacuum) on the remaining tuples.  But  
concurrent transaction commit/abort may turn DEAD some of the HOT tuples  
that survived the prune, before HeapTupleSatisfiesVacuum tests them.  
This happens to activate the code that decides to freeze the tuple ...  
which resuscitates it, duplicating data.  
  
(This is especially bad if there's any unique constraints, because those  
are now internally violated due to the duplicate entries, though you  
won't know until you try to REINDEX or dump/restore the table.)  
  
One possible fix would be to simply skip doing anything to the tuple,  
and hope that the next HOT prune would remove it.  But there is a  
problem: if the tuple is older than freeze horizon, this would leave an  
unfrozen XID behind, and if no HOT prune happens to clean it up before  
the containing pg_clog segment is truncated away, it'd later cause an  
error when the XID is looked up.  
  
Fix the problem by having the tuple freezing routines cope with the  
situation: don't freeze the tuple (and keep it dead).  In the cases that  
the XID is older than the freeze age, set the HEAP_XMAX_COMMITTED flag  
so that there is no need to look up the XID in pg_clog later on.  
  
An isolation test is included, authored by Michael Paquier, loosely  
based on Daniel Wood's original reproducer.  It only tests one  
particular scenario, though, not all the possible ways for this problem  
to surface; it be good to have a more reliable way to test this more  
fully, but it'd require more work.  
In message https://postgr.es/m/[email protected]  
I outlined another test case (more closely matching Dan Wood's) that  
exposed a few more ways for the problem to occur.  
  
Backpatch all the way back to 9.3, where this problem was introduced by  
multixact juggling.  In branches 9.3 and 9.4, this includes a backpatch  
of commit e5ff9fefcd50 (of 9.5 era), since the original is not  
correctable without matching the coding pattern in 9.5 up.  
  
Reported-by: Daniel Wood  
Diagnosed-by: Daniel Wood  
Reviewed-by: Yi Wen Wong, Michaƫl Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/commands/vacuumlazy.c
A src/test/isolation/expected/freeze-the-dead.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/freeze-the-dead.spec

Fix behavior when converting a float infinity to numeric.

commit   : 07ea925e20ee80898638800c8479b48e7e97d431    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 Sep 2017 17:05:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 Sep 2017 17:05:53 -0400    

Click here for diff

float8_numeric() and float4_numeric() failed to consider the possibility  
that the input is an IEEE infinity.  The results depended on the  
platform-specific behavior of sprintf(): on most platforms you'd get  
something like  
  
ERROR:  invalid input syntax for type numeric: "inf"  
  
but at least on Windows it's possible for the conversion to succeed and  
deliver a finite value (typically 1), due to a nonstandard output format  
from sprintf and lack of syntax error checking in these functions.  
  
Since our numeric type lacks the concept of infinity, a suitable conversion  
is impossible; the best thing to do is throw an explicit error before  
letting sprintf do its thing.  
  
While at it, let's use snprintf not sprintf.  Overrunning the buffer  
should be impossible if sprintf does what it's supposed to, but this  
is cheap insurance against a stack smash if it doesn't.  
  
Problem reported by Taiki Kondo.  Patch by me based on fix suggestion  
from KaiGai Kohei.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Revert to 9.6 treatment of ALTER TYPE enumtype ADD VALUE.

commit   : 93a1af0b3f63838774a9e524589344c3d44c867d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 Sep 2017 16:14:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 Sep 2017 16:14:37 -0400    

Click here for diff

This reverts commit 15bc038f9, along with the followon commits 1635e80d3  
and 984c92074 that tried to clean up the problems exposed by bug #14825.  
The result was incomplete because it failed to address parallel-query  
requirements.  With 10.0 release so close upon us, now does not seem like  
the time to be adding more code to fix that.  I hope we can un-revert this  
code and add the missing parallel query support during the v11 cycle.  
  
Back-patch to v10.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_type.sgml
M src/backend/access/transam/xact.c
M src/backend/catalog/pg_enum.c
M src/backend/commands/typecmds.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/enum.c
M src/backend/utils/errcodes.txt
M src/include/catalog/pg_enum.h
M src/include/commands/typecmds.h
M src/test/regress/expected/enum.out
M src/test/regress/sql/enum.sql

Improve the CREATE POLICY documentation.

commit   : 4d5d08c1cd52add02bdfadc00854135a3b6c88f6    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 27 Sep 2017 17:13:37 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 27 Sep 2017 17:13:37 +0100    

Click here for diff

Provide a correct description of how multiple policies are combined,  
clarify when SELECT permissions are required, mention SELECT FOR  
UPDATE/SHARE, and do some other more minor tidying up.  
  
Reviewed by Stephen Frost  
  
Discussion: https://postgr.es/m/CAEZATCVrxyYbOFU8XbGHicz%2BmXPYzw%3DhfNL2XTphDt-53TomQQ%40mail.gmail.com  
  
Back-patch to 9.5.  

M doc/src/sgml/ref/create_policy.sgml

Don't recommend "DROP SCHEMA information_schema CASCADE".

commit   : bfd551570265049ea17f18f65a156c1d8ba66a23    
  
author   : Noah Misch <[email protected]>    
date     : Tue, 26 Sep 2017 22:39:44 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Tue, 26 Sep 2017 22:39:44 -0700    

Click here for diff

It drops objects outside information_schema that depend on objects  
inside information_schema.  For example, it will drop a user-defined  
view if the view query refers to information_schema.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve wording of error message added in commit 714805010.

commit   : 9ebc7781444fd15d56ed16e5312a954483e85cd9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Sep 2017 15:25:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Sep 2017 15:25:56 -0400    

Click here for diff

Per suggestions from Peter Eisentraut and David Johnston.  
Back-patch, like the previous commit.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix failure-to-read-man-page in commit 899bd785c.

commit   : d29f30d8c3b2a9d8c57324355df8a8d9da1d9c12    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Sep 2017 13:42:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Sep 2017 13:42:53 -0400    

Click here for diff

posix_fallocate() is not quite a drop-in replacement for fallocate(),  
because it is defined to return the error code as its function result,  
not in "errno".  I (tgl) missed this because RHEL6's version seems  
to set errno as well.  That is not the case on more modern Linuxen,  
though, as per buildfarm results.  
  
Aside from fixing the return-convention confusion, remove the test  
for ENOSYS; we expect that glibc will mask that for posix_fallocate,  
though it does not for fallocate.  Keep the test for EINTR, because  
POSIX specifies that as a possible result, and buildfarm results  
suggest that it can happen in practice.  
  
Back-patch to 9.4, like the previous commit.  
  
Thomas Munro  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove heuristic same-transaction test from check_safe_enum_use().

commit   : 01c5de88ff242b379a033e46e4da6476f2213029    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Sep 2017 13:12:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Sep 2017 13:12:13 -0400    

Click here for diff

The blacklist mechanism added by the preceding commit directly fixes  
most of the practical cases that the same-transaction test was meant  
to cover.  What remains is use-cases like  
  
	begin;  
	create type e as enum('x');  
	alter type e add value 'y';  
	-- use 'y' somehow  
	commit;  
  
However, because the same-transaction test is heuristic, it fails on  
small variants of that, such as renaming the type or changing its  
owner.  Rather than try to explain the behavior to users, let's  
remove it and just have a rule that the newly added value can't be  
used before being committed, full stop.  Perhaps later it will be  
worth the implementation effort and overhead to have a more accurate  
test for type-was-created-in-this-transaction.  We'll wait for some  
field experience with v10 before deciding to do that.  
  
Back-patch to v10.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_type.sgml
M src/backend/utils/adt/enum.c
M src/test/regress/expected/enum.out
M src/test/regress/sql/enum.sql

Use a blacklist to distinguish original from add-on enum values.

commit   : 175774d2932d969875b0709ec5f400ba19000c99    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Sep 2017 13:12:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Sep 2017 13:12:03 -0400    

Click here for diff

Commit 15bc038f9 allowed ALTER TYPE ADD VALUE to be executed inside  
transaction blocks, by disallowing the use of the added value later  
in the same transaction, except under limited circumstances.  However,  
the test for "limited circumstances" was heuristic and could reject  
references to enum values that were created during CREATE TYPE AS ENUM,  
not just later.  This breaks the use-case of restoring pg_dump scripts  
in a single transaction, as reported in bug #14825 from Balazs Szilfai.  
  
We can improve this by keeping a "blacklist" table of enum value OIDs  
created by ALTER TYPE ADD VALUE during the current transaction.  Any  
visible-but-uncommitted value whose OID is not in the blacklist must  
have been created by CREATE TYPE AS ENUM, and can be used safely  
because it could not have a lifespan shorter than its parent enum type.  
  
This change also removes the restriction that a renamed enum value  
can't be used before being committed (unless it was on the blacklist).  
  
Andrew Dunstan, with cosmetic improvements by me.  
Back-patch to v10.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_type.sgml
M src/backend/access/transam/xact.c
M src/backend/catalog/pg_enum.c
M src/backend/utils/adt/enum.c
M src/include/catalog/pg_enum.h
M src/test/regress/expected/enum.out
M src/test/regress/sql/enum.sql

Handle heap rewrites better in logical replication

commit   : 1a499c252049dad9016a04bcbab27b8c616d4d03    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2017 10:03:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2017 10:03:56 -0400    

Click here for diff

A FOR ALL TABLES publication naturally considers all base tables to be a  
candidate for replication.  This includes transient heaps that are  
created during a table rewrite during DDL.  This causes failures on the  
subscriber side because it will not have a table like pg_temp_16386 to  
receive data (and if it did, it would be the wrong table).  
  
The prevent this problem, we filter out any tables that match this  
naming pattern and match an actual table from FOR ALL TABLES  
publications.  This is only a heuristic, meaning that user tables that  
match that naming could accidentally be omitted.  A more robust solution  
might require an explicit marking of such tables in pg_class somehow.  
  
Reported-by: yxq <[email protected]>  
Bug: #14785  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Petr Jelinek <[email protected]>  

M src/backend/replication/pgoutput/pgoutput.c
A src/test/subscription/t/006_rewrite.pl

Avoid SIGBUS on Linux when a DSM memory request overruns tmpfs.

commit   : 4621c7f7a432fbb24b69c5cf0c877c17832c26ac    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Sep 2017 16:09:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Sep 2017 16:09:19 -0400    

Click here for diff

On Linux, shared memory segments created with shm_open() are backed by  
swap files created in tmpfs.  If the swap file needs to be extended,  
but there's no tmpfs space left, you get a very unfriendly SIGBUS trap.  
To avoid this, force allocation of the full request size when we create  
the segment.  This adds a few cycles, but none that we wouldn't expend  
later anyway, assuming the request isn't hugely bigger than the actual  
need.  
  
Make this code #ifdef __linux__, because (a) there's not currently a  
reason to think the same problem exists on other platforms, and (b)  
applying posix_fallocate() to an FD created by shm_open() isn't very  
portable anyway.  
  
Back-patch to 9.4 where the DSM code came in.  
  
Thomas Munro, per a bug report from Amul Sul  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/backend/storage/ipc/dsm_impl.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Support building with Visual Studio 2017

commit   : 99e90bac4f9f3bd8d7b285a6f4095c2089e09efe    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 25 Sep 2017 08:03:05 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 25 Sep 2017 08:03:05 -0400    

Click here for diff

Haribabu Kommi, reviewed by Takeshi Ideriha and Christian Ullrich  
  
Backpatch to 9.6  

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

Allow ICU to use SortSupport on Windows with UTF-8

commit   : 29923859f91f94c97417b8417ff8475cf4261be1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 24 Sep 2017 00:56:31 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 24 Sep 2017 00:56:31 -0400    

Click here for diff

There is no reason to ever prevent the use of SortSupport on Windows  
when ICU locales are used.  We previously avoided SortSupport on Windows  
with UTF-8 server encoding and a non C-locale due to restrictions in  
Windows' libc functionality.  
  
This is now considered to be a restriction in one platform's libc  
collation provider, and not a more general platform restriction.  
  
Reported-by: Peter Geoghegan <[email protected]>  

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

doc: Expand user documentation on SCRAM

commit   : 33e2f346b0689cf7631fcfe7db91dc56767f2659    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 24 Sep 2017 00:29:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 24 Sep 2017 00:29:59 -0400    

Click here for diff

Explain more about how the different password authentication methods and  
the password_encryption settings relate to each other, give some  
upgrading advice, and set a better link from the release notes.  
  
Reviewed-by: Jeff Janes <[email protected]>  

M doc/src/sgml/client-auth.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/release-10.sgml

Fix pg_basebackup test to original intent

commit   : 7c8ce791d4b3e774ffe4c7c987a7055619663818    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 23 Sep 2017 22:59:26 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 23 Sep 2017 22:59:26 -0400    

Click here for diff

One test case was meant to check that pg_basebackup does not succeed  
when a slot is specified with -S but WAL streaming is not selected,  
which used to require specifying -X stream.  Since -X stream is the  
default in PostgreSQL 10, this test case no longer covers that meaning,  
but the pg_basebackup invocation happened to fail anyway for the  
unrelated reason that the specified replication slot does not exist.  To  
fix, move the test case to later in the file where the slot does exist,  
and add -X none to the invocation so that it covers the originally meant  
behavior.  
  
extracted from a patch by Michael Banck <[email protected]>  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Fix saving and restoring umask

commit   : 3d7f11a0fabb038ce5c630b87dfadd8b625347fe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Sep 2017 16:50:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Sep 2017 16:50:59 -0400    

Click here for diff

In two cases, we set a different umask for some piece of code and  
restore it afterwards.  But if the contained code errors out, the umask  
is not restored.  So add TRY/CATCH blocks to fix that.  

M src/backend/commands/copy.c
M src/backend/libpq/be-fsstubs.c

Test BRIN autosummarization

commit   : 3571a53345bb4d3d055d8a720e9817038927877e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 23 Sep 2017 14:05:57 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 23 Sep 2017 14:05:57 +0200    

Click here for diff

There was no coverage for this code.  
  
Reported-by: Nikolay Shaplov, Tom Lane  
Discussion: https://postgr.es/m/2700647.XEouBYNZic@x200m  
	https://postgr.es/m/[email protected]  

M src/test/modules/brin/Makefile
A src/test/modules/brin/t/01_workitems.pl

doc: Document commands that cannot be run in a transaction block

commit   : e114289e1e4774dfc3371372e36b3f0fed66b741    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Sep 2017 15:01:13 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Sep 2017 15:01:13 -0400    

Click here for diff

Mainly covering the new CREATE SUBSCRIPTION and DROP SUBSCRIPTION, but  
ALTER DATABASE SET TABLESPACE was also missing.  

M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/drop_subscription.sgml

For wal_consistency_checking, mask page checksum as well as page LSN.

commit   : 1a44df007c9b9adc5e6082fc90fe68e615d38ecd    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 22 Sep 2017 14:28:22 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 22 Sep 2017 14:28:22 -0400    

Click here for diff

If the LSN is different, the checksum will be different, too.  
  
Ashwin Agrawal, reviewed by Michael Paquier and Kuntal Ghosh  
  
Discussion: http://postgr.es/m/CALfoeis5iqrAU-+JAN+ZzXkpPr7+-0OAGv7QUHwFn=-wDy4o4Q@mail.gmail.com  

M src/backend/access/brin/brin_xlog.c
M src/backend/access/common/bufmask.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/transam/generic_xlog.c
M src/backend/commands/sequence.c
M src/include/access/bufmask.h

Fix build with !USE_WIDE_UPPER_LOWER

commit   : c08c98df3d30c0d773d5624860145fb4215b84fb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 21 Sep 2017 14:42:10 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 21 Sep 2017 14:42:10 -0400    

Click here for diff

The placement of the ifdef blocks in formatting.c was pretty bogus, so  
the code failed to compile if USE_WIDE_UPPER_LOWER was not defined.  
  
Reported-by: Peter Geoghegan <[email protected]>  
Reported-by: Noah Misch <[email protected]>  

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

Document further existing locks as wait events

commit   : e9c9ba7845c1d5a59d5f9d2429fd81638ae48a19    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 22 Sep 2017 13:35:54 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 22 Sep 2017 13:35:54 +0200    

Click here for diff

Reported-by: Jeremy Schneider  
Author: Michael Paquier  
Discussion: https://postgr.es/m/CA+fnDAZaPCwfY8Lp-pfLnUGFAXRu1VfLyRgdup-L-kwcBj8MqQ@mail.gmail.com  

M doc/src/sgml/monitoring.sgml

Sync our copy of the timezone library with IANA tzcode master.

commit   : 3876b16ce3f30fcd8e10738d4449f8c51a695b17    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Sep 2017 00:04:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Sep 2017 00:04:21 -0400    

Click here for diff

This patch absorbs a few unreleased fixes in the IANA code.  
It corresponds to commit 2d8b944c1cec0808ac4f7a9ee1a463c28f9cd00a  
in https://github.com/eggert/tz.  Non-cosmetic changes include:  
  
TZDEFRULESTRING is updated to match current US DST practice,  
rather than what it was over ten years ago.  This only matters  
for interpretation of POSIX-style zone names (e.g., "EST5EDT"),  
and only if the timezone database doesn't include either an exact  
match for the zone name or a "posixrules" entry.  The latter  
should not be true in any current Postgres installation, but  
this could possibly matter when using --with-system-tzdata.  
  
Get rid of a nonportable use of "++var" on a bool var.  
This is part of a larger fix that eliminates some vestigial  
support for consecutive leap seconds, and adds checks to  
the "zic" compiler that the data files do not specify that.  
  
Remove a couple of ancient compatibility hacks.  The IANA  
crew think these are obsolete, and I tend to agree.  But  
perhaps our buildfarm will think different.  
  
Back-patch to all supported branches, in line with our policy  
that all branches should be using current IANA code.  Before v10,  
this includes application of current pgindent rules, to avoid  
whitespace problems in future back-patches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/timezone/localtime.c
M src/timezone/private.h
M src/timezone/strftime.c
M src/timezone/zic.c

Give a better error for duplicate entries in VACUUM/ANALYZE column list.

commit   : a2b1eb23496e9abd695036e3cbb1d39c05618692    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Sep 2017 18:13:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Sep 2017 18:13:11 -0400    

Click here for diff

Previously, the code didn't think about this case and would just try to  
analyze such a column twice.  That would fail at the point of inserting  
the second version of the pg_statistic row, with obscure error messsages  
like "duplicate key value violates unique constraint" or "tuple already  
updated by self", depending on context and PG version.  We could allow  
the case by ignoring duplicate column specifications, but it seems better  
to reject it explicitly.  
  
The bogus error messages seem like arguably a bug, so back-patch to  
all supported versions.  
  
Nathan Bossart, per a report from Michael Paquier, and whacked  
around a bit by me.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve dubious memory management in pg_newlocale_from_collation().

commit   : 97514bf88bd96a4f213fbe6ae6911ba1dd033b8b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Sep 2017 13:52:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Sep 2017 13:52:36 -0400    

Click here for diff

pg_newlocale_from_collation() used malloc() and strdup() directly,  
which is generally not per backend coding style, and it didn't bother  
to check for failure results, but would just SIGSEGV instead.  Also,  
if one of the numerous error checks in the middle of the function  
failed, the already-allocated memory would be leaked permanently.  
Admittedly, it's not a lot of memory, but it could build up if this  
function were called repeatedly for a bad collation.  
  
The first two problems are easily cured by palloc'ing in TopMemoryContext  
instead of calling libc directly.  We can fairly easily dodge the leakage  
problem for the struct pg_locale_struct by filling in a temporary variable  
and allocating permanent storage only once we reach the bottom of the  
function.  It's harder to get rid of the potential leakage for ICU's copy  
of the collcollate string, but at least that's only allocated after most  
of the error checks; so live with that aspect.  
  
Back-patch to v10 where this code came in, with one or another of the  
ICU patches.  

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

Fix instability in subscription regression test.

commit   : ee266774454d5cce3375145e2f86a99910eb263f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Sep 2017 11:28:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Sep 2017 11:28:34 -0400    

Click here for diff

005_encoding.pl neglected to wait for the subscriber's initial  
synchronization to happen.  While we have not seen this fail in  
the buildfarm, it's pretty easy to demonstrate there's an issue  
by hacking logicalrep_worker_launch() to fail most of the time.  
  
Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/subscription/t/005_encoding.pl

Fix erroneous documentation about noise word GROUP.

commit   : e77730721f5faddb28fd11912f7968ddfd8b58c2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Sep 2017 11:10:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Sep 2017 11:10:42 -0400    

Click here for diff

GRANT, REVOKE, and some allied commands allow the noise word GROUP  
before a role name (cf. grantee production in gram.y).  This option  
does not exist elsewhere, but it had nonetheless snuck into the  
documentation for ALTER ROLE, ALTER USER, and CREATE SCHEMA.  
  
Seems to be a copy-and-pasteo in commit 31eae6028, which did expand the  
syntax choices here, but not in that way.  Back-patch to 9.5 where that  
came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/alter_user.sgml
M doc/src/sgml/ref/create_schema.sgml

docs: re-add instructions on setting wal_level for rsync use

commit   : 4131cc6b90ce274a44462627a1c878bf1950838b    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 20 Sep 2017 09:36:19 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 20 Sep 2017 09:36:19 -0400    

Click here for diff

This step was erroneously removed four days ago by me.  
  
Reported-by: Magnus via IM  
  
Backpatch-through: 9.5  

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

Mention need for --no-inc-recursive in rsync command

commit   : 0017aa981fef11f48a4c347b512d21f41d6e1ee1    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 20 Sep 2017 14:09:05 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 20 Sep 2017 14:09:05 +0200    

Click here for diff

Since rsync 3.0.0 (released in 2008), the default way to enumerate  
changes was changed in a way that makes it less likely that the hardlink  
sync mode works. Since the whole point of the documented procedure is  
for the hardlinks to work, change our docs to suggest using the  
backwards compatibility switch.  

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

doc: add example of % substitution for connection URIs

commit   : ba01ef267ee48e86566886376c41d0a20551713c    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 19 Sep 2017 12:23:18 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 19 Sep 2017 12:23:18 -0400    

Click here for diff

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

M doc/src/sgml/libpq.sgml

Stamp 10rc1.

commit   : dc28213c3e0b8f2b71d75bb8c779b9dd0fce5670    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Sep 2017 17:28:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Sep 2017 17:28:38 -0400    

Click here for diff

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

Fixed ECPG to correctly handle out-of-scope cursor declarations with pointers or array variables.

commit   : 75fbf8ad1209e3711704dd6194926a2d60a8d849    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 11 Sep 2017 21:10:36 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 11 Sep 2017 21:10:36 +0200    

Click here for diff

M src/interfaces/ecpg/preproc/ecpg.header

Fix, or at least ameliorate, bugs in logicalrep_worker_launch().

commit   : c1bde0747983993a695d12c4403a730b2be579d2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Sep 2017 11:39:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Sep 2017 11:39:44 -0400    

Click here for diff

If we failed to get a background worker slot, the code just walked  
away from the logicalrep-worker slot it already had, leaving that  
looking like the worker is still starting up.  This led to an indefinite  
hang in subscription startup, as reported by Thomas Munro.  We must  
release the slot on failure.  
  
Also fix a thinko: we must capture the worker slot's generation before  
releasing LogicalRepWorkerLock the first time, else testing to see if  
it's changed is pretty meaningless.  
  
BTW, the CHECK_FOR_INTERRUPTS() in WaitForReplicationWorkerAttach is a  
ticking time bomb, even without considering the possibility of elog(ERROR)  
in one of the other functions it calls.  Really, this entire business needs  
a redesign with some actual thought about error recovery.  But for now  
I'm just band-aiding the case observed in testing.  
  
Back-patch to v10 where this code was added.  
  
Discussion: https://postgr.es/m/CAEepm=2bP3TBMFBArP6o20AZaRduWjMnjCjt22hSdnA-EvrtCw@mail.gmail.com  

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

commit   : 90906b855e8867f001339259ae5abd2048b92ac6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Sep 2017 11:09:15 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Sep 2017 11:09:15 -0400    

Click here for diff

M doc/src/sgml/sepgsql.sgml

commit   : 4f75e3bbd96fcb73e4995428c595b2698471871a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Sep 2017 10:41:48 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Sep 2017 10:41:48 -0400    

Click here for diff

M doc/src/sgml/installation.sgml

Translation updates

commit   : b2800df278b3914044285980826b5c9db308971f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Sep 2017 09:09:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Sep 2017 09:09:36 -0400    

Click here for diff

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

M src/bin/pg_basebackup/po/sv.po
M src/bin/pg_dump/po/es.po
M src/bin/pg_rewind/po/es.po
M src/bin/pg_rewind/po/fr.po
M src/bin/pg_test_fsync/po/es.po
M src/bin/pg_test_timing/po/fr.po
M src/bin/pg_upgrade/po/fr.po
M src/bin/psql/po/de.po
M src/bin/psql/po/fr.po
M src/bin/psql/po/sv.po
M src/interfaces/libpq/po/fr.po

Fix DROP SUBSCRIPTION hang

commit   : 522b028a0000d08c6d113c2334e669dd31a6b1cd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 17 Sep 2017 21:37:02 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 17 Sep 2017 21:37:02 -0400    

Click here for diff

When ALTER SUBSCRIPTION DISABLE is run in the same transaction before  
DROP SUBSCRIPTION, the latter will hang because workers will still be  
running, not having seen the DISABLE committed, and DROP SUBSCRIPTION  
will wait until the workers have vacated the replication origin slots.  
  
Previously, DROP SUBSCRIPTION killed the logical replication workers  
immediately only if it was going to drop the replication slot, otherwise  
it scheduled the worker killing for the end of the transaction, as a  
result of 7e174fa793a2df89fe03d002a5087ef67abcdde8.  This, however,  
causes the present problem.  To fix, kill the workers immediately in all  
cases.  This covers all cases: A subscription that doesn't have a  
replication slot must be disabled.  It was either disabled in the same  
transaction, or it was already disabled before the current transaction,  
but then there shouldn't be any workers left and this won't make a  
difference.  
  
Reported-by: Arseny Sher <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/87mv6av84w.fsf%40ars-thinkpad  

M src/backend/commands/subscriptioncmds.c
A src/test/subscription/t/007_ddl.pl

Doc: update v10 release notes through today.

commit   : 90cebfa9ee3a4110c83c6b012ec523adcc1c2468    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Sep 2017 17:04:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Sep 2017 17:04:21 -0400    

Click here for diff

Add item about number of times statement-level triggers will be fired.  
Rearrange the compatibility items into (what seems to me) a less  
random ordering.  

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

Allow rel_is_distinct_for() to look through RelabelType below OpExpr.

commit   : 244b4a37eb8e253e5221477534c2a2f0a9c23630    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Sep 2017 15:28:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Sep 2017 15:28:51 -0400    

Click here for diff

This lets it do the right thing for, eg, varchar columns.  
Back-patch to 9.5 where this logic appeared.  
  
David Rowley, per report from Kim Rose Carlsen  
  
Discussion: https://postgr.es/m/VI1PR05MB17091F9A9876528055D6A827C76D0@VI1PR05MB1709.eurprd05.prod.outlook.com  

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

Fix possible dangling pointer dereference in trigger.c.

commit   : 66fe509be0166058f53bf857b21eae125de30fc5    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Sep 2017 14:50:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Sep 2017 14:50:01 -0400    

Click here for diff

AfterTriggerEndQuery correctly notes that the query_stack could get  
repalloc'd during a trigger firing, but it nonetheless passes the address  
of a query_stack entry to afterTriggerInvokeEvents, so that if such a  
repalloc occurs, afterTriggerInvokeEvents is already working with an  
obsolete dangling pointer while it scans the rest of the events.  Oops.  
The only code at risk is its "delete_ok" cleanup code, so we can  
prevent unsafe behavior by passing delete_ok = false instead of true.  
  
However, that could have a significant performance penalty, because the  
point of passing delete_ok = true is to not have to re-scan possibly  
a large number of dead trigger events on the next time through the loop.  
There's more than one way to skin that cat, though.  What we can do is  
delete all the "chunks" in the event list except the last one, since  
we know all events in them must be dead.  Deleting the chunks is work  
we'd have had to do later in AfterTriggerEndQuery anyway, and it ends  
up saving rescanning of just about the same events we'd have gotten  
rid of with delete_ok = true.  
  
In v10 and HEAD, we also have to be careful to mop up any per-table  
after_trig_events pointers that would become dangling.  This is slightly  
annoying, but I don't think that normal use-cases will traverse this code  
path often enough for it to be a performance problem.  
  
It's pretty hard to hit this in practice because of the unlikelihood  
of the query_stack getting resized at just the wrong time.  Nonetheless,  
it's definitely a live bug of ancient standing, so back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/trigger.c

Ensure that BEFORE STATEMENT triggers fire the right number of times.

commit   : 5cc23493195cbd2205d5e476e725657c0a29ea34    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Sep 2017 12:16:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Sep 2017 12:16:38 -0400    

Click here for diff

Commit 0f79440fb introduced mechanism to keep AFTER STATEMENT triggers  
from firing more than once per statement, which was formerly possible  
if more than one FK enforcement action had to be applied to a given  
table.  Add a similar mechanism for BEFORE STATEMENT triggers, so that  
we don't have the unexpected situation of firing BEFORE STATEMENT  
triggers more often than AFTER STATEMENT.  
  
As with the previous patch, back-patch to v10.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_trigger.sgml
M src/backend/commands/trigger.c
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Doc: add example of transition table use in a trigger.

commit   : 0749ef8e9eceb04dd8c365443d0d994f7ad34c17    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Sep 2017 15:31:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Sep 2017 15:31:26 -0400    

Click here for diff

I noticed that there were exactly no complete examples of use of  
a transition table in a trigger function, and no clear description  
of just how you'd do it either.  Improve that.  

M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/trigger.sgml

Fix SQL-spec incompatibilities in new transition table feature.

commit   : 54d4d0ff6cd40638d026c01e46deb102e7951ba6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Sep 2017 13:20:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Sep 2017 13:20:32 -0400    

Click here for diff

The standard says that all changes of the same kind (insert, update, or  
delete) caused in one table by a single SQL statement should be reported  
in a single transition table; and by that, they mean to include foreign key  
enforcement actions cascading from the statement's direct effects.  It's  
also reasonable to conclude that if the standard had wCTEs, they would say  
that effects of wCTEs applying to the same table as each other or the outer  
statement should be merged into one transition table.  We weren't doing it  
like that.  
  
Hence, arrange to merge tuples from multiple update actions into a single  
transition table as much as we can.  There is a problem, which is that if  
the firing of FK enforcement triggers and after-row triggers with  
transition tables is interspersed, we might need to report more tuples  
after some triggers have already seen the transition table.  It seems like  
a bad idea for the transition table to be mutable between trigger calls.  
There's no good way around this without a major redesign of the FK logic,  
so for now, resolve it by opening a new transition table each time this  
happens.  
  
Also, ensure that AFTER STATEMENT triggers fire just once per statement,  
or once per transition table when we're forced to make more than one.  
Previous versions of Postgres have allowed each FK enforcement query  
to cause an additional firing of the AFTER STATEMENT triggers for the  
referencing table, but that's certainly not per spec.  (We're still  
doing multiple firings of BEFORE STATEMENT triggers, though; is that  
something worth changing?)  
  
Also, forbid using transition tables with column-specific UPDATE triggers.  
The spec requires such transition tables to show only the tuples for which  
the UPDATE trigger would have fired, which means maintaining multiple  
transition tables or else somehow filtering the contents at readout.  
Maybe someday we'll bother to support that option, but it looks like a  
lot of trouble for a marginal feature.  
  
The transition tables are now managed by the AfterTriggers data structures,  
rather than being directly the responsibility of ModifyTable nodes.  This  
removes a subtransaction-lifespan memory leak introduced by my previous  
band-aid patch 3c4359521.  
  
In passing, refactor the AfterTriggers data structures to reduce the  
management overhead for them, by using arrays of structs rather than  
several parallel arrays for per-query-level and per-subtransaction state.  
  
I failed to resist the temptation to do some copy-editing on the SGML  
docs about triggers, above and beyond merely documenting the effects  
of this patch.  
  
Back-patch to v10, because we don't want the semantics of transition  
tables to change post-release.  
  
Patch by me, with help and review from Thomas Munro.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/trigger.sgml
M src/backend/commands/copy.c
M src/backend/commands/trigger.c
M src/backend/executor/README
M src/backend/executor/execMain.c
M src/backend/executor/nodeModifyTable.c
M src/include/commands/trigger.h
M src/include/nodes/execnodes.h
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

docs: clarify pg_upgrade docs regarding standbys and rsync

commit   : d2bbd6104096b1559c1683d39e2c4e4cfbcada1c    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 16 Sep 2017 11:58:00 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 16 Sep 2017 11:58:00 -0400    

Click here for diff

Document that rsync is an _optional_ way to upgrade standbys, suggest  
rsync option --dry-run, and mention a way of upgrading one standby from  
another using rsync.  Also clarify some instructions by specifying if  
they operate on the old or new clusters.  
  
Reported-by: Stephen Frost, Magnus Hagander  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

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

After a MINVALUE/MAXVALUE bound, allow only more of the same.

commit   : e8b65986ba0de2daeb5bcedc02fb936b04fe464c    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 15 Sep 2017 21:15:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 15 Sep 2017 21:15:55 -0400    

Click here for diff

In the old syntax, which used UNBOUNDED, we had a similar restriction,  
but commit d363d42bb9a4399a0207bd3b371c966e22e06bd3, which changed the  
syntax, eliminated it.  Put it back.  
  
Patch by me, reviewed by Dean Rasheed.  
  
Discussion: http://postgr.es/m/CA+Tgmobs+pLPC27tS3gOpEAxAffHrq5w509cvkwTf9pF6cWYbg@mail.gmail.com  

M doc/src/sgml/ref/create_table.sgml
M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/create_table.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/insert.out
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/insert.sql

Apply pg_get_serial_sequence() to identity column sequences as well

commit   : f830183492d3a3b74cbd33645db19b8b5b5a2622    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Sep 2017 14:04:51 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Sep 2017 14:04:51 -0400    

Click here for diff

Bug: #14813  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/identity.out
M src/test/regress/expected/sequence.out
M src/test/regress/sql/identity.sql
M src/test/regress/sql/sequence.sql

Add missing tags to GetCommandLogLevel.

commit   : a2a61f633e36445d7a15baad22d4d1db102e4a7e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 14 Sep 2017 16:25:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 14 Sep 2017 16:25:19 -0400    

Click here for diff

Otherwise, log_statement = 'ddl' causes errors if those statement  
types are used.  
  
Michael Paquier, reviewed by Ashutosh Sharma  
  
Discussion: http://postgr.es/m/CAB7nPqStC3HkE76Q1MnHsVd1vF1Td9zXApzYadzDMyLMRkkGrw@mail.gmail.com  

M src/backend/tcop/utility.c

Fix inconsistent capitalization.

commit   : 29f021160ea7bfbc02600e651cf3588bb4ce8e78    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 14 Sep 2017 11:11:12 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 14 Sep 2017 11:11:12 -0400    

Click here for diff

Amit Langote  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

Set partitioned_rels appropriately when UNION ALL is used.

commit   : 448aa36e8b969da257bb58a6fe3db6498d48d4e8    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 14 Sep 2017 10:43:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 14 Sep 2017 10:43:44 -0400    

Click here for diff

In most cases, this omission won't matter, because the appropriate  
locks will have been acquired during parse/plan or by AcquireExecutorLocks.  
But it's a bug all the same.  
  
Report by Ashutosh Bapat.  Patch by me, reviewed by Amit Langote.  
  
Discussion: http://postgr.es/m/CAFjFpRdHb_ZnoDTuBXqrudWXh3H1ibLkr6nHsCFT96fSK4DXtA@mail.gmail.com  

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

Properly check interrupts in execScan.c.

commit   : 253c8afc9eb178b7241b4cc571acf7fb6ac6f976    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 14 Sep 2017 01:53:10 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 14 Sep 2017 01:53:10 -0700    

Click here for diff

During the development of d47cfef711 the CFI()s in ExecScan() were  
moved back and forth, ending up in the wrong place. Thus queries that  
largely spend their time in ExecScan(), and have neither projection  
nor a qual, can't be cancelled in a timely manner.  
  
Reported-By: Jeff Janes  
Author: Andres Freund  
Discussion: https://postgr.es/m/CAMkU=1weDXp8eLLPt9SO1LEUsJYYK9cScaGhLKpuN+WbYo9b5g@mail.gmail.com  
Backpatch: 10, as d47cfef711  

M src/backend/executor/execScan.c

Fix ordering in pg_dump of GRANTs

commit   : 68a7c24fdf2d69fc57cfb26aba7e119aa6ca2621    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 13 Sep 2017 20:04:43 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 13 Sep 2017 20:04:43 -0400    

Click here for diff

The order in which GRANTs are output is important as GRANTs which have  
been GRANT'd by individuals via WITH GRANT OPTION GRANTs have to come  
after the GRANT which included the WITH GRANT OPTION.  This happens  
naturally in the backend during normal operation as we only change  
existing ACLs in-place, only add new ACLs to the end, and when removing  
an ACL we remove any which depend on it also.  
  
Also, adjust the comments in acl.h to make this clear.  
  
Unfortunately, the updates to pg_dump to handle initial privileges  
involved pulling apart ACLs and then combining them back together and  
could end up putting them back together in an invalid order, leading to  
dumps which wouldn't restore.  
  
Fix this by adjusting the queries used by pg_dump to ensure that the  
ACLs are rebuilt in the same order in which they were originally.  
  
Back-patch to 9.6 where the changes for initial privileges were done.  

M src/bin/pg_dump/dumputils.c
M src/include/utils/acl.h

Changed order of statements and added an additiona MSVC safeguard to make ecpg thread test cases work on Windows.

commit   : eaf7001eb7e3eecc7e30c31956860f54f1def55f    
  
author   : Michael Meskes <[email protected]>    
date     : Sat, 26 Aug 2017 19:07:25 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Sat, 26 Aug 2017 19:07:25 +0200    

Click here for diff

M src/interfaces/ecpg/test/expected/thread-alloc.c
M src/interfaces/ecpg/test/expected/thread-descriptor.c
M src/interfaces/ecpg/test/expected/thread-prep.c
M src/interfaces/ecpg/test/expected/thread-thread.c
M src/interfaces/ecpg/test/expected/thread-thread_implicit.c
M src/interfaces/ecpg/test/thread/alloc.pgc
M src/interfaces/ecpg/test/thread/descriptor.pgc
M src/interfaces/ecpg/test/thread/prep.pgc
M src/interfaces/ecpg/test/thread/thread.pgc
M src/interfaces/ecpg/test/thread/thread_implicit.pgc

Make setlocale in ECPG test cases thread aware on Windows.

commit   : 38d7cb67f2e8798d6e0ecff8334345a3ae73b902    
  
author   : Michael Meskes <[email protected]>    
date     : Sat, 26 Aug 2017 12:57:21 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Sat, 26 Aug 2017 12:57:21 +0200    

Click here for diff

Fix threaded test cases on Windows not to crash in setlocale() which can be  
global or local to a thread on Windows.  
  
Author: Christian Ullrich  

M src/interfaces/ecpg/test/expected/thread-alloc.c
M src/interfaces/ecpg/test/expected/thread-descriptor.c
M src/interfaces/ecpg/test/expected/thread-prep.c
M src/interfaces/ecpg/test/expected/thread-thread.c
M src/interfaces/ecpg/test/expected/thread-thread_implicit.c
M src/interfaces/ecpg/test/thread/alloc.pgc
M src/interfaces/ecpg/test/thread/descriptor.pgc
M src/interfaces/ecpg/test/thread/prep.pgc
M src/interfaces/ecpg/test/thread/thread.pgc
M src/interfaces/ecpg/test/thread/thread_implicit.pgc

doc: Remove incorrect SCRAM protocol documentation

commit   : d587813edba16ae52330c881c27e4c91799a0d9c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Sep 2017 10:10:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Sep 2017 10:10:34 -0400    

Click here for diff

The documentation claimed that one should send  
"pg_same_as_startup_message" as the user name in the SCRAM messages, but  
this did not match the actual implementation, so remove it.  

M doc/src/sgml/protocol.sgml

commit   : 6dffdcfeef934eb21b8a767d8be11ec33ccb56ed    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 13 Sep 2017 09:22:18 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 13 Sep 2017 09:22:18 -0400    

Click here for diff

Backpatch-through: 9.5  

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

docs: improve pg_upgrade standby instructions

commit   : aaa4faa7a00cb85322e570f2d148a51b95b847c4    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 13 Sep 2017 09:11:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 13 Sep 2017 09:11:28 -0400    

Click here for diff

This makes it clear that pg_upgrade standby upgrade instructions should  
only be used in link mode, adds examples, and explains how rsync works  
with links.  
  
Reported-by: Andreas Joseph Krogh  
  
Discussion: https://postgr.es/m/VisenaEmail.6c.c0e592c5af4ef0a2.15e785dcb61@tc7-visena  
  
Backpatch-through: 9.5  

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

Improve error message in WAL sender

commit   : 2b0ded5060cc2e0b7d6c765af5b5f7334f64f5dc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Sep 2017 08:31:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Sep 2017 08:31:03 -0400    

Click here for diff

The previous error message when attempting to run a general SQL command  
in a physical replication WAL sender was a bit sloppy.  
  
Reported-by: Fujii Masao <[email protected]>  

M src/backend/replication/walsender.c

docs: improve pg_upgrade rsync instructions

commit   : b1705f35f805933629520eded68b82d2a2900871    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 12 Sep 2017 13:17:52 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 12 Sep 2017 13:17:52 -0400    

Click here for diff

This explains how rsync accomplishes updating standby servers and  
clarifies the instructions.  
  
Reported-by: Andreas Joseph Krogh  
  
Discussion: https://postgr.es/m/VisenaEmail.10.2b4049e43870bd16.15d898d696f@tc7-visena  
  
Backpatch-through: 9.5  

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

Fix RecursiveCopy.pm to cope with disappearing files.

commit   : bd18960cb93f3b6e9f43f3cabec34f1929f05ec3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Sep 2017 22:02:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Sep 2017 22:02:58 -0400    

Click here for diff

When copying from an active database tree, it's possible for files to be  
deleted after we see them in a readdir() scan but before we can open them.  
(Once we've got a file open, we don't expect any further errors from it  
getting unlinked, though.)  Tweak RecursiveCopy so it can cope with this  
case, so as to avoid irreproducible test failures.  
  
Back-patch to 9.6 where this code was added.  In v10 and HEAD, also  
remove unused "use RecursiveCopy" in one recovery test script.  
  
Michael Paquier and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/RecursiveCopy.pm
M src/test/recovery/t/010_logical_decoding_timelines.pl

PG 10 release notes: change trigger transition tables

commit   : d4c9eb005a16ff5cdc9d5d9514a3195c60ad21ab    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 11 Sep 2017 19:56:44 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 11 Sep 2017 19:56:44 -0400    

Click here for diff

Add attribution of trigger transition tables for Thomas Munro.  
  
Reported-by: Thomas Munro  
  
Discussion: https://postgr.es/m/CAEepm=2bDFgr4ut+1-QjKQY4MA=5ek8Ap3nyB19y2tpTL6xxtA@mail.gmail.com  
  
Backpatch-through: 10  

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

PG 10 release notes: update PL/Tcl functions item

commit   : 1d27a7004d84516f5d04662c1cd52f41400b7750    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 11 Sep 2017 19:43:49 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 11 Sep 2017 19:43:49 -0400    

Click here for diff

Update attribution of PL/Tcl functions item from Jim Nasby to Karl  
Lehenbauer.  
  
Reported-by: Jim Nasby  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

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

Translation updates

commit   : bd72c37b160623bf3f1c9cea82b948ee53a22567    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Sep 2017 12:49:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Sep 2017 12:49:35 -0400    

Click here for diff

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

M src/backend/nls.mk
M src/backend/po/de.po
D src/backend/po/id.po
M src/backend/po/it.po
D src/backend/po/ja.po
D src/backend/po/pt_BR.po
M src/bin/pg_archivecleanup/po/es.po
M src/bin/pg_basebackup/nls.mk
M src/bin/pg_basebackup/po/es.po
M src/bin/pg_basebackup/po/it.po
D src/bin/pg_basebackup/po/pt_BR.po
A src/bin/pg_basebackup/po/sv.po
D src/bin/pg_basebackup/po/zh_CN.po
M src/bin/pg_ctl/po/it.po
M src/bin/pg_dump/po/it.po
M src/bin/pg_dump/po/sv.po
M src/bin/pg_resetwal/nls.mk
D src/bin/pg_resetwal/po/cs.po
D src/bin/pg_resetwal/po/it.po
M src/bin/pg_rewind/po/de.po
M src/bin/pg_rewind/po/it.po
M src/bin/pg_rewind/po/sv.po
M src/bin/pg_test_fsync/po/sv.po
M src/bin/pg_upgrade/nls.mk
A src/bin/pg_upgrade/po/de.po
M src/bin/pg_upgrade/po/sv.po
M src/bin/pg_waldump/nls.mk
D src/bin/pg_waldump/po/es.po
M src/bin/pg_waldump/po/sv.po
M src/bin/psql/nls.mk
D src/bin/psql/po/cs.po
M src/bin/psql/po/de.po
M src/bin/psql/po/it.po
D src/bin/psql/po/ja.po
M src/bin/psql/po/sv.po
D src/bin/psql/po/zh_TW.po
M src/interfaces/ecpg/ecpglib/nls.mk
A src/interfaces/ecpg/ecpglib/po/sv.po
M src/interfaces/ecpg/preproc/nls.mk
A src/interfaces/ecpg/preproc/po/sv.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/it.po
M src/interfaces/libpq/po/sv.po
D src/interfaces/libpq/po/tr.po
D src/interfaces/libpq/po/zh_TW.po
M src/pl/plperl/nls.mk
D src/pl/plperl/po/tr.po
D src/pl/plperl/po/zh_TW.po
M src/pl/plpython/nls.mk
D src/pl/plpython/po/cs.po
M src/pl/plpython/po/it.po
D src/pl/plpython/po/ja.po
M src/pl/tcl/nls.mk
D src/pl/tcl/po/cs.po
D src/pl/tcl/po/ja.po
D src/pl/tcl/po/ko.po
D src/pl/tcl/po/pt_BR.po
D src/pl/tcl/po/ro.po
D src/pl/tcl/po/tr.po
D src/pl/tcl/po/zh_CN.po
D src/pl/tcl/po/zh_TW.po

Message style fixes

commit   : f552d18f3edd178598564d20f09577a623b1e302    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Sep 2017 11:20:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Sep 2017 11:20:47 -0400    

Click here for diff

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/ref/create_statistics.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/execReplication.c
M src/backend/libpq/hba.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/txid.c
M src/backend/utils/misc/guc.c
M src/backend/utils/time/snapmgr.c
M src/bin/psql/variables.c
M src/include/catalog/pg_statistic_ext.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/psql.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/expected/triggers.out

Quick-hack fix for foreign key cascade vs triggers with transition tables.

commit   : 5c11717185bc24a2d0a20b38815e182ed99101ce    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Sep 2017 14:59:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Sep 2017 14:59:56 -0400    

Click here for diff

AFTER triggers using transition tables crashed if they were fired due  
to a foreign key ON CASCADE update.  This is because ExecEndModifyTable  
flushes the transition tables, on the assumption that any trigger that  
could need them was already fired during ExecutorFinish.  Normally  
that's true, because we don't allow transition-table-using triggers  
to be deferred.  However, foreign key CASCADE updates force any  
triggers on the referencing table to be deferred to the outer query  
level, by means of the EXEC_FLAG_SKIP_TRIGGERS flag.  I don't recall  
all the details of why it's like that and am pretty loath to redesign  
it right now.  Instead, just teach ExecEndModifyTable to skip destroying  
the TransitionCaptureState when that flag is set.  This will allow the  
transition table data to survive until end of the current subtransaction.  
  
This isn't a terribly satisfactory solution, because (1) we might be  
leaking the transition tables for much longer than really necessary,  
and (2) as things stand, an AFTER STATEMENT trigger will fire once per  
RI updating query, ie once per row updated or deleted in the referenced  
table.  I suspect that is not per SQL spec.  But redesigning this is a  
research project that we're certainly not going to get done for v10.  
So let's go with this hackish answer for now.  
  
In passing, tweak AfterTriggerSaveEvent to not save the transition_capture  
pointer into the event record for a deferrable trigger.  This is not  
necessary to fix the current bug, but it avoids letting dangling pointers  
to long-gone transition tables persist in the trigger event queue.  That's  
at least a safety feature.  It might also allow merging shared trigger  
states in more cases than before.  
  
I added a regression test that demonstrates the crash on unpatched code,  
and also exposes the behavior of firing the AFTER STATEMENT triggers  
once per row update.  
  
Per bug #14808 from Philippe Beaudoin.  Back-patch to v10.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pg_upgrade: Message style fixes

commit   : 6913d06688a2aa76580d5942b0c98751363c97e0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 9 Sep 2017 17:32:10 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 9 Sep 2017 17:32:10 -0400    

Click here for diff

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/server.c

Fix uninitialized-variable bug.

commit   : 1377b40965b257e228ae8faf45c6ce145ce357e5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 19:04:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 19:04:32 -0400    

Click here for diff

map_partition_varattnos() failed to set its found_whole_row output  
parameter if the given expression list was NIL.  This seems to be  
a pre-existing bug that chanced to be exposed by commit 6f6b99d13.  
It might be unreachable in v10, but I have little faith in that  
proposition, so back-patch.  
  
Per buildfarm.  

M src/backend/catalog/partition.c

Doc: update v10 release notes through today.

commit   : 5f0ac02d7f8ded730c27a5197f8c594302c5d7e0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 16:59:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 16:59:26 -0400    

Click here for diff

Also, another round of copy-editing.  I merged a few items that  
didn't seem to be meaningfully different from a user's perspective.  

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

Remove mention of password_encryption = plain in postgresql.conf.sample.

commit   : 730169dea70c381a959a357de5c8b56e674af805    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 14:38:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 14:38:54 -0400    

Click here for diff

Evidently missed in commit eb61136dc.  
  
Spotted by Oleg Bartunov.  
  
Discussion: https://postgr.es/m/CAF4Au4wz_iK5r4fnTnnd8XqioAZQs-P7-VsEAfivW34zMVpAmw@mail.gmail.com  

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

Even if some partitions are foreign, allow tuple routing.

commit   : 08cb36417aa22436647a1831a7d1ff6b41232280    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 7 Sep 2017 10:55:45 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 7 Sep 2017 10:55:45 -0400    

Click here for diff

This doesn't allow routing tuple to the foreign partitions themselves,  
but it permits tuples to be routed to regular partitions despite the  
presence of foreign partitions in the same inheritance hierarchy.  
  
Etsuro Fujita, reviewed by Amit Langote and by me.  
  
Discussion: http://postgr.es/m/[email protected]  

A contrib/file_fdw/data/list1.csv
A contrib/file_fdw/data/list2.bad
A contrib/file_fdw/data/list2.csv
M contrib/file_fdw/input/file_fdw.source
M contrib/file_fdw/output/file_fdw.source
M src/backend/executor/execMain.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/executor.h

Add psql variables showing server version and psql version.

commit   : a6c678f018d3a30a88440d3c20cf8e7cd6592a32    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Sep 2017 11:35:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Sep 2017 11:35:31 -0400    

Click here for diff

We already had a psql variable VERSION that shows the verbose form of  
psql's own version.  Add VERSION_NAME to show the short form (e.g.,  
"11devel") and VERSION_NUM to show the numeric form (e.g., 110000).  
Also add SERVER_VERSION_NAME and SERVER_VERSION_NUM to show the short and  
numeric forms of the server's version.  (We'd probably add SERVER_VERSION  
with the verbose string if it were readily available; but adding another  
network round trip to get it seems too expensive.)  
  
The numeric forms, in particular, are expected to be useful for scripting  
purposes, now that psql can do conditional tests.  
  
Back-patch of commit 9ae9d8c1549c384dbdb8363e1d932b7311d25c56.  
  
Fabien Coelho, reviewed by Pavel Stehule  
  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1704020917220.4632@lancre  

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

Clean up handling of dropped columns in NAMEDTUPLESTORE RTEs.

commit   : 483882905a9a5dc72c9487ceee12320b9630ba2b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Sep 2017 10:41:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Sep 2017 10:41:05 -0400    

Click here for diff

The NAMEDTUPLESTORE patch piggybacked on the infrastructure for  
TABLEFUNC/VALUES/CTE RTEs, none of which can ever have dropped columns,  
so the possibility was ignored most places.  Fix that, including adding a  
specification to parsenodes.h about what it's supposed to look like.  
  
In passing, clean up assorted comments that hadn't been maintained  
properly by said patch.  
  
Per bug #14799 from Philippe Beaudoin.  Back-patch to v10.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/relnode.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/parsenodes.h

Fix psql's --help=commands output line count.

commit   : 3fbf09563f839137e5279a390044a18e400fa074    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Sep 2017 16:41:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Sep 2017 16:41:22 -0400    

Click here for diff

Evidently somebody neglected to update this sometime in the v10 cycle.  
  
Patching REL_10_STABLE only; this value is about to be obsolete in  
HEAD anyway.  Noted while examining \gdesc patch.  

M src/bin/psql/help.c

Correct base backup throttling

commit   : 1861b20cd63ba3a2e9d547858fc4e05d882531c7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 5 Sep 2017 16:59:39 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 5 Sep 2017 16:59:39 +0200    

Click here for diff

Throttling for sending a base backup in walsender is broken for the case  
where there is a lot of WAL traffic, because the latch used to put the  
walsender to sleep is also signalled by regular WAL traffic (and each  
signal causes an additional batch of data to be sent); the net effect is  
that there is no or little actual throttling.  This is undesirable, so  
rewrite the sleep into a loop to achieve the desired effeect.  
  
Author: Jeff Janes, small tweaks by me  
Reviewed-by: Antonin Houska  
Discussion: https://postgr.es/m/CAMkU=1xH6mde-yL-Eo1TKBGNd0PB1-TMxvrNvqcAkN-qr2E9mw@mail.gmail.com  

M src/backend/replication/basebackup.c

Fix translatable string

commit   : a1af1e7cfaefbef38e6b85ac632ed488744b3fd0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 4 Sep 2017 11:08:52 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 4 Sep 2017 11:08:52 +0200    

Click here for diff

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

M src/bin/pg_rewind/libpq_fetch.c

Fix macro-redefinition warning on MSVC.

commit   : d5c65d2f11ac58c517ab7fda01be62e4763504c9    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Sep 2017 11:01:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Sep 2017 11:01:08 -0400    

Click here for diff

In commit 9d6b160d7, I tweaked pg_config.h.win32 to use  
"#define HAVE_LONG_LONG_INT_64 1" rather than defining it as empty,  
for consistency with what happens in an autoconf'd build.  
But Solution.pm injects another definition of that macro into  
ecpg_config.h, leading to justifiable (though harmless) compiler whining.  
Make that one consistent too.  Back-patch, like the previous patch.  
  
Discussion: https://postgr.es/m/CAEepm=1dWsXROuSbRg8PbKLh0S=8Ou-V8sr05DxmJOF5chBxqQ@mail.gmail.com  

M src/tools/msvc/Solution.pm

doc: Fix typos and other minor issues

commit   : c6a7fcb49a60081c04c8e421fbc21475ad6943d8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Sep 2017 23:34:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Sep 2017 23:34:03 -0400    

Click here for diff

Author: Alexander Lakhin <[email protected]>  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/ref/alter_sequence.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/copy.sgml
M doc/src/sgml/ref/create_sequence.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/release-10.sgml

Improve division of labor between execParallel.c and nodeGather[Merge].c.

commit   : 01edb5c7fc3bcf6aea15f2b3be36189b52ad9d1a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Sep 2017 17:38:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Sep 2017 17:38:54 -0400    

Click here for diff

Move the responsibility for creating/destroying TupleQueueReaders into  
execParallel.c, to avoid duplicative coding in nodeGather.c and  
nodeGatherMerge.c.  Also, instead of having DestroyTupleQueueReader do  
shm_mq_detach, do it in the caller (which is now only ExecParallelFinish).  
This means execParallel.c does both the attaching and detaching of the  
tuple-queue-reader shm_mqs, which seems less weird than the previous  
arrangement.  
  
These changes also eliminate a vestigial memory leak (of the pei->tqueue  
array).  It's now demonstrable that rescans of Gather or GatherMerge don't  
leak memory.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Make [U]INT64CONST safe for use in #if conditions.

commit   : f2fe1cbef11c5fc962e338c8523667314faa6d89    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Sep 2017 15:14:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Sep 2017 15:14:18 -0400    

Click here for diff

Instead of using a cast to force the constant to be the right width,  
assume we can plaster on an L, UL, LL, or ULL suffix as appropriate.  
The old approach to this is very hoary, dating from before we were  
willing to require compilers to have working int64 types.  
  
This fix makes the PG_INT64_MIN, PG_INT64_MAX, and PG_UINT64_MAX  
constants safe to use in preprocessor conditions, where a cast  
doesn't work.  Other symbolic constants that might be defined using  
[U]INT64CONST are likewise safer than before.  
  
Also fix the SIZE_MAX macro to be similarly safe, if we are forced  
to provide a definition for that.  The test added in commit 2e70d6b5e  
happens to do what we want even with the hack "(size_t) -1" definition,  
but we could easily get burnt on other tests in future.  
  
Back-patch to all supported branches, like the previous commits.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Ensure SIZE_MAX can be used throughout our code.

commit   : cbb51eb69f3faac425caae33195fdfa3396fa1c3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Sep 2017 13:52:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Sep 2017 13:52:53 -0400    

Click here for diff

Pre-C99 platforms may lack <stdint.h> and thereby SIZE_MAX.  We have  
a couple of places using the hack "(size_t) -1" as a fallback, but  
it wasn't universally available; which means the code added in commit  
2e70d6b5e fails to compile everywhere.  Move that hack to c.h so that  
we can rely on having SIZE_MAX everywhere.  
  
Per discussion, it'd be a good idea to make the macro's value safe  
for use in #if-tests, but that will take a bit more work.  This is  
just a quick expedient to get the buildfarm green again.  
  
Back-patch to all supported branches, like the previous commit.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/c.h
M src/include/utils/memutils.h
M src/timezone/private.h

Fix two-phase commit test for recovery mode

commit   : ef585de80e29d7f20988ce06fafa58a215f6b122    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Sep 2017 16:51:55 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Sep 2017 16:51:55 +0200    

Click here for diff

The original code had a race condition because it never ensured the  
standby was caught up before proceeding; add a wait similar to every  
other place that does this.  
  
Author: Michaƫl Paquier  
Discussion: https://postgr.es/m/CAB7nPqTm9p+LCm1mVJYvgpwagRK+uibT-pKq0O2-paOWxT62jw@mail.gmail.com  

M src/test/recovery/t/009_twophase.pl

Restore behavior for replication origin drop

commit   : f15b76a9010dfd6052405d058bf8c0a488cec979    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Sep 2017 16:30:02 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Sep 2017 16:30:02 +0200    

Click here for diff

Do for replication origins what the previous commit did for replication  
slots: restore the original behavior of replication origin drop to raise  
an error rather than blocking, because users might be depending on the  
original behavior.  Maintain the blocking behavior when invoked  
internally from logical replication subscription handling.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid race condition in logical replication test

commit   : 3950e07eb46ebe99331ca82d659269056470f596    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 1 Sep 2017 14:49:06 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 1 Sep 2017 14:49:06 +0100    

Click here for diff

Wait for slot to become inactive before continuing.  
  
Author: Petr Jelinek  

M src/test/recovery/t/006_logical_decoding.pl

Provisional list of Major Features

commit   : 44654f3d2555702279d080e87c70730dc0cb7a9d    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 1 Sep 2017 14:10:52 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 1 Sep 2017 14:10:52 +0100    

Click here for diff

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

Add a WAIT option to DROP_REPLICATION_SLOT

commit   : 8ba6d50f923bfc1d7cc91f5ff11e199f18d7fd80    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Sep 2017 13:44:14 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Sep 2017 13:44:14 +0200    

Click here for diff

Commit 9915de6c1cb2 changed the default behavior of  
DROP_REPLICATION_SLOT so that it would wait until any session holding  
the slot active would release it, instead of raising an error.  But  
users are already depending on the original behavior, so revert to it by  
default and add a WAIT option to invoke the new behavior.  
  
Per complaint from Simone Gotti, in  
Discussion: https://postgr.es/m/CAEvsy6Wgdf90O6pUvg2wSVXL2omH5OPC-38OD4Zzgk-FXavj3Q@mail.gmail.com  

M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/protocol.sgml
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/include/nodes/replnodes.h

Add note about diskspace usage of pg_commit_ts

commit   : 28915c7db4da4eaffb8eb0dc5c04c87dcf345eb6    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 1 Sep 2017 07:55:00 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 1 Sep 2017 07:55:00 +0100    

Click here for diff

Author: Thomas Munro  

M doc/src/sgml/maintenance.sgml

Avoid memory leaks when a GatherMerge node is rescanned.

commit   : 7610547c95f3a469115538f4b45eda2563a8188e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 31 Aug 2017 16:20:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 31 Aug 2017 16:20:58 -0400    

Click here for diff

Rescanning a GatherMerge led to leaking some memory in the executor's  
query-lifespan context, because most of the node's working data structures  
were simply abandoned and rebuilt from scratch.  In practice, this might  
never amount to much, given the cost of relaunching worker processes ---  
but it's still pretty messy, so let's fix it.  
  
We can rearrange things so that the tuple arrays are simply cleared and  
reused, and we don't need to rebuild the TupleTableSlots either, just  
clear them.  One small complication is that because we might get a  
different number of workers on each iteration, we can't keep the old  
convention that the leader's gm_slots[] entry is the last one; the leader  
might clobber a TupleTableSlot that we need for a worker in a future  
iteration.  Hence, adjust the logic so that the leader has slot 0 always,  
while the active workers have slots 1..n.  
  
Back-patch to v10 to keep all the existing versions of nodeGatherMerge.c  
in sync --- because of the renumbering of the slots, there would otherwise  
be a very large risk that any future backpatches in this module would  
introduce bugs.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Clean up shm_mq cleanup.

commit   : b4fa938e9f484a3cf0614aac4686cd26c650d27c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 31 Aug 2017 15:10:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 31 Aug 2017 15:10:24 -0400    

Click here for diff

The logic around shm_mq_detach was a few bricks shy of a load, because  
(contrary to the comments for shm_mq_attach) all it did was update the  
shared shm_mq state.  That left us leaking a bit of process-local  
memory, but much worse, the on_dsm_detach callback for shm_mq_detach  
was still armed.  That means that whenever we ultimately detach from  
the DSM segment, we'd run shm_mq_detach again for already-detached,  
possibly long-dead queues.  This accidentally fails to fail today,  
because we only ever re-use a shm_mq's memory for another shm_mq, and  
multiple detach attempts on the last such shm_mq are fairly harmless.  
But it's gonna bite us someday, so let's clean it up.  
  
To do that, change shm_mq_detach's API so it takes a shm_mq_handle  
not the underlying shm_mq.  This makes the callers simpler in most  
cases anyway.  Also fix a few places in parallel.c that were just  
pfree'ing the handle structs rather than doing proper cleanup.  
  
Back-patch to v10 because of the risk that the revenant shm_mq_detach  
callbacks would cause a live bug sometime.  Since this is an API  
change, it's too late to do it in 9.6.  (We could make a variant  
patch that preserves API, but I'm not excited enough to do that.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/parallel.c
M src/backend/executor/tqueue.c
M src/backend/libpq/pqmq.c
M src/backend/storage/ipc/shm_mq.c
M src/include/storage/shm_mq.h

Improve code coverage of select_parallel test.

commit   : 4c7af96365d6a50c4f807a97dd37ac3e9c7459cf    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 31 Aug 2017 13:15:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 31 Aug 2017 13:15:54 -0400    

Click here for diff

Make sure that rescans of parallel indexscans are tested.  
Per code coverage report.  

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

Code review for nodeGatherMerge.c.

commit   : cb8e015b948d14d08b486ae1b2de879a0cc827d7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Aug 2017 17:21:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Aug 2017 17:21:08 -0400    

Click here for diff

Comment the fields of GatherMergeState, and organize them a bit more  
sensibly.  Comment GMReaderTupleBuffer more usefully too.  Improve  
assorted other comments that were obsolete or just not very good English.  
  
Get rid of the use of a GMReaderTupleBuffer for the leader process;  
that was confusing, since only the "done" field was used, and that  
in a way redundant with need_to_scan_locally.  
  
In gather_merge_init, avoid calling load_tuple_array for  
already-known-exhausted workers.  I'm not sure if there's a live bug there,  
but the case is unlikely to be well tested due to timing considerations.  
  
Remove some useless code, such as duplicating the tts_isempty test done by  
TupIsNull.  
  
Remove useless initialization of ps.qual, replacing that with an assertion  
that we have no qual to check.  (If we did, the code would fail to check  
it.)  
  
Avoid applying heap_copytuple to a null tuple.  While that fails to crash,  
it's confusing and it makes the code less legible not more so IMO.  
  
Propagate a couple of these changes into nodeGather.c, as well.  
  
Back-patch to v10, partly because of the possibility that the  
gather_merge_init change is fixing a live bug, but mostly to keep  
the branches in sync to ease future bug fixes.  

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

Separate reinitialization of shared parallel-scan state from ExecReScan.

commit   : d6a149f4e6a1243ccae6e1817050da9e84050b2a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Aug 2017 13:18:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Aug 2017 13:18:16 -0400    

Click here for diff

Previously, the parallel executor logic did reinitialization of shared  
state within the ExecReScan code for parallel-aware scan nodes.  This is  
problematic, because it means that the ExecReScan call has to occur  
synchronously (ie, during the parent Gather node's ReScan call).  That is  
swimming very much against the tide so far as the ExecReScan machinery is  
concerned; the fact that it works at all today depends on a lot of fragile  
assumptions, such as that no plan node between Gather and a parallel-aware  
scan node is parameterized.  Another objection is that because ExecReScan  
might be called in workers as well as the leader, hacky extra tests are  
needed in some places to prevent unwanted shared-state resets.  
  
Hence, let's separate this code into two functions, a ReInitializeDSM  
call and the ReScan call proper.  ReInitializeDSM is called only in  
the leader and is guaranteed to run before we start new workers.  
ReScan is returned to its traditional function of resetting only local  
state, which means that ExecReScan's usual habits of delaying or  
eliminating child rescan calls are safe again.  
  
As with the preceding commit 7df2c1f8d, it doesn't seem to be necessary  
to make these changes in 9.6, which is a good thing because the FDW and  
CustomScan APIs are impacted.  
  
Discussion: https://postgr.es/m/CAA4eK1JkByysFJNh9M349u_nNjqETuEnY_y1VUc_kJiU0bxtaQ@mail.gmail.com  

M doc/src/sgml/custom-scan.sgml
M doc/src/sgml/fdwhandler.sgml
M src/backend/access/heap/heapam.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeSeqscan.c
M src/include/access/heapam.h
M src/include/executor/execParallel.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h
M src/include/executor/nodeSeqscan.h
M src/include/foreign/fdwapi.h
M src/include/nodes/extensible.h

Restore test case from a2b70c89ca1a5fcf6181d3c777d82e7b83d2de1b.

commit   : 5816ddc707e03342502975456d864448ab8dc333    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Aug 2017 09:59:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Aug 2017 09:59:23 -0400    

Click here for diff

Revert the reversion commits a20aac890 and 9b644745c.  In the wake of  
commit 7df2c1f8d, we should get stable buildfarm results from this test;  
if not, I'd like to know sooner not later.  
  
Discussion: https://postgr.es/m/CAA4eK1JkByysFJNh9M349u_nNjqETuEnY_y1VUc_kJiU0bxtaQ@mail.gmail.com  

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

Force rescanning of parallel-aware scan nodes below a Gather[Merge].

commit   : 54eac6e8c5527c22555bc9f61ffa93cd0920b4c7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Aug 2017 09:29:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Aug 2017 09:29:56 -0400    

Click here for diff

The ExecReScan machinery contains various optimizations for postponing  
or skipping rescans of plan subtrees; for example a HashAgg node may  
conclude that it can re-use the table it built before, instead of  
re-reading its input subtree.  But that is wrong if the input contains  
a parallel-aware table scan node, since the portion of the table scanned  
by the leader process is likely to vary from one rescan to the next.  
This explains the timing-dependent buildfarm failures we saw after  
commit a2b70c89c.  
  
The established mechanism for showing that a plan node's output is  
potentially variable is to mark it as depending on some runtime Param.  
Hence, to fix this, invent a dummy Param (one that has a PARAM_EXEC  
parameter number, but carries no actual value) associated with each Gather  
or GatherMerge node, mark parallel-aware nodes below that node as dependent  
on that Param, and arrange for ExecReScanGather[Merge] to flag that Param  
as changed whenever the Gather[Merge] node is rescanned.  
  
This solution breaks an undocumented assumption made by the parallel  
executor logic, namely that all rescans of nodes below a Gather[Merge]  
will happen synchronously during the ReScan of the top node itself.  
But that's fundamentally contrary to the design of the ExecReScan code,  
and so was doomed to fail someday anyway (even if you want to argue  
that the bug being fixed here wasn't a failure of that assumption).  
A follow-on patch will address that issue.  In the meantime, the worst  
that's expected to happen is that given very bad timing luck, the leader  
might have to do all the work during a rescan, because workers think  
they have nothing to do, if they are able to start up before the eventual  
ReScan of the leader's parallel-aware table scan node has reset the  
shared scan state.  
  
Although this problem exists in 9.6, there does not seem to be any way  
for it to manifest there.  Without GatherMerge, it seems that a plan tree  
that has a rescan-short-circuiting node below Gather will always also  
have one above it that will short-circuit in the same cases, preventing  
the Gather from being rescanned.  Hence we won't take the risk of  
back-patching this change into 9.6.  But v10 needs it.  
  
Discussion: https://postgr.es/m/CAA4eK1JkByysFJNh9M349u_nNjqETuEnY_y1VUc_kJiU0bxtaQ@mail.gmail.com  

M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.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/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h

doc: Avoid sidebar element

commit   : 2fa44f666f144be5436d8725cc259fd1ce29f5ff    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Aug 2017 19:33:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Aug 2017 19:33:24 -0400    

Click here for diff

The formatting of the sidebar element didn't carry over to the new tool  
chain.  Instead of inventing a whole new way of dealing with it, just  
convert the one use to a "note".  

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

Doc: document libpq's restriction to INT_MAX rows in a PGresult.

commit   : ff59f30dc30ecb4fb777a28774110c6637b10dc1    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Aug 2017 15:38:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Aug 2017 15:38:05 -0400    

Click here for diff

As long as PQntuples, PQgetvalue, etc, use "int" for row numbers, we're  
pretty much stuck with this limitation.  The documentation formerly stated  
that the result of PQntuples "might overflow on 32-bit operating systems",  
which is just nonsense: that's not where the overflow would happen, and  
if you did reach an overflow it would not be on a 32-bit machine, because  
you'd have OOM'd long since.  
  
Discussion: https://postgr.es/m/CA+FnnTxyLWyjY1goewmJNxC==HQCCF4fKkoCTa9qR36oRAHDPw@mail.gmail.com  

M doc/src/sgml/libpq.sgml

Teach libpq to detect integer overflow in the row count of a PGresult.

commit   : b481b39b876f4bd0e793d93f6202071713bc0edb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Aug 2017 15:18:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Aug 2017 15:18:01 -0400    

Click here for diff

Adding more than 1 billion rows to a PGresult would overflow its ntups and  
tupArrSize fields, leading to client crashes.  It'd be desirable to use  
wider fields on 64-bit machines, but because all of libpq's external APIs  
use plain "int" for row counters, that's going to be hard to accomplish  
without an ABI break.  Given the lack of complaints so far, and the general  
pain that would be involved in using such huge PGresults, let's settle for  
just preventing the overflow and reporting a useful error message if it  
does happen.  Also, for a couple more lines of code we can increase the  
threshold of trouble from INT_MAX/2 to INT_MAX rows.  
  
To do that, refactor pqAddTuple() to allow returning an error message that  
replaces the default assumption that it failed because of out-of-memory.  
  
Along the way, fix PQsetvalue() so that it reports all failures via  
pqInternalNotice().  It already did so in the case of bad field number,  
but neglected to report anything for other error causes.  
  
Because of the potential for crashes, this seems like a back-patchable  
bug fix, despite the lack of field reports.  
  
Michael Paquier, per a complaint from Igor Korot.  
  
Discussion: https://postgr.es/m/CA+FnnTxyLWyjY1goewmJNxC==HQCCF4fKkoCTa9qR36oRAHDPw@mail.gmail.com  

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

Improve docs about numeric formatting patterns (to_char/to_number).

commit   : 09ec0eb7a6e83aea8adb4522e92138974401cce3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Aug 2017 09:34:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Aug 2017 09:34:21 -0400    

Click here for diff

The explanation about "0" versus "9" format characters was confusing  
and arguably wrong; the discussion of sign handling wasn't very good  
either.  Notably, while it's accurate to say that "FM" strips leading  
zeroes in date/time values, what it really does with numeric values  
is to strip *trailing* zeroes, and then only if you wrote "9" rather  
than "0".  Per gripes from Erwin Brandstetter.  
  
Discussion: https://postgr.es/m/CAGHENJ7jgRbTn6nf48xNZ=FHgL2WQ4X8mYsUAU57f-vq8PubEw@mail.gmail.com  
Discussion: https://postgr.es/m/CAGHENJ45ymd=GOCu1vwV9u7GmCR80_5tW0fP9C_gJKbruGMHvQ@mail.gmail.com  

M doc/src/sgml/func.sgml

Stamp 10beta4.

commit   : 2ff326dc4410c283515237cf311358afb9845912    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Aug 2017 17:19:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Aug 2017 17:19:22 -0400    

Click here for diff

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

Doc: adjust release-note credit for parallel pg_restore fix.

commit   : 7dadf7af820d160ace49d6e0b240603d5427bb20    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Aug 2017 11:40:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Aug 2017 11:40:47 -0400    

Click here for diff

Discussion: https://postgr.es/m/CAFcNs+pJ6_Ud-zg3vY_Y0mzfESdM34Humt8avKrAKq_H+v18Cg@mail.gmail.com  

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

Translation updates

commit   : 89f6d587f06b39884f755e871aeeb368e2a75712    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 28 Aug 2017 10:34:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 28 Aug 2017 10:34:14 -0400    

Click here for diff

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

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

Fix over-aggressive sanity check in misc_sanity.sql.

commit   : df44405a0c5c725706317c1faa6e8a0760f17dcc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Aug 2017 10:14:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Aug 2017 10:14:20 -0400    

Click here for diff

Fix thinko in commit 8be8510cf: it's okay to have dbid == 0 in normal  
(non-pin) entries in pg_shdepend, because global objects such as  
databases are entered that way.  The test would pass so long as it  
was run in a cluster containing no databases/tablespaces owned by,  
or granted to, roles other than the bootstrap superuser.  That's the  
expected situation for "make check", but for "make installcheck", not  
so much.  
  
Reported by Ryan Murphy.  
  
Discussion: https://postgr.es/m/CAHeEsBc6EQe0mxGBKDXAwJbntgfvoAd5MQC-5362SmC3Tng_6g@mail.gmail.com  

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

Clarify documentation

commit   : 5ecd7ccbe672a7ca2f3cd7252b28080100016fc2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 27 Aug 2017 21:29:54 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 27 Aug 2017 21:29:54 -0400    

Click here for diff

Discussion: https://www.postgresql.org/message-id/flat/20170618071607.GA16418%40nol.local  

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

Release notes for 9.6.5, 9.5.9, 9.4.14, 9.3.19, 9.2.23.

commit   : 947a0cc273f21c0d32f648a2c71809d92ab89d20    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 27 Aug 2017 17:35:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 27 Aug 2017 17:35:04 -0400    

Click here for diff

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

Doc: update v10 release notes through today.

commit   : 5a6273513374756720ae246d7fa15a9e780b4d07    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Aug 2017 16:50:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Aug 2017 16:50:19 -0400    

Click here for diff

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

pg_test_timing: Some NLS fixes

commit   : 145ca364d310932871b06ee4d226c014058aef2c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 26 Aug 2017 09:21:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 26 Aug 2017 09:21:46 -0400    

Click here for diff

The string "% of total" was marked by xgettext to be a c-format, but it  
is actually not, so mark up the source to prevent that.  
  
Compute the column widths of the final display dynamically based on the  
translated strings, so that translations don't mess up the display  
accidentally.  

M src/bin/pg_test_timing/pg_test_timing.c

Improve low-level backup documentation.

commit   : 3460728c67852d80569a0382e187480f08771778    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 25 Aug 2017 15:07:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 25 Aug 2017 15:07:44 -0400    

Click here for diff

Our documentation hasn't really caught up with the fact that  
non-exclusive backups can now be taken using pg_start_backup and  
pg_stop_backup even on standbys.  Update, also correcting some  
errors introduced by 52f8a59dd953c6820baf153e97cf07d31b8ac1d6.  
Updates to the 9.6 documentation are needed as well, but that  
will need a separate patch as some things are different on that  
version.  
  
David Steele, reviewed by Robert Haas and Michael Paquier  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/backup.sgml
M doc/src/sgml/func.sgml

pg_upgrade: Remove more dead code

commit   : 33043c69df790d9a08d2ac682c6f1d41c9a652bd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 25 Aug 2017 12:02:29 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 25 Aug 2017 12:02:29 -0400    

Click here for diff

related to 6ce6a61840cc90172ad3da7bf303656132fa5fab  
  
Reported-by: Christoph Berg <[email protected]>  

M src/bin/pg_upgrade/pg_upgrade.h

Message translatability fixes

commit   : 9c57848921ec90fca8dfd297adcb4d5d07d40160    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 25 Aug 2017 11:49:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 25 Aug 2017 11:49:05 -0400    

Click here for diff

M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_waldump/pg_waldump.c

Fix harmless thinko in dsa.c.

commit   : 1563b8fa673800e79a54fac899f78c836f22ff5c    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 24 Aug 2017 15:07:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 24 Aug 2017 15:07:40 -0700    

Click here for diff

Commit 16be2fd100199bdf284becfcee02c5eb20d8a11d added DSA_ALLOC_HUGE,  
DSA_ALLOC_ZERO and DSA_ALLOC_NO_OOM which have the same numerical  
values and meanings as the similarly named MCXT_... macros.  In one  
place we accidentally used MCXT_ALLOC_NO_OOM when DSA_ALLOC_NO_OOM is  
wanted, so tidy that up.  
  
Author: Thomas Munro  
Discussion: http://postgr.es/m/CAEepm=2AimHxVkkxnMfQvbZMkXy0uKbVa0-D38c5-qwrCm4CMQ@mail.gmail.com  
Backpatch: 10, where dsa was introduced.  

M src/backend/utils/mmgr/dsa.c

psql: Fix \gx when FETCH_COUNT is used

commit   : 51d0fa8ed93fe5befe91498f1a3eb5aede32677a    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 24 Aug 2017 16:20:48 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 24 Aug 2017 16:20:48 -0400    

Click here for diff

Set expanded output when requested through \gx in ExecQueryUsingCursor()  
(used when FETCH_COUNT is set).  
  
Discussion: https://www.postgresql.org/message-id/CB7A53AA-5645-4BDD-AB07-4D22CD9D8FF1%40gmx.net  
Author: Tobias Bussmann  

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

pg_upgrade: Remove dead code

commit   : 8a7beca69112755094a3f2ca1daa745d378dd452    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2017 15:29:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2017 15:29:35 -0400    

Click here for diff

Remove code meant for upgrading to a particular version of PostgreSQL  
9.0.  Since pg_upgrade only supports upgrading to the current major  
version, this code is no longer useful.  

M src/bin/pg_upgrade/check.c

Increase SCRAM salt length

commit   : cf98e3837db36d985507a924e392847e2ab857d0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2017 14:04:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2017 14:04:28 -0400    

Click here for diff

The original value 12 was set based on RFC 5802 for SCRAM-SHA-1, but RFC  
7677 for SCRAM-SHA-256 uses 16, so use that.  (This does not affect the  
validity of already stored verifiers.)  
  
Discussion: https://www.postgresql.org/message-id/flat/12cc9297-7e05-932f-d863-765e5626ead4%402ndquadrant.com  

M src/include/common/scram-common.h

Update code comment for temporary replication slots

commit   : d51b0872bf9a71d9585ca13bbf1f9463d9c61182    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2017 14:59:25 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2017 14:59:25 -0400    

Click here for diff

Reported-by: Alvaro Herrera <[email protected]>  

M src/include/replication/slot.h

Fix outdated comment

commit   : da19c32c6b7dd7d0ff5814538adf5aaa665848a1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2017 14:19:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2017 14:19:35 -0400    

Click here for diff

Author: Thomas Munro <[email protected]>  

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

Tweak some SCRAM error messages and code comments

commit   : 8bf94694691d1188aee671cdd9ce59c27df9bc7f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2017 12:01:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2017 12:01:43 -0400    

Click here for diff

Clarify/correct some error messages, fix up some code comments that  
confused SASL and SCRAM, and other minor fixes.  No changes in  
functionality.  

M doc/src/sgml/protocol.sgml
M src/backend/libpq/auth-scram.c
M src/interfaces/libpq/fe-auth-scram.c

Fix translation marker

commit   : 5e87f7b1d7079fcbbdb03c1ad02a3e40b2202e3e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2017 09:56:38 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2017 09:56:38 -0400    

Click here for diff

This was erroneously removed in  
55a70a023c3daefca9bbd68bfbe6862af10ab479.  

M src/backend/commands/vacuumlazy.c

pg_upgrade: Message translatability and style fixes

commit   : 2ac307bc0125235f124e45bb697d5b445f0118ca    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 Aug 2017 20:32:17 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 22 Aug 2017 20:32:17 -0400    

Click here for diff

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/version.c

doc: Mention identity column feature in section on serial

commit   : adce8912e63ade2ca5bba674fcbad860a73888fd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 Aug 2017 19:55:21 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 22 Aug 2017 19:55:21 -0400    

Click here for diff

Reported-by: Basil Bourque <[email protected]>  

M doc/src/sgml/datatype.sgml

Backpatch introduction of TupleDescAttr(tupdesc, i).

commit   : d34a74dd064af959acd9040446925d9d53dff15b    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 22 Aug 2017 07:46:05 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 22 Aug 2017 07:46:05 -0700    

Click here for diff

2cd70845240 / c6293249d change the way individual attributes in a  
TupleDesc are stored / accessed.  To reduce the effort of making  
extensions compatible with postgresql 11, and to ease future  
backpatching, backpatch introduction of TupleDescAttr() to all  
releases.  Do not backpatch change in storage, as that'd be a breaking  
change for existing and working extensions.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.2-  

M src/include/access/tupdesc.h

Don't install ICU collation keyword variants

commit   : 958ffb8c286d93d1bfced17e6300d13f9634b431    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Aug 2017 11:22:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Aug 2017 11:22:00 -0400    

Click here for diff

Users can still create them themselves.  Instead, document Unicode TR 35  
collation options for ICU, so users can create all this themselves.  
  
Reviewed-by: Peter Geoghegan <[email protected]>  

M doc/src/sgml/charset.sgml
M src/backend/commands/collationcmds.c

Expand set of predefined ICU locales

commit   : a79fb8e0c452a9b88206e2abd4add2b432a2596b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Aug 2017 09:17:06 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Aug 2017 09:17:06 -0400    

Click here for diff

Install language+region combinations even if they are not distinct from  
the language's base locale.  This gives better long-term stability of  
the set of predefined locales and makes the predefined locales less  
implementation-dependent and more practical for users.  
  
Reviewed-by: Peter Geoghegan <[email protected]>  

M doc/src/sgml/charset.sgml
M src/backend/commands/collationcmds.c

Inject $(ICU_LIBS) regardless of platform.

commit   : b8a25494819ac2551a71674effb7f50a7b7b74f6    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 20 Aug 2017 21:22:18 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 20 Aug 2017 21:22:18 -0700    

Click here for diff

It appeared in a conditional that excludes AIX, Cygwin and MinGW.  Give  
ICU support a chance to work on those platforms.  Back-patch to v10,  
where ICU support was introduced.  

M src/backend/Makefile

Fix possible core dump in parallel restore when using a TOC list.

commit   : 1c3869c0bea4376bcbb358e1abf5ed95e8c41865    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Aug 2017 13:39:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Aug 2017 13:39:37 -0400    

Click here for diff

Commit 3eb9a5e7c unintentionally introduced an ordering dependency  
into restore_toc_entries_prefork().  The existing coding of  
reduce_dependencies() contains a check to skip moving a TOC entry  
to the ready_list if it wasn't initially in the pending_list.  
This used to suffice to prevent reduce_dependencies() from trying to  
move anything into the ready_list during restore_toc_entries_prefork(),  
because the pending_list stayed empty throughout that phase; but it no  
longer does.  The problem doesn't manifest unless the TOC has been  
reordered by SortTocFromFile, which is how I missed it in testing.  
  
To fix, just add a test for ready_list == NULL, converting the call  
with NULL from a poor man's sanity check into an explicit command  
not to touch TOC items' list membership.  Clarify some of the comments  
around this; in particular, note the primary purpose of the check for  
pending_list membership, which is to ensure that we can't try to restore  
the same item twice, in case a TOC list forces it to be restored before  
its dependency count goes to zero.  
  
Per report from FabrĆ­zio de Royes Mello.  Back-patch to 9.3, like the  
previous commit.  
  
Discussion: https://postgr.es/m/CAFcNs+pjuv0JL_x4+=71TPUPjdLHOXA4YfT32myj_OrrZb4ohA@mail.gmail.com  

M src/bin/pg_dump/pg_backup_archiver.c

Fix creation of ICU comments for keyword variants

commit   : 7c84acc455368721e046dc0cc2eb84d62c4f5e61    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 18 Aug 2017 23:02:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 18 Aug 2017 23:02:28 -0400    

Click here for diff

It would create the comment referring to the keyword-less parent  
locale.  This was broken in ddb5fdc068635d003a0d1c303cb109d1cb3ebeb1.  

M src/backend/commands/collationcmds.c

Fix interaction of triggers, partitioning, and EXPLAIN ANALYZE.

commit   : d4b42e5215fae85e2ae473ba4957705f4c9861e9    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Aug 2017 13:01:05 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Aug 2017 13:01:05 -0400    

Click here for diff

Add a new EState member es_leaf_result_relations, so that the trigger  
code knows about ResultRelInfos created by tuple routing.  Also make  
sure ExplainPrintTriggers knows about partition-related  
ResultRelInfos.  
  
Etsuro Fujita, reviewed by Amit Langote  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/commands/copy.c
M src/backend/commands/explain.c
M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h

Temporarily revert test case from a2b70c89ca1a5fcf6181d3c777d82e7b83d2de1b.

commit   : 9b644745c94944de8f23449524671601d8863830    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Aug 2017 18:35:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Aug 2017 18:35:14 -0400    

Click here for diff

That code patch was good as far as it went, but the associated test case  
has exposed fundamental brain damage in the parallel scan mechanism,  
which is going to take nontrivial work to correct.  In the interests of  
getting the buildfarm back to green so that unrelated work can proceed,  
let's temporarily remove the test case.  

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

Don't lock tables in RelationGetPartitionDispatchInfo.

commit   : 7c0ca2900f7cae490fd551096cb7dc581cfe45c8    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 17 Aug 2017 15:39:17 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 17 Aug 2017 15:39:17 -0400    

Click here for diff

Instead, lock them in the caller using find_all_inheritors so that  
they get locked in the standard order, minimizing deadlock risks.  
  
Also in RelationGetPartitionDispatchInfo, avoid opening tables which  
are not partitioned; there's no need.  
  
Amit Langote, reviewed by Ashutosh Bapat and Amit Khandekar  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/catalog/partition.c
M src/backend/executor/execMain.c
M src/include/catalog/partition.h

Fix ExecReScanGatherMerge.

commit   : de1ca6919ff8f50e09122a1001eee1420b047199    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Aug 2017 13:49:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Aug 2017 13:49:22 -0400    

Click here for diff

Not surprisingly, since it'd never ever been tested, ExecReScanGatherMerge  
didn't work.  Fix it, and add a regression test case to exercise it.  
  
Amit Kapila  
  
Discussion: https://postgr.es/m/CAA4eK1JkByysFJNh9M349u_nNjqETuEnY_y1VUc_kJiU0bxtaQ@mail.gmail.com  

M src/backend/executor/nodeGatherMerge.c
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Further tweaks to compiler flags for PL/Perl on Windows.

commit   : 1d7a479d22f68c03d22c76b9a6de5cdf6ea9759b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Aug 2017 13:13:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Aug 2017 13:13:47 -0400    

Click here for diff

It now emerges that we can only rely on Perl to tell us we must use  
-D_USE_32BIT_TIME_T if it's Perl 5.13.4 or later.  For older versions,  
revert to our previous practice of assuming we need that symbol in  
all 32-bit Windows builds.  This is not ideal, but inquiring into  
which compiler version Perl was built with seems far too fragile.  
In any case, we had not previously had complaints about these old  
Perl versions, so let's assume this is Good Enough.  (It's still  
better than the situation ante commit 5a5c2feca, in that at least  
the effects are confined to PL/Perl rather than the whole PG build.)  
  
Back-patch to all supported versions, like 5a5c2feca and predecessors.  
  
Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com  

M src/tools/msvc/Mkvcbuild.pm

doc: Update RFC URLs

commit   : ca49d69b7c8f04c495ce39ff4460e017656db901    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Aug 2017 11:39:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Aug 2017 11:39:00 -0400    

Click here for diff

Consistently use the IETF HTML links instead of a random mix of  
different sites and formats.  Correct one RFC number and fix one broken  
link.  

M doc/src/sgml/client-auth.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/pgcrypto.sgml

Remove bogus line from comment.

commit   : b469387fc09a00e1ea9c7e010fafdcf117299cad    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 17 Aug 2017 11:19:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 17 Aug 2017 11:19:07 -0400    

Click here for diff

Spotted by Tom Lane  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c

doc: Fix table column count

commit   : 28c56553cb39174d0d33e5ed8200dc5e508ba5d8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Aug 2017 10:37:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Aug 2017 10:37:12 -0400    

Click here for diff

Author: Erik Rijkers <[email protected]>  

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

pg_dump: Support using synchronized snapshots on standbys

commit   : e4892c68184e199c3117a8f8b52da22a77702a05    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 19:46:50 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 19:46:50 -0400    

Click here for diff

This became possible by commit  
6c2003f8a1bbc7c192a2e83ec51581c018aa162f.  This just makes pg_dump aware  
of it and updates the documentation.  
  
Author: Petr Jelinek <[email protected]>  

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

doc: Update URL of DocBook XSL stylesheets

commit   : 0c16efcb533c95cec3e11daa13dba18110231831    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 14:44:26 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 14:44:26 -0400    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

M doc/src/sgml/docguide.sgml

doc: Add logical replication to comparison matrix

commit   : 2327690df4f839ed34b088727a632867cbc0988e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 13:59:40 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 13:59:40 -0400    

Click here for diff

Author: Steve Singer <[email protected]>  

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

Allow continuation lines in ecpg cppline parsing.

commit   : a6b174f55716c9da2e16804f2d4be4d8f76255ef    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 15 Aug 2017 16:06:56 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 15 Aug 2017 16:06:56 +0200    

Click here for diff

M src/interfaces/ecpg/preproc/pgc.l

Initialize replication_slot_catalog_xmin in procarray

commit   : 226be4062865476d190701d6ac13082a0595121e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 21:05:21 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 21:05:21 -0400    

Click here for diff

Although not confirmed and probably rare, if the newly allocated memory  
is not already zero, this could possibly have caused some problems.  
  
Also reorder the initializations slightly so they match the order of the  
struct definition.  
  
Author: Wong, Yi Wen <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  

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

Include foreign tables in information_schema.table_privileges

commit   : 3ea58216de4b26e27be8c6b23e44e275804542f2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 19:27:22 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 19:27:22 -0400    

Click here for diff

This appears to have been an omission in the original commit  
0d692a0dc9f.  All related information_schema views already include  
foreign tables.  
  
Reported-by: Nicolas Thauvin <[email protected]>  

M src/backend/catalog/information_schema.sql

psql: Add tab completion for \pset pager

commit   : 7502f399de38c68d2bb327e4071dd2fcdb5a20e6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 19:10:38 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 19:10:38 -0400    

Click here for diff

Author: Pavel Stehule <[email protected]>  

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

Simplify autovacuum work-item implementation

commit   : f2f9fcb3030ba67b4347a44b18b201f84d23997b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 15 Aug 2017 18:14:07 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 15 Aug 2017 18:14:07 -0300    

Click here for diff

The initial implementation of autovacuum work-items used a dynamic  
shared memory area (DSA).  However, it's argued that dynamic shared  
memory is not portable enough, so we cannot rely on it being supported  
everywhere; at the same time, autovacuum work-items are now a critical  
part of the server, so it's not acceptable that they don't work in the  
cases where dynamic shared memory is disabled.  Therefore, let's fall  
back to a simpler implementation of work-items that just uses  
autovacuum's main shared memory segment for storage.  
  
Discussion: https://postgr.es/m/CA+TgmobQVbz4K_+RSmiM9HeRKpy3vS5xnbkL95gSEnWijzprKQ@mail.gmail.com  

M src/backend/postmaster/autovacuum.c

Fix logical replication protocol comparison logic

commit   : edbad25877b10df07164345a8e6ae01236b6a26b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 16:20:20 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 16:20:20 -0400    

Click here for diff

Since we currently only have one protocol, this doesn't make much of a  
difference other than the error message.  
  
Author: Yugo Nagata <[email protected]>  

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

doc: Add missing logical replication protocol message

commit   : 0cafc267b5b2a0b9d8d93c7c3f1e88adb37fea6e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 15:36:18 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 15:36:18 -0400    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

M doc/src/sgml/protocol.sgml

Simplify some code in logical replication launcher

commit   : 292d9b66e2251df4767a43d78927a614561a21d6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 15:13:06 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 15:13:06 -0400    

Click here for diff

Avoid unnecessary locking calls when a subscription is disabled.  
  
Author: Yugo Nagata <[email protected]>  

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

doc: Improve PDF bookmarks

commit   : 4e7cd035abaae16e45305417073e7009518acc61    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 14:37:44 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 14:37:44 -0400    

Click here for diff

Also create PDF bookmarks/ToC entries for subsections of reference  
pages.  This was a regression from the previous jadetex-based build.  
  
Reported-by: Erik Rijkers <[email protected]>  

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

Fix error handling path in autovacuum launcher

commit   : 870da1e1546c9563c5ae45918392cf7bbc7e5b0e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 15 Aug 2017 13:35:12 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 15 Aug 2017 13:35:12 -0300    

Click here for diff

The original code (since 00e6a16d01) was assuming aborting the  
transaction in autovacuum launcher was sufficient to release all  
resources, but in reality the launcher runs quite a lot of code out of  
any transactions.  Re-introduce individual cleanup calls to make abort  
more robust.  
  
Reported-by: Robert Haas  
Discussion: https://postgr.es/m/CA+TgmobQVbz4K_+RSmiM9HeRKpy3vS5xnbkL95gSEnWijzprKQ@mail.gmail.com  

M src/backend/postmaster/autovacuum.c

Distinguish wait-for-connection from wait-for-write-ready on Windows.

commit   : d7ab908fbab5094e92a167441ec8d6bfb3b0c9fc    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Aug 2017 11:07:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Aug 2017 11:07:52 -0400    

Click here for diff

The API for WaitLatch and friends followed the Unix convention in which  
waiting for a socket connection to complete is identical to waiting for  
the socket to accept a write.  While Windows provides a select(2)  
emulation that agrees with that, the native WaitForMultipleObjects API  
treats them as quite different --- and for some bizarre reason, it will  
report a not-yet-connected socket as write-ready.  libpq itself has so  
far escaped dealing with this because it waits with select(), but in  
libpqwalreceiver.c we want to wait using WaitLatchOrSocket.  The semantics  
mismatch resulted in replication connection failures on Windows, but only  
for remote connections (apparently, localhost connections complete  
immediately, or at least too fast for anyone to have noticed the problem  
in single-machine testing).  
  
To fix, introduce an additional WL_SOCKET_CONNECTED wait flag for  
WaitLatchOrSocket, which is identical to WL_SOCKET_WRITEABLE on  
non-Windows, but results in waiting for FD_CONNECT events on Windows.  
  
Ideally, we would also distinguish the two conditions in the API for  
PQconnectPoll(), but changing that API at this point seems infeasible.  
Instead, cheat by checking for PQstatus() == CONNECTION_STARTED to  
determine that we're still waiting for the connection to complete.  
(This is a cheat mainly because CONNECTION_STARTED is documented as an  
internal state rather than something callers should rely on.  Perhaps  
we ought to change the documentation ... but this patch doesn't.)  
  
Per reports from Jobin Augustine and Igor Neyman.  Back-patch to v10  
where commit 1e8a85009 exposed this longstanding shortcoming.  
  
Andres Freund, minor fix and some code review/beautification by me  
  
Discussion: https://postgr.es/m/CAHBggj8g2T+ZDcACZ2FmzX9CTxkWjKBsHd6NkYB4i9Ojf6K1Fw@mail.gmail.com  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/storage/ipc/latch.c
M src/include/storage/latch.h

Avoid unnecessary single-child Append nodes.

commit   : 17a2a27b49ae19a1002b8230a6ceeef53082211e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Aug 2017 09:16:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Aug 2017 09:16:33 -0400    

Click here for diff

Before commit d3cc37f1d801a6b5cad9bf179274a8, an inheritance parent  
whose only children were temp tables of other sessions would end up  
as a simple scan of the parent; but with that commit, we end up with  
an Append node, per a report from Ashutosh Bapat.  Tweak the logic  
so that we go back to the old way, and update the function header  
comment for partitioning while we're at it.  
  
Ashutosh Bapat, reviewed by Amit Langote and adjusted by me.  
  
Discussion: http://postgr.es/m/CAFjFpReWJr1yTkHU=OqiMBmcYCMoSW3VPR39RBuQ_ovwDFBT5Q@mail.gmail.com  

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

Add missing call to ExecReScanGatherMerge.

commit   : 29990634c76a2278ae68bfb951fd20d5510a732d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Aug 2017 08:06:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Aug 2017 08:06:36 -0400    

Click here for diff

Amit Kapila  
  
Discussion: http://postgr.es/m/CAA4eK1KeQWZOoDmDmGMwuqzPW9JhRS+ditQVFdAfGjNmMZzqMQ@mail.gmail.com  

M src/backend/executor/execAmi.c

Expand coverage of parallel gather merge a bit.

commit   : ee5572e051955ef4570f95413dc6cddb4df51d50    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 14 Aug 2017 15:21:26 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 14 Aug 2017 15:21:26 -0700    

Click here for diff

Previously paths reaching heap_compare_slots weren't covered.  
  
Author: Rushabh Lathia  
Reviewed-By: Andres Freund  
Discussion:  
	https://postgr.es/m/CAGPqQf3C+3PBujb+7m=ceWeii4-vBY=XS99LjzrpkpefvzJbFg@mail.gmail.com  
	https://postgr.es/m/[email protected]  
Backpatch: 10, where gather merge was introduced  

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

Final pgindent + perltidy run for v10.

commit   : 21d304dfedb4f26d0d6587d9ac39b1b5c499bb55    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Aug 2017 17:29:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Aug 2017 17:29:33 -0400    

Click here for diff

M src/backend/access/hash/hashpage.c
M src/backend/access/transam/slru.c
M src/backend/catalog/namespace.c
M src/backend/catalog/partition.c
M src/backend/commands/copy.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/vacuumlazy.c
M src/backend/executor/execProcnode.c
M src/backend/executor/nodeModifyTable.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/optimizer/geqo/geqo_cx.c
M src/backend/optimizer/geqo/geqo_ox1.c
M src/backend/optimizer/geqo/geqo_ox2.c
M src/backend/optimizer/geqo/geqo_px.c
M src/backend/optimizer/geqo/geqo_recombination.c
M src/backend/parser/parse_utilcmd.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/replication/syncrep.c
M src/backend/storage/ipc/procarray.c
M src/backend/utils/adt/ruleutils.c
M src/bin/pg_ctl/t/001_start_stop.pl
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
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_rewind/libpq_fetch.c
M src/include/commands/trigger.h
M src/include/nodes/execnodes.h
M src/include/optimizer/geqo_recombination.h
M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/007_sync_rep.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/subscription/t/001_rep_changes.pl
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/vcregress.pl
M src/tools/pgindent/pgindent
M src/tools/pgindent/typedefs.list

Handle elog(FATAL) during ROLLBACK more robustly.

commit   : 5b6289c1e07dc45f09c3169a189e60d2fcaec2b3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Aug 2017 15:43:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Aug 2017 15:43:20 -0400    

Click here for diff

Stress testing by Andreas Seltenreich disclosed longstanding problems that  
occur if a FATAL exit (e.g. due to receipt of SIGTERM) occurs while we are  
trying to execute a ROLLBACK of an already-failed transaction.  In such a  
case, xact.c is in TBLOCK_ABORT state, so that AbortOutOfAnyTransaction  
would skip AbortTransaction and go straight to CleanupTransaction.  This  
led to an assert failure in an assert-enabled build (due to the ROLLBACK's  
portal still having a cleanup hook) or without assertions, to a FATAL exit  
complaining about "cannot drop active portal".  The latter's not  
disastrous, perhaps, but it's messy enough to want to improve it.  
  
We don't really want to run all of AbortTransaction in this code path.  
The minimum required to clean up the open portal safely is to do  
AtAbort_Memory and AtAbort_Portals.  It seems like a good idea to  
do AtAbort_Memory unconditionally, to be entirely sure that we are  
starting with a safe CurrentMemoryContext.  That means that if the  
main loop in AbortOutOfAnyTransaction does nothing, we need an extra  
step at the bottom to restore CurrentMemoryContext = TopMemoryContext,  
which I chose to do by invoking AtCleanup_Memory.  This'll result in  
calling AtCleanup_Memory twice in many of the paths through this function,  
but that seems harmless and reasonably inexpensive.  
  
The original motivation for the assertion in AtCleanup_Portals was that  
we wanted to be sure that any user-defined code executed as a consequence  
of the cleanup hook runs during AbortTransaction not CleanupTransaction.  
That still seems like a valid concern, and now that we've seen one case  
of the assertion firing --- which means that exactly that would have  
happened in a production build --- let's replace the Assert with a runtime  
check.  If we see the cleanup hook still set, we'll emit a WARNING and  
just drop the hook unexecuted.  
  
This has been like this a long time, so back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/backend/utils/mmgr/portalmem.c

Fix typo

commit   : 7f1bb1d7346b67a62e8ec59f79f8284cb7fb4394    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 14 Aug 2017 13:53:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 14 Aug 2017 13:53:05 -0400    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

M src/backend/commands/sequence.c

doc: Fix logical replication protocol doc detail

commit   : 79e5de690efce6e7aaa9c60e10389a8bc58c1617    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 14 Aug 2017 13:42:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 14 Aug 2017 13:42:03 -0400    

Click here for diff

Author: Masahiko Sawada <[email protected]>  
Reported-by: Kyle Conroy <[email protected]>  
Bug: #14775  

M doc/src/sgml/protocol.sgml

Absorb -D_USE_32BIT_TIME_T switch from Perl, if relevant.

commit   : 5a5c2feca3fd858e70ea348822595547e6fa6c15    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Aug 2017 11:48:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Aug 2017 11:48:59 -0400    

Click here for diff

Commit 3c163a7fc's original choice to ignore all #define symbols whose  
names begin with underscore turns out to be too simplistic.  On Windows,  
some Perl installations are built with -D_USE_32BIT_TIME_T, and we must  
absorb that or we get the wrong result for sizeof(PerlInterpreter).  
  
This effectively re-reverts commit ef58b87df, which injected that symbol  
in a hacky way, making it apply to all of Postgres not just PL/Perl.  
More significantly, it did so on *all* 32-bit Windows builds, even when  
the Perl build to be used did not select this option; so that it fails  
to work properly with some newer Perl builds.  
  
By making this change, we would be introducing an ABI break in 32-bit  
Windows builds; but fortunately we have not used type time_t in any  
exported Postgres APIs in a long time.  So it should be OK, both for  
PL/Perl itself and for third-party extensions, if an extension library  
is built with a different _USE_32BIT_TIME_T setting than the core code.  
  
Patch by me, based on research by Ashutosh Sharma and Robert Haas.  
Back-patch to all supported branches, as commit 3c163a7fc was.  
  
Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com  

M config/perl.m4
M configure
M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/VCBuildProject.pm

Changed ecpg parser to allow RETURNING clauses without attached C variables.

commit   : ea0ca75d5d14e0c98782a2188405685af4a475a0    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 14 Aug 2017 11:29:34 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 14 Aug 2017 11:29:34 +0200    

Click here for diff

M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/ecpg.type
M src/interfaces/ecpg/preproc/parse.pl

Remove AtEOXact_CatCache().

commit   : 004a9702e062b5b6d61813f3fc8d71654d331d05    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Aug 2017 16:15:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Aug 2017 16:15:14 -0400    

Click here for diff

The sole useful effect of this function, to check that no catcache  
entries have positive refcounts at transaction end, has really been  
obsolete since we introduced ResourceOwners in PG 8.1.  We reduced the  
checks to assertions years ago, so that the function was a complete  
no-op in production builds.  There have been previous discussions about  
removing it entirely, but consensus up to now was that it had some small  
value as a cross-check for bugs in the ResourceOwner logic.  
  
However, it now emerges that it's possible to trigger these assertions  
if you hit an assert-enabled backend with SIGTERM during a call to  
SearchCatCacheList, because that function temporarily increases the  
refcounts of entries it's intending to add to a catcache list construct.  
In a normal ERROR scenario, the extra refcounts are cleaned up by  
SearchCatCacheList's PG_CATCH block; but in a FATAL exit we do a  
transaction abort and exit without ever executing PG_CATCH handlers.  
  
There's a case to be made that this is a generic hazard and we should  
consider restructuring elog(FATAL) handling so that pending PG_CATCH  
handlers do get run.  That's pretty scary though: it could easily create  
more problems than it solves.  Preliminary stress testing by Andreas  
Seltenreich suggests that there are not many live problems of this ilk,  
so we rejected that idea.  
  
There are more-localized ways to fix the problem; the most principled  
one would be to use PG_ENSURE_ERROR_CLEANUP instead of plain PG_TRY.  
But adding cycles to SearchCatCacheList isn't very appealing.  We could  
also weaken the assertions in AtEOXact_CatCache in some more or less  
ad-hoc way, but that just makes its raison d'etre even less compelling.  
In the end, the most reasonable solution seems to be to just remove  
AtEOXact_CatCache altogether, on the grounds that it's not worth trying  
to fix it.  It hasn't found any bugs for us in many years.  
  
Per report from Jeevan Chalke.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAM2+6=VEE30YtRQCZX7_sCFsEpoUkFBV1gZazL70fqLn8rcvBA@mail.gmail.com  

M src/backend/access/transam/xact.c
M src/backend/utils/cache/catcache.c
M src/include/utils/catcache.h

Reword comment for clarity

commit   : 2336f842843e5bd26779692b39eaf0ef9d4d31da    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 12 Aug 2017 21:36:07 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 12 Aug 2017 21:36:07 -0400    

Click here for diff

Reported by Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoB+ycZ2z-4Ye=6MfQ_r0aV5r6cvVPw4kOyPdp6bHqQoBQ@mail.gmail.com  

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

Fix vertical spanning in table "wait_event Description".

commit   : e88928c50dfe2623c899f82b54aad69da248ad07    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 12 Aug 2017 18:19:49 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 12 Aug 2017 18:19:49 -0700    

Click here for diff

Michael Paquier  
  
Discussion: https://postgr.es/m/CAB7nPqQr3KEQvXeuUNYcm7tDK2Fb9oLUQ8DU0+y0RZEoN_1_gg@mail.gmail.com  

M doc/src/sgml/monitoring.sgml

Simplify fetch-slot-xmins logic in recovery TAP tests.

commit   : 3043c1ddd13cd902d820d9aea353e60ce2d3d698    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 12 Aug 2017 12:08:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 12 Aug 2017 12:08:54 -0400    

Click here for diff

Merge wait_slot_xmins() into get_slot_xmins().  At this point the only  
place that wasn't doing a wait was the initial-state test, and a wait  
there seems pretty harmless.  
  
Michael Paquier  
  
Discussion: https://postgr.es/m/CAB7nPqSp_SLQb2uU7am+sn4V3g1UKv8j3yZU385oAG1cG_BN9Q@mail.gmail.com  

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

Be more thorough about cleaning out gcov litter.

commit   : d6ecad812f981e6ea611c1022ce7540830393a36    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Aug 2017 17:39:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Aug 2017 17:39:27 -0400    

Click here for diff

At least on my machine, a run with code coverage enabled produces some  
".gcov" files whose names begin with ".".  "rm -f *.gcov" fails to match  
those, so they don't get cleaned up by "make clean".  Fix it.  

M src/Makefile.global.in

Add regression tests exercising more code paths in nodeLimit.c.

commit   : 3c8de95979008d67713429d858957c5c78c23d75    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Aug 2017 17:27:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Aug 2017 17:27:54 -0400    

Click here for diff

Perusal of the code coverage report shows that the existing regression  
test cases for LIMIT/OFFSET don't exercise the nodeLimit code paths  
involving backwards scan, empty results, or null values of LIMIT/OFFSET.  
Improve the coverage.  

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

Add regression tests exercising the non-hashed code paths in nodeSetop.c.

commit   : 6efca23cc039b6a0b25d2ebf4a22ab7363d17fcf    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Aug 2017 16:52:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Aug 2017 16:52:12 -0400    

Click here for diff

Perusal of the code coverage report shows that the existing regression  
test cases for INTERSECT and EXCEPT seemingly all prefer the SETOP_HASHED  
implementation.  Add some test cases in which we force use of the  
SETOP_SORTED mode.  

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

doc: Add example for inet vs cidr difference

commit   : ee844bb42632521c89497a2845079770b32a934e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 16:40:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 16:40:56 -0400    

Click here for diff

Reported-by: [email protected]  

M doc/src/sgml/datatype.sgml

doc: Update description of rolreplication column

commit   : fa65c8c73cb21ab3154db2f0f291227ba901c996    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 16:14:55 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 16:14:55 -0400    

Click here for diff

Since PostgreSQL 9.6, rolreplication no longer determines whether a role  
can run pg_start_backup() and pg_stop_backup(), so remove that.  
  
Add that this attribute determines whether a role can create and drop  
replication slots.  
  
Reported-by: Fujii Masao <[email protected]>  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/create_role.sgml

doc: Small wording improvement

commit   : 22701a7ec66ffb3b62fae7f04ef36bc6ea21df52    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 15:52:39 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 15:52:39 -0400    

Click here for diff

Author: Jeff Janes <[email protected]>  

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

pg_upgrade: Clarify one message

commit   : d4ede668d6f0ca9e5dd6def4ea1ccddc441c6073    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 15:44:10 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 15:44:10 -0400    

Click here for diff

Reported-by: Dennis Bjƶrklund <[email protected]>  

M src/bin/pg_upgrade/check.c

Remove pgbench's restriction on placement of -M switch.

commit   : 79681844297a9d499a10094a17e52b365afdd8bb    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Aug 2017 15:19:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Aug 2017 15:19:40 -0400    

Click here for diff

Previously the -M switch had to appear before any switch that directly  
or indirectly specified a benchmarking script.  This was both confusing  
and inadequately documented, as per gripe from Tatsuo Ishii.  We can  
remove the restriction at the cost of making an extra pass over the  
lists of SQL commands, which seems like a cheap price (the string scans  
themselves likely cost much more).  The change is just to not extract  
parameters from the SQL commands until we have finished parsing the  
switches and know the final value of -M.  
  
Per discussion, we'll treat this as a low-grade bug fix and sneak it  
into v10, rather than holding it for v11.  
  
Tom Lane, reviewed by Tatsuo Ishii and Fabien Coelho  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

Remove uses of "slave" in replication contexts

commit   : a1ef920e27ba6ab3602aaf6d6751d8628fac1af8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 17:42:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 17:42:47 -0400    

Click here for diff

This affects mostly code comments, some documentation, and tests.  
Official APIs already used "standby".  

M contrib/dblink/expected/dblink.out
M contrib/dblink/sql/dblink.sql
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/varsup.c
M src/backend/catalog/namespace.c
M src/backend/commands/variable.c
M src/backend/executor/execMain.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/procarray.c
M src/backend/tcop/utility.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/RewindTest.pm
M src/test/modules/commit_ts/t/002_standby.pl
M src/test/modules/commit_ts/t/003_standby_2.pl
M src/test/recovery/t/002_archiving.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/012_subtransactions.pl

Reject use of ucol_strcollUTF8() before ICU 53

commit   : d6391b03b3025372620925e5746e65c288a1e371    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 9 Aug 2017 20:34:51 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 9 Aug 2017 20:34:51 -0400    

Click here for diff

Various bugs can cause crashes, so don't use that function before ICU  
53.  It will fall back to the code path used for other encodings.  
  
Since we now tie the function availability to an ICU version, we don't  
need the configure test anymore.  That also resolves the issue that the  
test result was previously hardcoded for Windows.  
  
researched by Daniel Verite <[email protected]>, Peter Geoghegan  
<[email protected]>, Tom Lane <[email protected]>  
  
Discussion: https://www.postgresql.org/message-id/flat/f1438ec6-22aa-4029-9a3b-26f79d330e72%40manitou-mail.org  

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

Fix order of ICU_CFLAGS

commit   : b83e54564ad0733f5382b20c04695ee9fb4cf451    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 9 Aug 2017 20:28:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 9 Aug 2017 20:28:49 -0400    

Click here for diff

It must be before CPPFLAGS so that an ICU installation in a nonstandard  
path can take precedence over one in the system path.  

M src/Makefile.global.in

Improve the error message when creating an empty range partition.

commit   : bb5d6e80b1387f0de58e55ac8e882f68ec6d4fcf    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 10 Aug 2017 13:44:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 10 Aug 2017 13:44:30 -0400    

Click here for diff

The previous message didn't mention the name of the table or the  
bounds.  Put the table name in the primary error message and the  
bounds in the detail message.  
  
Amit Langote, changed slightly by me.  Suggestions on the exac  
phrasing from Tom Lane, David G. Johnston, and Dean Rasheed.  
  
Discussion: http://postgr.es/m/CA+Tgmoae6bpwVa-1BMaVcwvCCeOoJ5B9Q9-RHWo-1gJxfPBZ5Q@mail.gmail.com  

M src/backend/catalog/partition.c
M src/backend/utils/adt/ruleutils.c
M src/include/utils/ruleutils.h
M src/test/regress/expected/create_table.out

Make some more improvements to parallel query documentation.

commit   : c1ef4e5cdb11cd562891f4ad2f30d1e3583a973d    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 10 Aug 2017 13:22:31 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 10 Aug 2017 13:22:31 -0400    

Click here for diff

Many places that mentioned only Gather should also mention Gather  
Merge, or should be phrased in a more neutral way.  Be more clear  
about the fact that max_parallel_workers_per_gather affects the number  
of workers the planner may want to use.  Fix a typo.  Explain how  
Gather Merge works.  Adjust wording around parallel scans to be a bit  
more clear.  Adjust wording around parallel-restricted operations for  
the fact that uncorrelated subplans are no longer restricted.  
  
Patch by me, reviewed by Erik Rijkers  
  
Discussion: http://postgr.es/m/CA+TgmoZsTjgVGn=ei5ht-1qGFKy_m1VgB3d8+Rg304hz91N5ww@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/parallel.sgml

Fix typo in comment.

commit   : e694010758772da1ac0f3355027fad0e47da4465    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 10 Aug 2017 13:14:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 10 Aug 2017 13:14:47 -0400    

Click here for diff

Etsuro Fujita  
  
Discussion: http://postgr.es/m/[email protected]  

M src/include/nodes/plannodes.h

pgstatindex: Insert some casts to prevent overflow.

commit   : 0b7ba3d6474b8f58e74dba548886df3250805cdf    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 10 Aug 2017 11:48:42 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 10 Aug 2017 11:48:42 -0400    

Click here for diff

This could cause hash indexes to report greater than 100% free space.  
  
Ashutosh Sharma, reviewed by Amit Kapila  
  
Discussion: http://postgr.es/m/CAE9k0PnCKfg-ZK1CwGZJPF1yKcG2A=GUgC3BMdNMzLAXVOo4Eg@mail.gmail.com  

M contrib/pgstattuple/pgstatindex.c

Remove incorrect assertion in clog.c

commit   : ec99dd5aee8b831760046d43098c2d1cf23157ed    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 10 Aug 2017 11:20:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 10 Aug 2017 11:20:57 -0400    

Click here for diff

We must advance the oldest XID that can be safely looked up in clog  
*before* truncating CLOG, and the oldest XID that can't be reused  
*after* truncating CLOG.  This assertion, and the accompanying  
comment, are confused; remove them.  
  
Reported by Neha Sharma.  
  
Discussion: http://postgr.es/m/CANiYTQumC3T=UMBMd1Hor=5XWZYuCEQBioL3ug0YtNQCMMT5wQ@mail.gmail.com  

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

Fix handling of container types in find_composite_type_dependencies.

commit   : 749c7c41701c62d96a56af1531e4f51e39173be3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Aug 2017 17:03:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Aug 2017 17:03:09 -0400    

Click here for diff

find_composite_type_dependencies correctly found columns that are of  
the specified type, and columns that are of arrays of that type, but  
not columns that are domains or ranges over the given type, its array  
type, etc.  The most general way to handle this seems to be to assume  
that any type that is directly dependent on the specified type can be  
treated as a container type, and processed recursively (allowing us  
to handle nested cases such as ranges over domains over arrays ...).  
Since a type's array type already has such a dependency, we can drop  
the existing special case for the array type.  
  
The very similar logic in get_rels_with_domain was likewise a few  
bricks shy of a load, as it supposed that a directly dependent type  
could *only* be a sub-domain.  This is already wrong for ranges over  
domains, and it'll someday be wrong for arrays over domains.  
  
Add test cases illustrating the problems, and back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Prevent passing down MAKELEVEL/MAKEFLAGS from non-GNU make to GNU make.

commit   : a76200de8462aa0551dde8132c11d648d0ad6e99    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Aug 2017 12:05:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Aug 2017 12:05:53 -0400    

Click here for diff

FreeBSD's make, for one, sets the MAKELEVEL environment variable when  
invoking commands.  In the special Makefile we provide to hand off control  
from a non-GNU make to GNU make, this causes GNU make to think it is a  
child make invocation rather than top-level.  That interferes with the hack  
added in commit dcae5facc to cause the temp-install tree to be made only by  
the top-level invocation of gmake.  Unset the variable to prevent that.  
  
Likewise unset MAKEFLAGS, which FreeBSD's make also sets, and which could  
easily confuse gmake.  There are no reports of actual trouble from that,  
but it seems better to be proactive.  
  
Back-patch to 9.5 where dcae5facc came in.  
  
Thomas Munro, hacked a bit more by me  
  
Discussion: https://postgr.es/m/CAEepm=1ueww35AXTkt1A3gyzZUqv5XCzh8RUNvJZAQAW=eOhVw@mail.gmail.com  

M Makefile

doc: Add missing pieces to logical replication protocol doc

commit   : 13f03a001e4d841b6a27c0c9c3fe14e1fb2aad80    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 8 Aug 2017 19:18:16 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 8 Aug 2017 19:18:16 -0400    

Click here for diff

Reported-by: Kyle Conroy <[email protected]>  

M doc/src/sgml/protocol.sgml

Fix datumSerialize infrastructure to not crash on non-varlena data.

commit   : 9bf4068cc321a4d44ac54089ab651a49d89bb567    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Aug 2017 19:18:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Aug 2017 19:18:11 -0400    

Click here for diff

Commit 1efc7e538 did a poor job of emulating existing logic for touching  
Datums that might be expanded-object pointers.  It didn't check for typlen  
being -1 first, which meant it could crash on fixed-length pass-by-ref  
values, and probably on cstring values as well.  It also didn't use  
DatumGetPointer before VARATT_IS_EXTERNAL_EXPANDED, which while currently  
harmless is not according to documentation nor prevailing style.  
  
I also think the lack of any explanation as to why datumSerialize makes  
these particular nonobvious choices is pretty awful, so fix that.  
  
Per report from Jarred Ward.  Back-patch to 9.6 where this code came in.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Reword some unclear comments

commit   : 77d2c00af78ee12ae0d1cea34605f1e7af3f6d93    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 8 Aug 2017 18:46:16 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 8 Aug 2017 18:46:16 -0400    

Click here for diff

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

Fix typo in comment

commit   : f5d54ef97abdd1df3d6bfe0320a565ecce742abe    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 8 Aug 2017 18:31:39 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 8 Aug 2017 18:31:39 -0400    

Click here for diff

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

Fix yet another race condition in recovery/t/001_stream_rep.pl.

commit   : 4576a69354fa2efc1bafa50df1c104c1a80c64e5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Aug 2017 18:03:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Aug 2017 18:03:30 -0400    

Click here for diff

In commit 5c77690f6, we added polling in front of most of the  
get_slot_xmins calls in 001_stream_rep.pl, but today's results from  
buildfarm member nightjar show that at least one more poll loop  
is needed.  
  
Proactively add a poll loop before the next-to-last get_slot_xmins call  
as well.  It may be that there is no race condition there because the  
standby_2 server is shut down at that point, but I'm quite tired of  
fighting with this test script.  The empirical evidence that it's safe,  
from the buildfarm, is no stronger than the evidence for the other  
call that nightjar just proved unsafe.  
  
The only remaining get_slot_xmins calls without wait_slot_xmins  
protection are the first two, which should be OK since nothing has  
happened at that point.  It's tempting to ignore that special case  
and merge get_slot_xmins and wait_slot_xmins into a single function.  
I didn't go that far though.  
  
Discussion: https://postgr.es/m/[email protected]  

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

commit   : b2c95a3798ff39fc24d71b6655ddfe0e4cb3f378    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 8 Aug 2017 16:07:46 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 8 Aug 2017 16:07:46 -0400    

Click here for diff

Similar to what was fixed in commit 9915de6c1cb2 for replication slots,  
but this time it's related to replication origins: DROP SUBSCRIPTION  
attempts to drop the replication origin, but that fails if the  
replication worker process hasn't yet marked it unused.  This causes  
failures in the buildfarm:  
ERROR:  could not drop replication origin with OID 1, in use by PID 34069  
  
Like the aforementioned commit, fix by having the process running DROP  
SUBSCRIPTION sleep until the worker marks the the replication origin  
struct as free.  This uses a condition variable on each replication  
origin shmem state struct, so that the session trying to drop can sleep  
and expect to be awakened by the process keeping the origin open.  
  
Also fix a SGML markup in the previous commit.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/commands/subscriptioncmds.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/origin.c
M src/include/pgstat.h
M src/include/replication/origin.h

Fix inadequacies in recently added wait events

commit   : 030273b7ea468ed4b3073dfd1f2ad88e3129df6a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 8 Aug 2017 15:37:44 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 8 Aug 2017 15:37:44 -0400    

Click here for diff

In commit 9915de6c1cb2, we introduced a new wait point for replication  
slots and incorrectly labelled it as wait event PG_WAIT_LOCK.  That's  
wrong, so invent an appropriate new wait event instead, and document it  
properly.  
  
While at it, fix numerous other problems in the vicinity:  
- two different walreceiver wait events were being mixed up in a single  
  wait event (which wasn't documented either); split it out so that they  
  can be distinguished, and document the new events properly.  
  
- ParallelBitmapPopulate was documented but didn't exist.  
  
- ParallelBitmapScan was not documented (I think this should be called  
  "ParallelBitmapScanInit" instead.)  
  
- Logical replication wait events weren't documented  
  
- various symbols had been added in dartboard order in various places.  
  Put them in alphabetical order instead, as was originally intended.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/postmaster/pgstat.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/slot.c
M src/include/pgstat.h

Disclaim xmltable() support for non-UTF8 databases.

commit   : b4a2eea030ba74ea84335c7d5bc999f693ffd9a4    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 7 Aug 2017 17:16:21 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 7 Aug 2017 17:16:21 -0700    

Click here for diff

The xmltable() implementation mirrors xpath(), including its lack of  
character encoding awareness.  

M doc/src/sgml/datatype.sgml

Stamp 10beta3.

commit   : 8d6442377df5451a8db598788847e6a70b3b49ef    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Aug 2017 17:08:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Aug 2017 17:08:19 -0400    

Click here for diff

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

Skip test for IPC::Run if user is overriding our search for PROVE.

commit   : 8014d2afa7b817c98544cace7efc337ee891aa57    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Aug 2017 16:42:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Aug 2017 16:42:18 -0400    

Click here for diff

The check for IPC::Run we added in commit c254970ad is useful in simple  
cases, but there are real use-cases where "prove" is coming from a  
different Perl installation than the "perl" we want to use to build.  
In such cases asking whether "perl" knows about IPC::Run is irrelevant  
and can cause an unnecessary configure failure.  Hence, if user has  
specified a value for PROVE, skip the IPC::Run check.  Per discussion  
with Andrew Dunstan.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in

Update SQL features list

commit   : cdc47d1f3942451952e2d8409069a5d1fa741fa8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 14:30:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 14:30:24 -0400    

Click here for diff

M src/backend/catalog/sql_features.txt

Translation updates

commit   : f7668b2b3532b627ec951e1f0a28944f30cc4a1b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 13:55:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 13:55:34 -0400    

Click here for diff

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

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

Last-minute updates for release notes.

commit   : a8b37ebe407f1916c5df22452cdbb1d00e2a409d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Aug 2017 11:46:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Aug 2017 11:46:20 -0400    

Click here for diff

Security: CVE-2017-7546, CVE-2017-7547, CVE-2017-7548  

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

Fix local/remote attribute mix-up in logical replication

commit   : fca17a933b4b3cedcd41f14b0fe4d3fb439ea4a4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 10:49:08 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 10:49:08 -0400    

Click here for diff

This would lead to failures if local and remote tables have a different  
column order.  The tests previously didn't catch that because they only  
tested the initial data copy.  So add another test that exercises the  
apply worker.  
  
Author: Petr Jelinek <[email protected]>  

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

Fix handling of dropped columns in logical replication

commit   : 0e58455dd48ca9cbc9987c47b8297d10f1c307b0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 10:28:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 10:28:35 -0400    

Click here for diff

The relation attribute map was not initialized for dropped columns,  
leading to errors later on.  
  
Author: Petr Jelinek <[email protected]>  
Reported-by: Scott Milliken <[email protected]>  
Bug: #14769  

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

Require update permission for the large object written by lo_put().

commit   : 8d9881911f0d30e0783a6bb1363b94a2c817433d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Aug 2017 10:19:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Aug 2017 10:19:01 -0400    

Click here for diff

lo_put() surely should require UPDATE permission, the same as lowrite(),  
but it failed to check for that, as reported by Chapman Flack.  Oversight  
in commit c50b7c09d; backpatch to 9.4 where that was introduced.  
  
Tom Lane and Michael Paquier  
  
Security: CVE-2017-7548  

M src/backend/libpq/be-fsstubs.c
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Again match pg_user_mappings to information_schema.user_mapping_options.

commit   : e568e1eee4650227170cf8c64eedb74bafd7d1f0    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 7 Aug 2017 07:09:28 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 7 Aug 2017 07:09:28 -0700    

Click here for diff

Commit 3eefc51053f250837c3115c12f8119d16881a2d7 claimed to make  
pg_user_mappings enforce the qualifications user_mapping_options had  
been enforcing, but its removal of a longstanding restriction left them  
distinct when the current user is the subject of a mapping yet has no  
server privileges.  user_mapping_options emits no rows for such a  
mapping, but pg_user_mappings includes full umoptions.  Change  
pg_user_mappings to show null for umoptions.  Back-patch to 9.2, like  
the above commit.  
  
Reviewed by Tom Lane.  Reported by Jeff Janes.  
  
Security: CVE-2017-7547  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/system_views.sql
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/foreign_data.sql

Don't allow logging in with empty password.

commit   : bf6b9e94445610a3d84cf9521032fab993f96fd6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 7 Aug 2017 17:03:42 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 7 Aug 2017 17:03:42 +0300    

Click here for diff

Some authentication methods allowed it, others did not. In the client-side,  
libpq does not even try to authenticate with an empty password, which makes  
using empty passwords hazardous: an administrator might think that an  
account with an empty password cannot be used to log in, because psql  
doesn't allow it, and not realize that a different client would in fact  
allow it. To clear that confusion and to be be consistent, disallow empty  
passwords in all authentication methods.  
  
All the authentication methods that used plaintext authentication over the  
wire, except for BSD authentication, already checked that the password  
received from the user was not empty. To avoid forgetting it in the future  
again, move the check to the recv_password_packet function. That only  
forbids using an empty password with plaintext authentication, however.  
MD5 and SCRAM need a different fix:  
  
* In stable branches, check that the MD5 hash stored for the user does not  
not correspond to an empty string. This adds some overhead to MD5  
authentication, because the server needs to compute an extra MD5 hash, but  
it is not noticeable in practice.  
  
* In HEAD, modify CREATE and ALTER ROLE to clear the password if an empty  
string, or a password hash that corresponds to an empty string, is  
specified. The user-visible behavior is the same as in the stable branches,  
the user cannot log in, but it seems better to stop the empty password from  
entering the system in the first place. Secondly, it is fairly expensive to  
check that a SCRAM hash doesn't correspond to an empty string, because  
computing a SCRAM hash is much more expensive than an MD5 hash by design,  
so better avoid doing that on every authentication.  
  
We could clear the password on CREATE/ALTER ROLE also in stable branches,  
but we would still need to check at authentication time, because even if we  
prevent empty passwords from being stored in pg_authid, there might be  
existing ones there already.  
  
Reported by Jeroen van der Ham, Ben de Graaff and Jelte Fennema.  
  
Security: CVE-2017-7546  

M doc/src/sgml/ref/create_role.sgml
M src/backend/commands/user.c
M src/backend/libpq/auth.c
M src/backend/libpq/crypt.c
M src/test/regress/expected/password.out
M src/test/regress/sql/password.sql

Fix function name in code comment

commit   : 86524f038799db9e18c86df0ea6fb40c8102c0ab    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 09:49:55 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 09:49:55 -0400    

Click here for diff

Reported-by: Peter Geoghegan <[email protected]>  

M src/backend/commands/collationcmds.c

Improve wording of subscription refresh debug messages

commit   : ad2ca3cba6e14dbd7b9f388b1e101cd5e2a2c210    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 09:40:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 09:40:12 -0400    

Click here for diff

Reported-by: Yugo Nagata <[email protected]>  

M src/backend/commands/subscriptioncmds.c

Downgrade subscription refresh messages to DEBUG1

commit   : 6f81306e4d1716bdf19aa8629b4004966918c56e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 09:16:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2017 09:16:03 -0400    

Click here for diff

The NOTICE messages about tables being added or removed during  
subscription refresh would be incorrect and possibly confusing if the  
transaction rolls back, so silence them but keep them available for  
debugging.  
  
Discussion: https://www.postgresql.org/message-id/CAD21AoAvaXizc2h7aiNyK_i0FQSa-tmhpdOGwbhh7Jy544Ad4Q%40mail.gmail.com  

M src/backend/commands/subscriptioncmds.c

Update RELEASE_CHANGES' example of branch name format.

commit   : 655727d93bbaf2569281eea07e38b1955bb627b7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Aug 2017 23:26:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Aug 2017 23:26:09 -0400    

Click here for diff

We're planning to put an underscore before the major version number in  
branch names for v10 and later.  Make sure the recipe in RELEASE_CHANGES  
reflects that.  
  
In passing, add a reminder to consider doing pgindent right before  
the branch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/RELEASE_CHANGES

Release notes for 9.6.4, 9.5.8, 9.4.13, 9.3.18, 9.2.22.

commit   : b35006ecccf505d05fd77ce0c820943996ad7ee9    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Aug 2017 17:56:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Aug 2017 17:56:49 -0400    

Click here for diff

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

Fix thinko introduced in 2bef06d516460 et al.

commit   : 5af4456a56472e1928e838c893eb0022f7ab28fb    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 5 Aug 2017 20:52:53 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 5 Aug 2017 20:52:53 -0700    

Click here for diff

The callers for GetOldestSafeDecodingTransactionId() all inverted the  
argument for the argument introduced in 2bef06d516460. Luckily this  
appears to be inconsequential for the moment, as we wait for  
concurrent in-progress transaction when assembling a  
snapshot. Additionally this could only make a difference when adding a  
second logical slot, because only a pre-existing slot could cause an  
issue by lowering the returned xid dangerously much.  
  
Reported-By: Antonin Houska  
Discussion: https://postgr.es/m/32704.1496993134@localhost  
Backport: 9.4-, where 2bef06d516460 was backpatched to.  

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

Add regression test for wide REPLICA IDENTITY FULL updates.

commit   : 0d1f98b80e094827199da8a3dea51f04d134b7bf    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 5 Aug 2017 14:41:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 5 Aug 2017 14:41:40 -0700    

Click here for diff

This just contains the regression tests added by a fix for a 9.4  
specific bug regarding $subject.  
  
Author: Andres Freund  
Backpatch: 9.5-  

M contrib/test_decoding/expected/toast.out
M contrib/test_decoding/sql/toast.sql

Doc: update v10 release notes through today.

commit   : dd2358a704fc27c3f20b252e1354740086a7b6f3    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Aug 2017 15:55:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Aug 2017 15:55:23 -0400    

Click here for diff

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

Suppress unused-variable warnings when building with ICU 4.2.

commit   : e9f4ac1389d9fe6b996937e5d308f5ec462cf69a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Aug 2017 11:48:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Aug 2017 11:48:32 -0400    

Click here for diff

Tidy-up for commit eccead9ed.  

M src/backend/commands/collationcmds.c

Improve configure's check for ICU presence.

commit   : f4f41baf29c6835dca58e3aa22c56e9e7c7754de    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Aug 2017 11:47:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Aug 2017 11:47:28 -0400    

Click here for diff

Without ICU's header files, "configure --with-icu" would succeed anyway,  
at least when using the non-pkgconfig-based setup.  Then you got a bunch of  
ugly failures at build.  Add an explicit header check to tighten that up.  

M configure
M configure.in

Make pg_stop_backup's wait_for_archive flag work on standbys.

commit   : 52f8a59dd953c6820baf153e97cf07d31b8ac1d6    
  
author   : Robert Haas <[email protected]>    
date     : Sat, 5 Aug 2017 10:49:26 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Sat, 5 Aug 2017 10:49:26 -0400    

Click here for diff

Previously, it had no effect.  Now, if archive_mode=always, it will  
work, and if not, you'll get a warning.  
  
Masahiko Sawada, Michael Paquier, and Robert Haas.  The patch as  
submitted also changed the behavior so that we would write and remove  
history files on standbys, but that seems like material for a separate  
patch to me.  
  
Discussion: http://postgr.es/m/CAD21AoC2Xw6M=ZJyejq_9d_iDkReC_=rpvQRw5QsyzKQdfYpkw@mail.gmail.com  

M doc/src/sgml/backup.sgml
M doc/src/sgml/func.sgml
M src/backend/access/transam/xlog.c

Add support for ICU 4.2

commit   : eccead9ed43dc6e653c76dce1d2f455d251bb00c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 1 Aug 2017 10:49:55 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 1 Aug 2017 10:49:55 -0400    

Click here for diff

Supporting ICU 4.2 seems useful because it ships with CentOS 6.  
  
Versions before ICU 4.6 don't support pkg-config, so document an  
installation method without using pkg-config.  
  
In ICU 4.2, ucol_getKeywordsForLocale() sometimes returns values that  
will not be accepted by uloc_toLanguageTag().  Skip loading keyword  
variants in that version.  
  
Reported-by: Victor Wagner <[email protected]>  

M doc/src/sgml/installation.sgml
M src/backend/commands/collationcmds.c

Fix bug in deciding whether to scan newly-attached partition.

commit   : f85f88bcc270cf12defc34f143456834d8d8c6f8    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 4 Aug 2017 21:54:28 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 4 Aug 2017 21:54:28 -0400    

Click here for diff

If the table being attached had different attribute numbers than the  
parent, the old code could incorrectly decide it needed to be scanned.  
  
Amit Langote, reviewed by Ashutosh Bapat  
  
Discussion: http://postgr.es/m/CA+TgmobexgbBr2+Utw-pOMw9uxaBRKRjMW_-mmzKKx9PejPLMg@mail.gmail.com  

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

Only kill sync workers at commit time in subscription DDL

commit   : 7e174fa793a2df89fe03d002a5087ef67abcdde8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 4 Aug 2017 21:14:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 4 Aug 2017 21:14:35 -0400    

Click here for diff

This allows a transaction abort to avoid killing those workers.  
  
Author: Petr Jelinek <[email protected]>  

M src/backend/access/transam/xact.c
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/launcher.c
M src/include/replication/logicallauncher.h
M src/include/replication/worker_internal.h

hash: Immediately after a bucket split, try to clean the old bucket.

commit   : ff98a5e1e49de061600feb6b4de5ce0a22d386af    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 4 Aug 2017 19:33:01 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 4 Aug 2017 19:33:01 -0400    

Click here for diff

If it works, then we won't be storing two copies of all the tuples  
that were just moved.  If not, VACUUM will still take care of it  
eventually.  Per a report from AP and analysis from Amit Kapila, it  
seems that a bulk load can cause splits fast enough that VACUUM won't  
deal with the problem in time to prevent bloat.  
  
Amit Kapila; I rewrote the comment.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/access/hash/hashpage.c

First-draft release notes for 9.6.4.

commit   : 03378c4da598840b0520a53580dd7713c95f21c8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Aug 2017 18:37:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Aug 2017 18:37:18 -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.6.sgml

Message style improvements

commit   : 26d40ada3fa5d2671a16c34b2283448832630c86    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 4 Aug 2017 18:31:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 4 Aug 2017 18:31:01 -0400    

Click here for diff

M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/walmethods.c
M src/interfaces/libpq/fe-auth-scram.c
M src/pl/plpython/expected/plpython_types.out
M src/pl/plpython/expected/plpython_types_3.out
M src/pl/plpython/plpy_typeio.c

hash: Increase the number of possible overflow bitmaps by 8x.

commit   : 620b49a16d2a16ce6f9edf072a88111f981919d0    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 4 Aug 2017 15:29:26 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 4 Aug 2017 15:29:26 -0400    

Click here for diff

Per a report from AP, it's not that hard to exhaust the supply of  
bitmap pages if you create a table with a hash index and then insert a  
few billion rows - and then you start getting errors when you try to  
insert additional rows.  In the particular case reported by AP,  
there's another fix that we can make to improve recycling of overflow  
pages, which is another way to avoid the error, but there may be other  
cases where this problem happens and that fix won't help.  So let's  
buy ourselves as much headroom as we can without rearchitecting  
anything.  
  
The comments claim that the old limit was 64GB, but it was really  
only 32GB, because we didn't use all the bits in the page for bitmap  
bits - only the largest power of 2 that could fit after deducting  
space for the page header and so forth.  Thus, we have 4kB per page  
for bitmap bits, not 8kB.  The new limit is thus actually 8 times the  
old *real* limit but only 4 times the old *purported* limit.  
  
Since this breaks on-disk compatibility, bump HASH_VERSION.  We've  
already done this earlier in this release cycle, so this doesn't cause  
any incremental inconvenience for people using pg_upgrade from  
releases prior to v10.  However, users who use pg_upgrade to reach  
10beta3 or later from 10beta2 or earlier will need to REINDEX any hash  
indexes again.  
  
Amit Kapila and Robert Haas  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/pageinspect/expected/hash.out
M contrib/pgstattuple/expected/pgstattuple.out
M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/pgstattuple.sgml
M src/include/access/hash.h

Apply ALTER ... SET NOT NULL recursively in ALTER ... ADD PRIMARY KEY.

commit   : c30f1770a93db1492755934048656ea809c1f569    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Aug 2017 11:45:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Aug 2017 11:45:18 -0400    

Click here for diff

If you do ALTER COLUMN SET NOT NULL against an inheritance parent table,  
it will recurse to mark all the child columns as NOT NULL as well.  This  
is necessary for consistency: if the column is labeled NOT NULL then  
reading it should never produce nulls.  
  
However, that didn't happen in the case where ALTER ... ADD PRIMARY KEY  
marks a target column NOT NULL that wasn't before.  That was questionable  
from the beginning, and now Tushar Ahuja points out that it can lead to  
dump/restore failures in some cases.  So let's make that case recurse too.  
  
Although this is meant to fix a bug, it's enough of a behavioral change  
that I'm pretty hesitant to back-patch, especially in view of the lack  
of similar field complaints.  It doesn't seem to be too late to put it  
into v10 though.  
  
Michael Paquier, editorialized on slightly by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c
M src/test/regress/expected/alter_table.out

Disallow SSL session tickets.

commit   : 97d3a0b0900a30fc51823c2d806ab621299f1b07    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Aug 2017 11:07:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Aug 2017 11:07:10 -0400    

Click here for diff

We don't actually support session tickets, since we do not create an SSL  
session identifier.  But it seems that OpenSSL will issue a session ticket  
on-demand anyway, which will then fail when used.  This results in  
reconnection failures when using ticket-aware client-side SSL libraries  
(such as the Npgsql .NET driver), as reported by Shay Rojansky.  
  
To fix, just tell OpenSSL not to issue tickets.  At some point in the  
far future, we might consider enabling tickets instead.  But the security  
implications of that aren't entirely clear; and besides it would have  
little benefit except for very short-lived database connections, which is  
Something We're Bad At anyhow.  It would take a lot of other work to get  
to a point where that would really be an exciting thing to do.  
  
While at it, also tell OpenSSL not to use a session cache.  This doesn't  
really do anything, since a backend would never populate the cache anyway,  
but it might gain some micro-efficiencies and/or reduce security  
exposures.  
  
Patch by me, per discussion with Heikki Linnakangas and Shay Rojansky.  
Back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/CADT4RqBU8N-csyZuzaook-c795dt22Zcwg1aHWB6tfVdAkodZA@mail.gmail.com  

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

Further unify ROLE and USER command grammar rules

commit   : b3744812215de458c80629c3a9c57f00833de8a9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 31 Jul 2017 20:36:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 31 Jul 2017 20:36:32 -0400    

Click here for diff

ALTER USER ... SET did not support all the syntax variants of ALTER ROLE  
...  SET.  Fix that, and to avoid further deviations of this kind, unify  
many the grammar rules for ROLE/USER/GROUP commands.  
  
Reported-by: Pavel Golub <[email protected]>  

M doc/src/sgml/ref/alter_user.sgml
M src/backend/parser/gram.y
M src/test/regress/expected/rolenames.out

Fix pg_dump/pg_restore to emit REFRESH MATERIALIZED VIEW commands last.

commit   : 3eb9a5e7c4c9f10178815b569dbc0058eb50c05a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Aug 2017 17:36:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Aug 2017 17:36:23 -0400    

Click here for diff

Because we push all ACL (i.e. GRANT/REVOKE) restore steps to the end,  
materialized view refreshes were occurring while the permissions on  
referenced objects were still at defaults.  This led to failures if,  
say, an MV owned by user A reads from a table owned by user B, even  
if B had granted the necessary privileges to A.  We've had multiple  
complaints about that type of restore failure, most recently from  
Jordan Gigov.  
  
The ideal fix for this would be to start treating ACLs as dependency-  
sortable objects, rather than hard-wiring anything about their dump order  
(the existing approach is a messy kluge dating to commit dc0e76ca3).  
But that's going to be a rather major change, and it certainly wouldn't  
lead to a back-patchable fix.  As a short-term solution, convert the  
existing two-pass hack (ie, normal objects then ACLs) to a three-pass hack,  
ie, normal objects then ACLs then matview refreshes.  Because this happens  
in RestoreArchive(), it will also fix the problem when restoring from an  
existing archive-format dump.  
  
(Note this means that if a matview refresh would have failed under the  
permissions prevailing at dump time, it'll fail during restore as well.  
We'll define that as user error rather than something we should try  
to work around.)  
  
To avoid performance loss in parallel restore, we need the matview  
refreshes to still be parallelizable.  Hence, clean things up enough  
so that both ACLs and matviews are handled by the parallel restore  
infrastructure, instead of reverting back to serial restore for ACLs.  
There is still a final serial step, but it shouldn't normally have to  
do anything; it's only there to try to recover if we get stuck due to  
some problem like unresolved circular dependencies.  
  
Patch by me, but it owes something to an earlier attempt by Kevin Grittner.  
Back-patch to 9.3 where materialized views were introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix build on zlib-less environments

commit   : 9a3b5d3ad0f1c19c47e2ee65b372344cb0616c9a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 3 Aug 2017 14:48:54 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 3 Aug 2017 14:48:54 -0400    

Click here for diff

Commit 4d57e8381677 added support for getting I/O errors out of zlib,  
but it introduced a portability problem for systems without zlib.  
Repair by wrapping the zlib call inside #ifdef and restore the original  
code in the other branch.  
  
This serves to illustrate the inadequacy of the zlib abstraction in  
pg_backup_archiver: there is no way to call gzerror() in that  
abstraction.  This means that the several places that call GZREAD and  
GZWRITE are currently doing error reporting wrongly, but ENOTIME to get  
it fixed before next week's release set.  
  
Backpatch to 9.4, like the commit that introduced the problem.  

M src/bin/pg_dump/pg_backup_tar.c

Fix lock upgrade hazard in ATExecAttachPartition.

commit   : 972b6ec20bf090a18145624f8092d2cb1715ab83    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 3 Aug 2017 14:21:00 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 3 Aug 2017 14:21:00 -0400    

Click here for diff

Amit Langote  
  
Discussion: http://postgr.es/m/CAFjFpReT_kq_uwU_B8aWDxR7jNGE=P0iELycdq5oupi=xSQTOw@mail.gmail.com  

M src/backend/commands/tablecmds.c

Code beautification for ATExecAttachPartition.

commit   : 583df3b5c56258df2a03e08e3ef00aabe0cf306d    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 3 Aug 2017 14:16:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 3 Aug 2017 14:16:33 -0400    

Click here for diff

Amit Langote  
  
Discussion: http://postgr.es/m/CAFjFpReT_kq_uwU_B8aWDxR7jNGE=P0iELycdq5oupi=xSQTOw@mail.gmail.com  

M src/backend/commands/tablecmds.c

Allow a foreign table CHECK constraint to be initially NOT VALID.

commit   : 86705aa8c3f3ec78c0b8e66cd8a4b0768e51adeb    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 3 Aug 2017 13:09:15 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 3 Aug 2017 13:09:15 -0400    

Click here for diff

For a table, the constraint can be considered validated immediately,  
because the table must be empty.  But for a foreign table this is  
not necessarily the case.  
  
Fixes a bug in commit f27a6b15e6566fba7748d0d9a3fc5bcfd52c4a1b.  
  
Amit Langote, with some changes by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/parser/parse_utilcmd.c

Improve ExecModifyTable comments.

commit   : 12a34f59bf8bc5babf375c95f5192d208dca1739    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 3 Aug 2017 12:47:00 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 3 Aug 2017 12:47:00 -0400    

Click here for diff

Some of these comments wrongly implied that only an AFTER ROW trigger  
will cause a 'wholerow' attribute to be present for a foreign table,  
but a BEFORE ROW trigger can have the same effect.  Others implied  
that it would always be present for a foreign table, but that's not  
true either.  
  
Etsuro Fujita and Robert Haas  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/executor/nodeModifyTable.c

Teach map_partition_varattnos to handle whole-row expressions.

commit   : 610e8ebb0fadd7a738c2ad07fef6c5ea86b11f8d    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 3 Aug 2017 11:21:29 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 3 Aug 2017 11:21:29 -0400    

Click here for diff

Otherwise, partitioned tables with RETURNING expressions or subject  
to a WITH CHECK OPTION do not work properly.  
  
Amit Langote, reviewed by Amit Khandekar and Etsuro Fujita.  A few  
comment changes by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/catalog/partition.c
M src/backend/commands/tablecmds.c
M src/backend/executor/nodeModifyTable.c
M src/backend/parser/parse_utilcmd.c
M src/backend/rewrite/rewriteManip.c
M src/include/catalog/partition.h
M src/include/rewrite/rewriteManip.h
M src/test/regress/expected/insert.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/insert.sql
M src/test/regress/sql/updatable_views.sql

Add new files to nls.mk and add translation markers

commit   : 5ff3d73813ebcc3ff80be77c30b458d728951036    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 2 Aug 2017 22:44:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 2 Aug 2017 22:44:46 -0400    

Click here for diff

M src/bin/pg_basebackup/nls.mk
M src/bin/pg_basebackup/walmethods.c
M src/interfaces/libpq/nls.mk

Fix pg_dump's errno checking for zlib I/O

commit   : 4d57e83816778c6f61ea35c697f937a6f9c3c3de    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 2 Aug 2017 18:26:26 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 2 Aug 2017 18:26:26 -0400    

Click here for diff

Some error reports were reporting strerror(errno), which for some error  
conditions coming from zlib are wrong, resulting in confusing reports  
such as  
  pg_restore: [compress_io] could not read from input file: Success  
which makes no sense.  To correctly extract the error message we need to  
use gzerror(), so let's do that.  
  
This isn't as comprehensive or as neat as I would like, but at least it  
should improve things in many common cases.  The zlib abstraction in  
compress_io does not seem to be applied consistently enough; we could  
perhaps improve that, but it seems master-only material, not a bug fix  
for back-patching.  
  
This problem goes back all the way, but I decided to apply back to 9.4  
only, because older branches don't contain commit 14ea89366 which this  
change depends on.  
  
Authors: Vladimir Kunschikov, Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_tar.c

Add pgtcl back to the list of externally-maintained client interfaces.

commit   : 80215156f9a10dfcacfcef15be35ebb0d79300b5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Aug 2017 16:55:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Aug 2017 16:55:03 -0400    

Click here for diff

FlightAware is still maintaining this, and indeed is seemingly being  
more active with it than the pgtclng fork is.  List both, for the  
time being anyway.  
  
In the back branches, also back-port commit e20f679f6 and other  
recent updates to the client-interfaces list.  I think these are  
probably of current interest to users of back branches.  I did  
not touch the list of externally maintained PLs in the back  
branches, though.  Those are much more likely to be server version  
sensitive, and I don't know which of these PLs work all the way back.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove broken and useless entry-count printing in HASH_DEBUG code.

commit   : 9d4e56699957b261390c50dcda7f947470017484    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Aug 2017 12:16:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Aug 2017 12:16:50 -0400    

Click here for diff

init_htab(), with #define HASH_DEBUG, prints a bunch of hashtable  
parameters.  It used to also print nentries, but commit 44ca4022f changed  
that to "hash_get_num_entries(hctl)", which is wrong (the parameter should  
be "hashp").  
  
Rather than correct the coding, though, let's just remove that field from  
the printout.  The table must be empty, since we just finished building  
it, so expensively calculating the number of entries is rather pointless.  
Moreover hash_get_num_entries makes assumptions (about not needing locks)  
which we could do without in debugging code.  
  
Noted by Choi Doo-Won in bug #14764.  Back-patch to 9.6 where the  
faulty code was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/hash/dynahash.c

Get a snapshot before COPY in table sync

commit   : cf652018332819716b10c9de9ce80c81284d6815    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 2 Aug 2017 10:59:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 2 Aug 2017 10:59:01 -0400    

Click here for diff

This fixes a crash if the local table has a function index and the  
function makes non-immutable calls.  
  
Reported-by: Scott Milliken <[email protected]>  
Author: Masahiko Sawada <[email protected]>  

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

Remove duplicate setting of SSL_OP_SINGLE_DH_USE option.

commit   : f352f91cbf2f662c4f043d3650010b02da0cde1c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Aug 2017 11:28:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Aug 2017 11:28:46 -0400    

Click here for diff

Commit c0a15e07c moved the setting of OpenSSL's SSL_OP_SINGLE_DH_USE option  
into a new subroutine initialize_dh(), but forgot to remove it from where  
it was.  SSL_CTX_set_options() is a trivial function, amounting indeed to  
just "ctx->options |= op", hence there's no reason to contort the code or  
break separation of concerns to avoid calling it twice.  So separating the  
DH setup from disabling of old protocol versions is a good change, but we  
need to finish the job.  
  
Noted while poking into the question of SSL session tickets.  

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

Fix OBJECT_TYPE/OBJECT_DOMAIN confusion

commit   : 41cefbb6db58c574e086efef2773a978f108d717    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 2 Aug 2017 10:40:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 2 Aug 2017 10:40:32 -0400    

Click here for diff

This doesn't have a significant impact except that now SECURITY LABEL ON  
DOMAIN rejects types that are not domains.  
  
Reported-by: 高增ē¦ <[email protected]>  

M src/backend/parser/gram.y

Revert test case added by commit 1e165d05fe06a9072867607886f818bc255507db.

commit   : 32ca22b02da9d8088b58b3dc64ad78464c7513a3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Aug 2017 20:15:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Aug 2017 20:15:10 -0400    

Click here for diff

The buildfarm is still showing at least three distinct behaviors for  
a bad locale name in CREATE COLLATION.  Although this test was helpful  
for getting the error reporting code into some usable shape, it doesn't  
seem worth carrying multiple expected-files in order to support the  
test in perpetuity.  So pull it back out.  
  
Discussion: https://postgr.es/m/CAKKotZS-wcDcofXDCH=sidiuajE+nqHn2CGjLLX78anyDmi3gQ@mail.gmail.com  

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

Second try at getting useful errors out of newlocale/_create_locale.

commit   : 514f6132935d5bda84a475d4b70fe2bcfe116766    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Aug 2017 17:17:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Aug 2017 17:17:20 -0400    

Click here for diff

The early buildfarm returns for commit 1e165d05f are pretty awful:  
not only does Windows not return a useful error, but it looks like  
a lot of Unix-ish platforms don't either.  Given the number of  
different errnos seen so far, guess that what's really going on is  
that some newlocale() implementations fail to set errno at all.  
Hence, let's try zeroing errno just before newlocale() and then  
if it's still zero report as though it's ENOENT.  That should cover  
the Windows case too.  
  
It's clear that we'll have to drop the regression test case, unless  
we want to maintain a separate expected-file for platforms without  
HAVE_LOCALE_T.  But I'll leave it there awhile longer to see if this  
actually improves matters or not.  
  
Discussion: https://postgr.es/m/CAKKotZS-wcDcofXDCH=sidiuajE+nqHn2CGjLLX78anyDmi3gQ@mail.gmail.com  

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

Suppress less info in regression tests using DROP CASCADE.

commit   : 8e7537261c4b7d296fc10513b93bd67dc3d415b0    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Aug 2017 16:49:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Aug 2017 16:49:23 -0400    

Click here for diff

DROP CASCADE doesn't currently promise to visit dependent objects in  
a fixed order, so when the regression tests use it, we typically need  
to suppress the details of which objects get dropped in order to have  
predictable test output.  Traditionally we've done that by setting  
client_min_messages higher than NOTICE, but there's a better way:  
we can "\set VERBOSITY terse" in psql.  That suppresses the DETAIL  
message with the object list, but we still get the basic notice telling  
how many objects were dropped.  So at least the test case can verify  
that the expected number of objects were dropped.  
  
The VERBOSITY method was already in use in a few places, but run  
around and use it wherever it makes sense.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/create_view.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/expected/typed_table.out
M src/test/regress/sql/alter_generic.sql
M src/test/regress/sql/create_index.sql
M src/test/regress/sql/create_view.sql
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/stats_ext.sql
M src/test/regress/sql/typed_table.sql

Try to deliver a sane message for _create_locale() failure on Windows.

commit   : 1e165d05fe06a9072867607886f818bc255507db    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Aug 2017 16:11:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Aug 2017 16:11:51 -0400    

Click here for diff

We were just printing errno, which is certainly not gonna work on  
Windows.  Now, it's not entirely clear from Microsoft's documentation  
whether _create_locale() adheres to standard Windows error reporting  
conventions, but let's assume it does and try to map the GetLastError  
result to an errno.  If this turns out not to work, probably the best  
thing to do will be to assume the error is always ENOENT on Windows.  
  
This is a longstanding bug, but given the lack of previous field  
complaints, I'm not excited about back-patching it.  
  
Per report from Murtuza Zabuawala.  
  
Discussion: https://postgr.es/m/CAKKotZS-wcDcofXDCH=sidiuajE+nqHn2CGjLLX78anyDmi3gQ@mail.gmail.com  

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

doc: Fix typo

commit   : c1bb7870463bd8ab2b28b363616ec60a9041e13a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 1 Aug 2017 14:33:55 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 1 Aug 2017 14:33:55 -0400    

Click here for diff

Author: Fabien COELHO <[email protected]>  

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

Allow creation of C/POSIX collations without depending on libc behavior.

commit   : f97256570f45c33abf695a189ab11b25e6cd7985    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Aug 2017 13:51:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Aug 2017 13:51:05 -0400    

Click here for diff

Most of our collations code has special handling for the locale names  
"C" and "POSIX", allowing those collations to be used whether or not  
the system libraries think those locale names are valid, or indeed  
whether said libraries even have any locale support.  But we missed  
handling things that way in CREATE COLLATION.  This meant you couldn't  
clone the C/POSIX collations, nor explicitly define a new collation  
using those locale names, unless the libraries allow it.  That's pretty  
pointless, as well as being a violation of pg_newlocale_from_collation's  
API specification.  
  
The practical effect of this change is quite limited: it allows creating  
such collations even on platforms that don't HAVE_LOCALE_T, and it allows  
making "POSIX" collation objects on Windows, which before this would only  
let you make "C" collation objects.  Hence, even though this is a bug fix  
IMO, it doesn't seem worth the trouble to back-patch.  
  
In passing, suppress the DROP CASCADE detail messages at the end of the  
collation regression test.  I'm surprised we've never been bit by  
message ordering issues there.  
  
Per report from Murtuza Zabuawala.  
  
Discussion: https://postgr.es/m/CAKKotZS-wcDcofXDCH=sidiuajE+nqHn2CGjLLX78anyDmi3gQ@mail.gmail.com  

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

Further improve consistency of configure's program searching.

commit   : b21c569cea58a1396d9ffd8a7e7a84aa991a1123    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Aug 2017 11:40:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Aug 2017 11:40:00 -0400    

Click here for diff

Peter Eisentraut noted that commit 40b9f1921 had broken a configure  
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will  
allow the search to be overridden by specifying a value for FOO on  
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)  
accepts such an override only if it's an absolute path.  We had worked  
around that behavior for some, but not all, of the pre-existing uses  
of AC_PATH_PROGS by just skipping the macro altogether when FOO is  
already set.  Let's standardize on that workaround for all uses of  
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a  
new macro PGAC_PATH_PROGS.  While at it, fix a deficiency of the old  
workaround code by making sure we report the setting to configure's log.  
  
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts  
non-absolute override inputs to absolute form, eg "PYTHON=python3"  
becomes, say, PYTHON = /usr/bin/python3.  But that will take some  
nontrivial coding so it doesn't seem like a thing to do in late beta.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/docbook.m4
M config/perl.m4
M config/programs.m4
M config/python.m4
M config/tcl.m4
M configure
M configure.in

Comment fix for partition_rbound_cmp().

commit   : 4de6216877a32e869fe1cf168c1fe1ffb8c3d576    
  
author   : Dean Rasheed <[email protected]>    
date     : Tue, 1 Aug 2017 09:40:45 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Tue, 1 Aug 2017 09:40:45 +0100    

Click here for diff

This was an oversight in d363d42.  
  
Beena Emerson  

M src/backend/catalog/partition.c

Fix comment.

commit   : e662ef0f2e95d9da3df705ddaaff36b0c01c7acc    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Tue, 1 Aug 2017 08:00:11 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Tue, 1 Aug 2017 08:00:11 +0900    

Click here for diff

XLByteToSeg and XLByteToPrevSeg calculate only a segment number.  The  
definition of these macros were modified by commit  
dfda6ebaec6763090fb78b458a979b558c50b39b but the comment remain  
unchanged.  
  
Patch by Yugo Nagata. Back patched to 9.3 and beyond.  

M src/include/access/xlog_internal.h

Fix typo

commit   : 0b02e3f1289e0454d313e6add45f43a287ebaf8b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 31 Jul 2017 17:22:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 31 Jul 2017 17:22:47 -0400    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

M src/bin/pg_upgrade/info.c

Fix typo

commit   : f40254a799f7057a415917dacb5ba7eab5b17a99    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 31 Jul 2017 17:08:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 31 Jul 2017 17:08:14 -0400    

Click here for diff

Author: Etsuro Fujita <[email protected]>  

M src/backend/executor/execMain.c

Doc: add v10 release notes entries for the DH parameter changes.

commit   : 4427b515e6195bd2304e082ea5a5c5d6d36c4eb5    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 31 Jul 2017 22:47:07 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 31 Jul 2017 22:47:07 +0300    

Click here for diff

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

Always use 2048 bit DH parameters for OpenSSL ephemeral DH ciphers.

commit   : c0a15e07cd718cb6e455e68328f522ac076a0e4b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 31 Jul 2017 22:36:09 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 31 Jul 2017 22:36:09 +0300    

Click here for diff

1024 bits is considered weak these days, but OpenSSL always passes 1024 as  
the key length to the tmp_dh callback. All the code to handle other key  
lengths is, in fact, dead.  
  
To remedy those issues:  
  
* Only include hard-coded 2048-bit parameters.  
* Set the parameters directly with SSL_CTX_set_tmp_dh(), without the  
  callback  
* The name of the file containing the DH parameters is now a GUC. This  
  replaces the old hardcoded "dh1024.pem" filename. (The files for other  
  key lengths, dh512.pem, dh2048.pem, etc. were never actually used.)  
  
This is not a new problem, but it doesn't seem worth the risk and churn to  
backport. If you care enough about the strength of the DH parameters on  
old versions, you can create custom DH parameters, with as many bits as you  
wish, and put them in the "dh1024.pem" file.  
  
Per report by Nicolas Guini and Damian Quiroga. Reviewed by Michael Paquier.  
  
Discussion: https://www.postgresql.org/message-id/CAMxBoUyjOOautVozN6ofzym828aNrDjuCcOTcCquxjwS-L2hGQ@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/libpq/libpq.h

Doc: specify that the minimum supported version of Perl is 5.8.3.

commit   : dea6ba939fd2b70dd444349d52585a0694578571    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 31 Jul 2017 13:42:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 31 Jul 2017 13:42:48 -0400    

Click here for diff

Previously the docs just said "5.8 or later".  Experimentation shows  
that while you can build on Unix from a git checkout with 5.8.0,  
compiling recent PL/Perl requires at least 5.8.1, and you won't be  
able to run the TAP tests with less than 5.8.3 because that's when  
they added "prove".  (I do not have any information on just what the  
MSVC build scripts require.)  
  
Since all these versions are quite ancient, let's not split hairs  
in the docs, but just say that 5.8.3 is the minimum requirement.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Record full paths of programs sought by "configure".

commit   : 40b9f192170a300cd9456eb71ba7c792ba9533e1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 31 Jul 2017 13:02:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 31 Jul 2017 13:02:49 -0400    

Click here for diff

Previously we had a mix of uses of AC_CHECK_PROG[S] and AC_PATH_PROG[S].  
The only difference between those macros is that the latter emits the  
full path to the program it finds, eg "/usr/bin/prove", whereas the  
former emits just "prove".  Let's standardize on always emitting the  
full path; this is better for documentation of the build, and it might  
prevent some types of failures if later build steps are done with  
a different PATH setting.  
  
I did not touch the AC_CHECK_PROG[S] calls in ax_pthread.m4 and  
ax_prog_perl_modules.m4.  There seems no need to make those diverge from  
upstream, since we do not record the programs sought by the former, while  
the latter's call to AC_CHECK_PROG(PERL,...) will never be reached.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/docbook.m4
M config/programs.m4
M configure
M configure.in

Tighten coding for non-composite case in plperl's return_next.

commit   : b4cc35fbb709bd6fcae8998f041fd731c9acbf42    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 31 Jul 2017 11:33:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 31 Jul 2017 11:33:46 -0400    

Click here for diff

Coverity complained about this code's practice of using scalar variables  
as single-element arrays.  While that's really just nitpicking, it probably  
is more readable to declare them as arrays, so let's do that.  A more  
important point is that the code was just blithely assuming that the  
result tupledesc has exactly one column; if it doesn't, we'd likely get  
a crash of some sort in tuplestore_putvalues.  Since the tupledesc is  
manufactured outside of plperl, that seems like an uncomfortably long  
chain of assumptions.  We can nail it down at little cost with a sanity  
check earlier in the function.  

M src/pl/plperl/plperl.c

Fix function comment for dumpACL()

commit   : d2a51e3efcbab5b288bbadba1a7dfa123a50ba5b    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 31 Jul 2017 10:37:08 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 31 Jul 2017 10:37:08 -0400    

Click here for diff

The comment for dumpACL() got neglected when initacls and initracls were  
added and the discussion of what 'racls' is wasn't very clear either.  
  
Per complaint from Tom.  

M src/bin/pg_dump/pg_dump.c

Add missing comment in postgresql.conf.

commit   : 393d47ed0f5b764341c7733ef60e8442d3e9bdc2    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Mon, 31 Jul 2017 11:24:51 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Mon, 31 Jul 2017 11:24:51 +0900    

Click here for diff

current_source requires to restart server to reflect the new  
value. Per Yugo Nagata and Masahiko Sawada.  
  
Back patched to 9.2 and beyond.  

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

Add missing comment in postgresql.conf.

commit   : 8b015dd723ffc1ae7123758dda90d0bf0fa9b464    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Mon, 31 Jul 2017 11:06:37 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Mon, 31 Jul 2017 11:06:37 +0900    

Click here for diff

dynamic_shared_memory_type requires to restart server to reflect  
the new value. Per Yugo Nagata and Masahiko Sawada.  
  
Back pached to 9.4 and beyond.  

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

Add missing comment in postgresql.conf.

commit   : 9fe63092b541e48aebb1190179b47249672a8560    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Mon, 31 Jul 2017 10:46:32 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Mon, 31 Jul 2017 10:46:32 +0900    

Click here for diff

max_logical_replication_workers requires to restart server to reflect  
the new value. Per Yugo Nagata. Minor editing by me.  

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

Move ExecProcNode from dispatch to function pointer based model.

commit   : cc9f08b6b813e30789100b6b34110d8be1090ba0    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 17 Jul 2017 00:33:49 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 17 Jul 2017 00:33:49 -0700    

Click here for diff

This allows us to add stack-depth checks the first time an executor  
node is called, and skip that overhead on following  
calls. Additionally it yields a nice speedup.  
  
While it'd probably have been a good idea to have that check all  
along, it has become more important after the new expression  
evaluation framework in b8d7f053c5c2bf2a7e - there's no stack depth  
check in common paths anymore now. We previously relied on  
ExecEvalExpr() being executed somewhere.  
  
We should move towards that model for further routines, but as this is  
required for v10, it seems better to only do the necessary (which  
already is quite large).  
  
Author: Andres Freund, Tom Lane  
Reported-By: Julien Rouhaud  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  

M src/backend/executor/execProcnode.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/include/executor/executor.h
M src/include/executor/nodeAgg.h
M src/include/executor/nodeAppend.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeCtescan.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/executor/nodeFunctionscan.h
M src/include/executor/nodeGather.h
M src/include/executor/nodeGatherMerge.h
M src/include/executor/nodeGroup.h
M src/include/executor/nodeHash.h
M src/include/executor/nodeHashjoin.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h
M src/include/executor/nodeLimit.h
M src/include/executor/nodeLockRows.h
M src/include/executor/nodeMaterial.h
M src/include/executor/nodeMergeAppend.h
M src/include/executor/nodeMergejoin.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/nodeNamedtuplestorescan.h
M src/include/executor/nodeNestloop.h
M src/include/executor/nodeProjectSet.h
M src/include/executor/nodeRecursiveunion.h
M src/include/executor/nodeResult.h
M src/include/executor/nodeSamplescan.h
M src/include/executor/nodeSeqscan.h
M src/include/executor/nodeSetOp.h
M src/include/executor/nodeSort.h
M src/include/executor/nodeSubqueryscan.h
M src/include/executor/nodeTableFuncscan.h
M src/include/executor/nodeTidscan.h
M src/include/executor/nodeUnique.h
M src/include/executor/nodeValuesscan.h
M src/include/executor/nodeWindowAgg.h
M src/include/executor/nodeWorktablescan.h
M src/include/nodes/execnodes.h

Move interrupt checking from ExecProcNode() to executor nodes.

commit   : d47cfef7116fb36349949f5c757aa2112c249804    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 25 Jul 2017 17:37:17 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 25 Jul 2017 17:37:17 -0700    

Click here for diff

In a followup commit ExecProcNode(), and especially the large switch  
it contains, will largely be replaced by a function pointer directly  
to the correct node. The node functions will then get invoked by a  
thin inline function wrapper. To avoid having to include miscadmin.h  
in headers - CHECK_FOR_INTERRUPTS() - move the interrupt checks into  
the individual executor routines.  
  
While looking through all executor nodes, I noticed a number of  
arguably missing interrupt checks, add these too.  
  
Author: Andres Freund, Tom Lane  
Reviewed-By: Tom Lane  
Discussion:  
    https://postgr.es/m/[email protected]  

M src/backend/executor/execProcnode.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeWindowAgg.c

Include publication owner's name in the output of \dRp+.

commit   : 9dea962b3ef48f6e96172653b7cf80cb5f53e6b6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Jul 2017 17:44:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Jul 2017 17:44:48 -0400    

Click here for diff

Without this, \dRp prints information that \dRp+ does not, which  
seems pretty odd.  
  
Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

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

PL/Perl portability fix: absorb relevant -D switches from Perl.

commit   : 3c163a7fc76debbbdad1bdd3c43721cffe72f4db    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Jul 2017 14:25:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Jul 2017 14:25:28 -0400    

Click here for diff

The Perl documentation is very clear that stuff calling libperl should  
be built with the compiler switches shown by Perl's $Config{ccflags}.  
We'd been ignoring that up to now, and mostly getting away with it,  
but recent Perl versions contain ABI compatibility cross-checks that  
fail on some builds because of this omission.  In particular the  
sizeof(PerlInterpreter) can come out different due to some fields being  
added or removed; which means we have a live ABI hazard that we'd better  
fix rather than continuing to sweep it under the rug.  
  
However, it still seems like a bad idea to just absorb $Config{ccflags}  
verbatim.  In some environments Perl was built with a different compiler  
that doesn't even use the same switch syntax.  -D switch syntax is pretty  
universal though, and absorbing Perl's -D switches really ought to be  
enough to fix the problem.  
  
Furthermore, Perl likes to inject stuff like -D_LARGEFILE_SOURCE and  
-D_FILE_OFFSET_BITS=64 into $Config{ccflags}, which affect libc ABIs on  
platforms where they're relevant.  Adopting those seems dangerous too.  
It's unclear whether a build wherein Perl and Postgres have different ideas  
of sizeof(off_t) etc would work, or whether anyone would care about making  
it work.  But it's dead certain that having different stdio ABIs in  
core Postgres and PL/Perl will not work; we've seen that movie before.  
Therefore, let's also ignore -D switches for symbols beginning with  
underscore.  The symbols that we actually need to import should be the ones  
mentioned in perl.h's PL_bincompat_options stanza, and none of those start  
with underscore, so this seems likely to work.  (If it turns out not to  
work everywhere, we could consider intersecting the symbols mentioned in  
PL_bincompat_options with the -D switches.  But that will be much more  
complicated, so let's try this way first.)  
  
This will need to be back-patched, but first let's see what the  
buildfarm makes of it.  
  
Ashutosh Sharma, some adjustments by me  
  
Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com  

M config/perl.m4
M configure
M configure.in
M contrib/hstore_plperl/Makefile
M src/Makefile.global.in
M src/pl/plperl/GNUmakefile
M src/tools/msvc/Mkvcbuild.pm

PL/Perl portability fix: avoid including XSUB.h in plperl.c.

commit   : bebe174bb4462ef079a1d7eeafb82ff969f160a4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Jul 2017 12:25:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Jul 2017 12:25:43 -0400    

Click here for diff

In Perl builds that define PERL_IMPLICIT_SYS, XSUB.h defines macros  
that replace a whole lot of basic libc functions with Perl functions.  
We can't tolerate that in plperl.c; it breaks at least PG_TRY and  
probably other stuff.  The core idea of this patch is to include XSUB.h  
only in the .xs files where it's really needed, and to move any code  
broken by PERL_IMPLICIT_SYS out of the .xs files and into plperl.c.  
  
The reason this hasn't been a problem before is that our build techniques  
did not result in PERL_IMPLICIT_SYS appearing as a #define in PL/Perl,  
even on some platforms where Perl thinks it is defined.  That's about to  
change in order to fix a nasty portability issue, so we need this work to  
make the code safe for that.  
  
Rather unaccountably, the Perl people chose XSUB.h as the place to provide  
the versions of the aTHX/aTHX_ macros that are needed by code that's not  
explicitly aware of the MULTIPLICITY API conventions.  Hence, just removing  
XSUB.h from plperl.c fails miserably.  But we can work around that by  
defining PERL_NO_GET_CONTEXT (which would make the relevant stanza of  
XSUB.h a no-op anyway).  As explained in perlguts.pod, that means we need  
to add a "dTHX" macro call in every C function that calls a Perl API  
function.  In most of them we just add this at the top; but since the  
macro fetches the current Perl interpreter pointer, more care is needed  
in functions that switch the active interpreter.  Lack of the macro is  
easily recognized since it results in bleats about "my_perl" not being  
defined.  
  
(A nice side benefit of this is that it significantly reduces the number  
of fetches of the current interpreter pointer.  On my machine, plperl.so  
gets more than 10% smaller, and there's probably some performance win too.  
We could reduce the number of fetches still more by decorating the code  
with pTHX_/aTHX_ macros to pass the interpreter pointer around, as  
explained by perlguts.pod; but that's a task for another day.)  
  
Formatting note: pgindent seems happy to treat "dTHX;" as a declaration  
so long as it's the first thing after the left brace, as we'd already  
observed with respect to the similar macro "dSP;".  If you try to put  
it later in a set of declarations, pgindent puts ugly extra space  
around it.  
  
Having removed XSUB.h from plperl.c, we need only move the support  
functions for spi_return_next and util_elog (both of which use PG_TRY)  
out of the .xs files and into plperl.c.  This seems sufficient to  
avoid the known problems caused by PERL_IMPLICIT_SYS, although we  
could move more code if additional issues emerge.  
  
This will need to be back-patched, but first let's see what the  
buildfarm makes of it.  
  
Patch by me, with some help from Ashutosh Sharma  
  
Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com  

M contrib/hstore_plperl/hstore_plperl.c
M src/pl/plperl/SPI.xs
M src/pl/plperl/Util.xs
M src/pl/plperl/plperl.c
M src/pl/plperl/plperl.h
M src/pl/plperl/plperl_helpers.h

Fix psql tab completion for CREATE USER MAPPING.

commit   : 8d304072a2573f0bfbdf893cc79197aeecdb5242    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Jul 2017 14:13:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Jul 2017 14:13:15 -0400    

Click here for diff

After typing CREATE USER M..., it would not fill in MAPPING FOR,  
even though that was clearly intended behavior.  
  
Jeff Janes  
  
Discussion: https://postgr.es/m/CAMkU=1wo2iQ6jWnN=egqOb5NxEPn0PpANEtKHr3uPooQ+nYPtw@mail.gmail.com  

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

Standardize describe.c's behavior for no-matching-objects a bit more.

commit   : 77cb4a1d6730a69906baf0b052aae7dc11f07764    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Jul 2017 13:30:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Jul 2017 13:30:59 -0400    

Click here for diff

Most functions in this file are content to print an empty table if there  
are no matching objects.  In some, the behavior is to loop over all  
matching objects and print a table for each one; therefore, without any  
extra logic, nothing at all would be printed if no objects match.  
We accept that outcome in QUIET mode, but in normal mode it seems better  
to print a helpful message.  The new \dRp+ command had not gotten that  
memo; fix it.  
  
listDbRoleSettings() is out of step on this, but I think it's better for  
it to print a custom message rather than an empty table, because of the  
possibility that the user is confused about what the pattern arguments mean  
or which is which.  The original message wording was entirely useless for  
clarifying that, though, not to mention being unlike the wordings used  
elsewhere.  Improve the text, and also print the messages with psql_error  
as is the general custom here.  
  
listTables() is also out in left field, but since it's such a heavily  
used function, I'm hesitant to change its behavior so much as to print  
an empty table rather than a custom message.  People are probably used  
to getting a message.  But we can make the wording more standardized and  
helpful, and print it with psql_error rather than printing to stdout.  
  
In both listDbRoleSettings and listTables, we play dumb and emit an  
empty table, not a custom message, in QUIET mode.  That was true before  
and I see no need to change it.  
  
Several of the places printing such messages risked dumping core if  
no pattern string had been provided; make them more wary.  (This case  
is presently unreachable in describeTableDetails; but it shouldn't be  
assuming that command.c will never pass it a null.  The text search  
functions would only reach the case if a database contained no text  
search objects, which is also currently impossible since we pin the  
built-in objects, but again it seems unwise to assume that here.)  
  
Daniel Gustafsson, tweaked a bit by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

Avoid use of sprintf/snprintf in describe.c.

commit   : 1e2f941db1671909ba3bde447c224bb64d1c002a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Jul 2017 12:12:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Jul 2017 12:12:37 -0400    

Click here for diff

Most places were already using the PQExpBuffer library for constructing  
variable-length strings; bring the two stragglers into line.  
describeOneTSParser was living particularly dangerously since it wasn't  
even using snprintf().  
  
Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

Sync listDbRoleSettings() with the rest of the world.

commit   : b884f629dcbac002a703ccaf0990d9467ae69a19    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Jul 2017 11:57:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Jul 2017 11:57:29 -0400    

Click here for diff

listDbRoleSettings() handled its server version check randomly differently  
from every other comparable function in describe.c, not only as to code  
layout but also message wording.  It also leaked memory, because its  
PQExpBuffer management was also unlike everyplace else (and wrong).  
  
Also fix an error-case leak in add_tablespace_footer().  
  
In passing, standardize the format of function header comments in  
describe.c --- we usually put "/*" alone on a line.  
  
Daniel Gustafsson, memory leak fixes by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

Fix very minor memory leaks in psql's command.c.

commit   : dc4da3dc84c7c0d1a58275f78f0e3401385e3700    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Jul 2017 11:10:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Jul 2017 11:10:38 -0400    

Click here for diff

\drds leaked its second pattern argument if any, and \connect leaked  
any empty-string or "-" arguments.  These are old bugs, but it's hard  
to imagine any real use-case where the leaks could amount to anything  
meaningful, so not bothering with a back-patch.  
  
Daniel Gustafsson and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/command.c

Work around Msys weakness in Testlib.pm's command_like()

commit   : efd7f8e36553cd32e445061cbbc80d32028f4248    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 26 Jul 2017 17:15:59 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 26 Jul 2017 17:15:59 -0400    

Click here for diff

When output of IPC::Run::run () is redirected to scalar references, in  
certain circumstances the Msys perl does not correctly detect that the  
end of file has been seen, making the test hang indefinitely. One such  
circumstance is when the command is 'pg_ctl start', and such a change  
was made in commit f13ea95f9e. The workaround, which only applies on  
MSys, is to redirect the output to temporary files and then read them in  
when the process has finished.  
  
Patch by me, reviewed and tweaked by Tom Lane.  

M src/bin/pg_ctl/t/001_start_stop.pl
M src/test/perl/TestLib.pm

Clean up SQL emitted by psql/describe.c.

commit   : 50d2426f5a6d6a47da9ea67be55c3e89069e7bec    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Jul 2017 19:35:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Jul 2017 19:35:35 -0400    

Click here for diff

Fix assorted places that had not bothered with the convention of  
prefixing catalog and function names with "pg_catalog.".  That  
could possibly result in query failure when running with a nondefault  
search_path.  Also fix two places that weren't quoting OID literals.  
I think the latter hasn't mattered much since about 7.3, but it's still  
a bad idea to be doing it in 99 places and not in 2 others.  
  
Also remove a useless EXISTS sub-select that someone had stuck into  
describeOneTableDetails' queries for child tables.  We just got the OID  
out of pg_class, so I hardly see how checking that it exists in pg_class  
was doing anything helpful.  
  
In passing, try to improve the emitted formatting of a couple of  
these queries, though I didn't work really hard on that.  And merge  
unnecessarily duplicative coding in some other places.  
  
Much of this was new in HEAD, but some was quite old; back-patch  
as appropriate.  

M src/bin/psql/describe.c

commit   : 5e3254f0865d2e3372cfd29249063bdaedfa4b00    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 26 Jul 2017 18:17:18 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 26 Jul 2017 18:17:18 -0400    

Click here for diff

M src/backend/replication/logical/proto.c
M src/common/sha2.c
M src/common/sha2_openssl.c
M src/include/common/sha2.h
M src/include/replication/logicalproto.h
M src/include/replication/pgoutput.h

Fix concurrent locking of tuple update chain

commit   : 459c64d3227f878c72ef0145a67e80e17728c556    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 26 Jul 2017 17:24:16 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 26 Jul 2017 17:24:16 -0400    

Click here for diff

If several sessions are concurrently locking a tuple update chain with  
nonconflicting lock modes using an old snapshot, and they all succeed,  
it may happen that some of them fail because of restarting the loop (due  
to a concurrent Xmax change) and getting an error in the subsequent pass  
while trying to obtain a tuple lock that they already have in some tuple  
version.  
  
This can only happen with very high concurrency (where a row is being  
both updated and FK-checked by multiple transactions concurrently), but  
it's been observed in the field and can have unpleasant consequences  
such as an FK check failing to see a tuple that definitely exists:  
    ERROR:  insert or update on table "child_table" violates foreign key constraint "fk_constraint_name"  
    DETAIL:  Key (keyid)=(123456) is not present in table "parent_table".  
(where the key is observably present in the table).  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove obsolete comments about functional dependencies

commit   : c28e4f4dc6aeb75cf35f1339cbe3387263e0e69b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 26 Jul 2017 11:40:39 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 26 Jul 2017 11:40:39 -0400    

Click here for diff

Initial submitted versions of the functional dependencies patch ignored  
row groups that were smaller than a configured size.  However, that  
consideration was removed in late stages of the patch just before  
commit, but some comments referring to it remained.  Remove them to  
avoid confusion.  
  
Author: Atsushi Torikoshi  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/statistics/README.dependencies
M src/backend/statistics/dependencies.c

Make PostgresNode easily subclassable

commit   : 54dacc746628799a3a09ebb78876b0a8d2742d23    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 25 Jul 2017 18:39:44 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 25 Jul 2017 18:39:44 -0400    

Click here for diff

This module becomes much more useful if we allow it to be used as base  
class for external projects.  To achieve this, change the exported  
get_new_node function into a class method instead, and use the standard  
Perl idiom of accepting the class as first argument.  This method works  
as expected for subclasses.  The standalone function is kept for  
backwards compatibility, though it could be removed in pg11.  
  
Author: Chap Flackman, based on an earlier patch from Craig Ringer  
Discussion: https://postgr.es/m/CAMsr+YF8kO+4+K-_U4PtN==2FndJ+5Bn6A19XHhMiBykEwv0wA@mail.gmail.com  

M src/test/perl/PostgresNode.pm
M src/test/perl/README

Fix race conditions in replication slot operations

commit   : 9915de6c1cb2c9b87f5f504c97832cdf3a809753    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 25 Jul 2017 13:26:49 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 25 Jul 2017 13:26:49 -0400    

Click here for diff

It is relatively easy to get a replication slot to look as still active  
while one process is in the process of getting rid of it; when some  
other process tries to "acquire" the slot, it would fail with an error  
message of "replication slot XYZ is active for PID N".  
  
The error message in itself is fine, except that when the intention is  
to drop the slot, it is unhelpful: the useful behavior would be to wait  
until the slot is no longer acquired, so that the drop can proceed.  To  
implement this, we use a condition variable so that slot acquisition can  
be told to wait on that condition variable if the slot is already  
acquired, and we make any change in active_pid broadcast a signal on the  
condition variable.  Thus, as soon as the slot is released, the drop  
will proceed properly.  
  
Reported by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Authors: Petr Jelƭnek, Ɓlvaro Herrera  

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

Fix partitioning crashes during error reporting.

commit   : 4132dbec69dd4d437e132e57a74a98a40cdcf776    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 24 Jul 2017 18:08:08 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 24 Jul 2017 18:08:08 -0400    

Click here for diff

In various places where we reverse-map a tuple before calling  
ExecBuildSlotValueDescription, we neglected to ensure that the  
slot descriptor matched the tuple stored in it.  
  
Amit Langote and Amit Khandekar, reviewed by Etsuro Fujita  
  
Discussion: http://postgr.es/m/CAJ3gD9cqpP=WvJj=dv1ONkPWjy8ZuUaOM4_x86i3uQPas=0_jg@mail.gmail.com  

M src/backend/executor/execMain.c
M src/test/regress/expected/insert.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/insert.sql
M src/test/regress/sql/updatable_views.sql

Fix race condition in predicate-lock init code in EXEC_BACKEND builds.

commit   : e2c8100e60729368c84e9a49ada9b44df5a1b851    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Jul 2017 16:45:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Jul 2017 16:45:46 -0400    

Click here for diff

Trading a little too heavily on letting the code path be the same whether  
we were creating shared data structures or only attaching to them,  
InitPredicateLocks() inserted the "scratch" PredicateLockTargetHash entry  
unconditionally.  This is just wrong if we're in a postmaster child,  
which would only reach this code in EXEC_BACKEND builds.  Most of the  
time, the hash_search(HASH_ENTER) call would simply report that the  
entry already existed, causing no visible effect since the code did not  
bother to check for that possibility.  However, if this happened while  
some other backend had transiently removed the "scratch" entry, then  
that other backend's eventual RestoreScratchTarget would suffer an  
assert failure; this appears to be the explanation for a recent failure  
on buildfarm member culicidae.  In non-assert builds, there would be  
no visible consequences there either.  But nonetheless this is a pretty  
bad bug for EXEC_BACKEND builds, for two reasons:  
  
1. Each new backend would perform the hash_search(HASH_ENTER) call  
without holding any lock that would prevent concurrent access to the  
PredicateLockTargetHash hash table.  This creates a low but certainly  
nonzero risk of corruption of that hash table.  
  
2. In the event that the race condition occurred, by reinserting the  
scratch entry too soon, we were defeating the entire purpose of the  
scratch entry, namely to guarantee that transaction commit could move  
hash table entries around with no risk of out-of-memory failure.  
The odds of an actual OOM failure are quite low, but not zero, and if  
it did happen it would again result in corruption of the hash table.  
  
The user-visible symptoms of such corruption are a little hard to predict,  
but would presumably amount to misbehavior of SERIALIZABLE transactions  
that'd require a crash or postmaster restart to fix.  
  
To fix, just skip the hash insertion if IsUnderPostmaster.  I also  
inserted a bunch of assertions that the expected things happen  
depending on whether IsUnderPostmaster is true.  That might be overkill,  
since most comparable code in other functions isn't quite that paranoid,  
but once burnt twice shy.  
  
In passing, also move a couple of lines to places where they seemed  
to make more sense.  
  
Diagnosis of problem by Thomas Munro, patch by me.  Back-patch to  
all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

When WCOs are present, disable direct foreign table modification.

commit   : 7086be6e3627c1ad797e32ebbdd232905b5f577f    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 24 Jul 2017 15:57:24 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 24 Jul 2017 15:57:24 -0400    

Click here for diff

If the user modifies a view that has CHECK OPTIONs and this gets  
translated into a modification to an underlying relation which happens  
to be a foreign table, the check options should be enforced.  In the  
normal code path, that was happening properly, but it was not working  
properly for "direct" modification because the whole operation gets  
pushed to the remote side in that case and we never have an option to  
enforce the constraint against individual tuples.  Fix by disabling  
direct modification when there is a need to enforce CHECK OPTIONs.  
  
Etsuro Fujita, reviewed by Kyotaro Horiguchi and by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml
M src/backend/optimizer/plan/createplan.c

Ensure that pg_get_ruledef()'s output matches pg_get_viewdef()'s.

commit   : b4af9e3f378ef56fa48b98a0bfb641900b0280dc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Jul 2017 15:16:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Jul 2017 15:16:31 -0400    

Click here for diff

Various cases involving renaming of view columns are handled by having  
make_viewdef pass down the view's current relation tupledesc to  
get_query_def, which then takes care to use the column names from the  
tupledesc for the output column names of the SELECT.  For some reason  
though, we'd missed teaching make_ruledef to do similarly when it is  
printing an ON SELECT rule, even though this is exactly the same case.  
The results from pg_get_ruledef would then be different and arguably wrong.  
In particular, this breaks pre-v10 versions of pg_dump, which in some  
situations would define views by means of emitting a CREATE RULE ... ON  
SELECT command.  Third-party tools might not be happy either.  
  
In passing, clean up some crufty code in make_viewdef; we'd apparently  
modernized the equivalent code in make_ruledef somewhere along the way,  
and missed this copy.  
  
Per report from Gilles Darold.  Back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/[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

Be more consistent about errors for opfamily member lookup failures.

commit   : 278cb4341103e967189997985b09981a73e23a34    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Jul 2017 11:23:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Jul 2017 11:23:27 -0400    

Click here for diff

Add error checks in some places that were calling get_opfamily_member  
or get_opfamily_proc and just assuming that the call could never fail.  
Also, standardize the wording for such errors in some other places.  
  
None of these errors are expected in normal use, hence they're just  
elog not ereport.  But they may be handy for diagnosing omissions in  
custom opclasses.  
  
Rushabh Lathia found the oversight in RelationBuildPartitionKey();  
I found the others by grepping for all callers of these functions.  
  
Discussion: https://postgr.es/m/CAGPqQf2R9Nk8htpv0FFi+FP776EwMyGuORpc9zYkZKC8sFQE3g@mail.gmail.com  

M src/backend/catalog/index.c
M src/backend/catalog/partition.c
M src/backend/executor/execExpr.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeIndexscan.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/createplan.c
M src/backend/utils/cache/relcache.c

MSVC: Finish clean.bat build artifact coverage.

commit   : bbbd9121e63f9f7cf8cc86025d5d848fba477eb4    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 24 Jul 2017 00:13:23 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 24 Jul 2017 00:13:23 -0700    

Click here for diff

With this, "git clean -dnx" is clear after a "clean dist" following a  
build.  Preserve sql_help.h in non-dist cleans, like the Makefile does.  

M src/tools/msvc/clean.bat

MSVC: Accept tcl86.lib in addition to tcl86t.lib.

commit   : 71ad8000da5d836c9ca117a164c38d84284a336f    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 23 Jul 2017 23:53:27 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 23 Jul 2017 23:53:27 -0700    

Click here for diff

ActiveTcl8.6.4.1.299124-win32-x86_64-threaded.exe ships just tcl86.lib.  
Back-patch to 9.2, like the commit recognizing tcl86t.lib.  

M src/tools/msvc/Mkvcbuild.pm

Fix pg_dump's handling of event triggers.

commit   : 93f039b4944fdf806f029ed46cf192bc9021d8e7    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Jul 2017 20:20:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Jul 2017 20:20:09 -0400    

Click here for diff

pg_dump with the --clean option failed to emit DROP EVENT TRIGGER  
commands for event triggers.  In a closely related oversight,  
it also did not emit ALTER OWNER commands for event triggers.  
Since only superusers can create event triggers, the latter oversight  
is of little practical consequence ... but if we're going to record  
an owner for event triggers, then surely pg_dump should preserve it.  
  
Per complaint from Greg Atkins.  Back-patch to 9.3 where event triggers  
were introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve comments about partitioned hash table freelists.

commit   : ab2324fd468c4bc6d8b012552550ed951d97339a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Jul 2017 18:02:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Jul 2017 18:02:26 -0400    

Click here for diff

While I couldn't find any live bugs in commit 44ca4022f, the comments  
seemed pretty far from adequate; in particular it was not made plain that  
"borrowing" entries from other freelists is critical for correctness.  
Try to improve the commentary.  A couple of very minor code style  
tweaks, as well.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/hash/dynahash.c

Update expected results for collate.linux.utf8 regression test.

commit   : 991c8b04fc5d61a308bb00ea34a7ff710051c53f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Jul 2017 12:15:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Jul 2017 12:15:19 -0400    

Click here for diff

I believe this changed as a consequence of commit 54baa4813: trying to  
clone the "C" collation now produces a true clone with collencoding -1,  
hence the error message if it's duplicate no longer specifies an encoding.  
  
Per buildfarm member crake, which apparently hadn't been running this  
test for the last few weeks.  

M src/test/regress/expected/collate.linux.utf8.out

Fix typo in comment

commit   : de38489b926e3e5af84f22cf4788fe4498e13c72    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 17 Jul 2017 09:51:42 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 17 Jul 2017 09:51:42 -0400    

Click here for diff

Commit fd31cd265138 renamed the variable to skipping_blocks, but forgot  
to update this comment.  
  
Noticed while inspecting code.  

M src/backend/commands/vacuumlazy.c

Doc: update versioning information in libpq.sgml.

commit   : e22efaabf16e3972b91893d89597407d142fb309    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Jul 2017 17:50:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Jul 2017 17:50:57 -0400    

Click here for diff

The descriptions of PQserverVersion and PQlibVersion hadn't been updated  
for the new two-part version-numbering approach.  Fix that.  
  
In passing, remove some trailing whitespace elsewhere in the file.  

M doc/src/sgml/libpq.sgml

pg_rewind: Fix some problems when copying files >2GB.

commit   : a46fe6e8be02421ea7e80c5a6d5e388417904fd4    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 21 Jul 2017 14:25:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 21 Jul 2017 14:25:36 -0400    

Click here for diff

When incrementally updating a file larger than 2GB, the old code could  
either fail outright (if the client asked the server for bytes beyond  
the 2GB boundary) or fail to copy all the blocks that had actually  
been modified (if the server reported a file size to the client in  
excess of 2GB), resulting in data corruption.  Generally, such files  
won't occur anyway, but they might if using a non-default segment size  
or if there the directory contains stray files unrelated to  
PostgreSQL.  Fix by a more prudent choice of data types.  
  
Even with these improvements, this code still uses a mix of different  
types (off_t, size_t, uint64, int64) to represent file sizes and  
offsets, not all of which necessarily have the same width or  
signedness, so further cleanup might be in order here.  However, at  
least now they all have the potential to be 64 bits wide on 64-bit  
platforms.  
  
Kuntal Ghosh and Michael Paquier, with a tweak by me.  
  
Discussion: http://postgr.es/m/CAGz5QC+8gbkz=Brp0TgoKNqHWTzonbPtPex80U0O6Uh_bevbaA@mail.gmail.com  

M src/bin/pg_rewind/libpq_fetch.c

Stabilize postgres_fdw regression tests.

commit   : 88f48b57fd33289c26c78ecb28c5f2a1c7a4ac6c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Jul 2017 14:20:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Jul 2017 14:20:43 -0400    

Click here for diff

The new test cases added in commit 8bf58c0d9 turn out to have output  
that can vary depending on the lc_messages setting prevailing on the  
test server.  Hide the remote end's error messages to ensure stable  
output.  This isn't a terribly desirable solution; we'd rather know  
that the connection failed for the expected reason and not some other  
one.  But there seems little choice for the moment.  
  
Per buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pg_rewind: Fix busted sanity check.

commit   : 063ff9210c54928a2d19f9e826486621809e1b82    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 21 Jul 2017 12:48:22 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 21 Jul 2017 12:48:22 -0400    

Click here for diff

As written, the code would only fail the sanity check if none of the  
columns returned by the server were of the expected type, but we want  
it to fail if even one column is not of the expected type.  
  
Discussion: http://postgr.es/m/CA+TgmoYuY5zW7JEs+1hSS1D=V5K8h1SQuESrq=bMNeo0B71Sfw@mail.gmail.com  

M src/bin/pg_rewind/libpq_fetch.c

Re-establish postgres_fdw connections after server or user mapping changes.

commit   : 8bf58c0d9bd336868e2d6489f11dc094cad9ad91    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Jul 2017 12:51:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Jul 2017 12:51:38 -0400    

Click here for diff

Previously, postgres_fdw would keep on using an existing connection even  
if the user did ALTER SERVER or ALTER USER MAPPING commands that should  
affect connection parameters.  Teach it to watch for catcache invals  
on these catalogs and re-establish connections when the relevant catalog  
entries change.  Per bug #14738 from Michal Lis.  
  
In passing, clean up some rather crufty decisions in commit ae9bfc5d6  
about where fields of ConnCacheEntry should be reset.  We now reset  
all the fields whenever we open a new connection.  
  
Kyotaro Horiguchi, reviewed by Ashutosh Bapat and myself.  
Back-patch to 9.3 where postgres_fdw appeared.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix double shared memory allocation.

commit   : 7e1fb4c59e4ac86de2640d0f3453fde270ec1ff8    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 21 Jul 2017 13:31:20 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 21 Jul 2017 13:31:20 +0300    

Click here for diff

SLRU buffer lwlocks are allocated twice by oversight in commit  
fe702a7b3f9f2bc5bf6d173166d7d55226af82c8 where that locks were moved to  
separate tranche. The bug doesn't have user-visible effects except small  
overspending of shared memory.  
  
Backpatch to 9.6 where it was introduced.  
  
Alexander Korotkov with small editorization by me.  

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

Make the new partition regression tests locale-independent.

commit   : 68f785fd522bca9372cce965ac10cbd8c239c076    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 21 Jul 2017 10:18:01 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 21 Jul 2017 10:18:01 +0100    

Click here for diff

The order of partitions listed by \d+ is in general locale-dependent.  
Rename the partitions in the test added by d363d42bb9 to force them to  
be listed in a consistent order.  

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

Use MINVALUE/MAXVALUE instead of UNBOUNDED for range partition bounds.

commit   : d363d42bb9a4399a0207bd3b371c966e22e06bd3    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 21 Jul 2017 09:20:47 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 21 Jul 2017 09:20:47 +0100    

Click here for diff

Previously, UNBOUNDED meant no lower bound when used in the FROM list,  
and no upper bound when used in the TO list, which was OK for  
single-column range partitioning, but problematic with multiple  
columns. For example, an upper bound of (10.0, UNBOUNDED) would not be  
collocated with a lower bound of (10.0, UNBOUNDED), thus making it  
difficult or impossible to define contiguous multi-column range  
partitions in some cases.  
  
Fix this by using MINVALUE and MAXVALUE instead of UNBOUNDED to  
represent a partition column that is unbounded below or above  
respectively. This syntax removes any ambiguity, and ensures that if  
one partition's lower bound equals another partition's upper bound,  
then the partitions are contiguous.  
  
Also drop the constraint prohibiting finite values after an unbounded  
column, and just document the fact that any values after MINVALUE or  
MAXVALUE are ignored. Previously it was necessary to repeat UNBOUNDED  
multiple times, which was needlessly verbose.  
  
Note: Forces a post-PG 10 beta2 initdb.  
  
Report by Amul Sul, original patch by Amit Langote with some  
additional hacking by me.  
  
Discussion: https://postgr.es/m/CAAJ_b947mowpLdxL3jo3YLKngRjrq9+Ej4ymduQTfYR+8=YAYQ@mail.gmail.com  

M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/partition.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/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/create_table.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/insert.out
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/insert.sql
M src/tools/pgindent/typedefs.list

In v10 release notes, call out sequence changes as a compatibility item.

commit   : 866f4a7c210857aa342bf901558d170325094dde    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Jul 2017 15:28:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Jul 2017 15:28:42 -0400    

Click here for diff

The previous description didn't make it clear that this change  
potentially breaks applications, partly because the entry wasn't even  
in the compatibility-hazard section.  Move and clarify.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: clarify description of degenerate NATURAL joins.

commit   : ed3dc224e5aabd3cb0a5c348107f973fe5b10b0d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Jul 2017 12:41:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Jul 2017 12:41:26 -0400    

Click here for diff

Claiming that NATURAL JOIN is equivalent to CROSS JOIN when there are  
no common column names is only strictly correct if it's an inner join;  
you can't say e.g. CROSS LEFT JOIN.  Better to explain it as meaning  
JOIN ON TRUE, instead.  Per a suggestion from David Johnston.  
  
Discussion: https://postgr.es/m/CAKFQuwb+mYszQhDS9f_dqRrk1=Pe-S6D=XMkAXcDf4ykKPmgKQ@mail.gmail.com  

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

Fix dumping of outer joins with empty qual lists.

commit   : eb145fdfea91ee5dc6d7aad0309527f810f7c90a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Jul 2017 11:29:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Jul 2017 11:29:36 -0400    

Click here for diff

Normally, a JoinExpr would have empty "quals" only if it came from CROSS  
JOIN syntax.  However, it's possible to get to this state by specifying  
NATURAL JOIN between two tables with no common column names, and there  
might be other ways too.  The code previously printed no ON clause if  
"quals" was empty; that's right for CROSS JOIN but syntactically invalid  
if it's some type of outer join.  Fix by printing ON TRUE in that case.  
  
This got broken by commit 2ffa740be, which stopped using NATURAL JOIN  
syntax in ruleutils output due to its brittleness in the face of  
column renamings.  Back-patch to 9.3 where that commit appeared.  
  
Per report from Tushar Ahuja.  
  
Discussion: https://postgr.es/m/[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

Add static assertions about pg_control fitting into one disk sector.

commit   : 3cb29c42f990522131535eea75c691fb23191685    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Jul 2017 16:16:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Jul 2017 16:16:57 -0400    

Click here for diff

When pg_control was first designed, sizeof(ControlFileData) was small  
enough that a comment seemed like plenty to document the assumption that  
it'd fit into one disk sector.  Now it's nearly 300 bytes, raising the  
possibility that somebody would carelessly add enough stuff to create  
a problem.  Let's add a StaticAssertStmt() to ensure that the situation  
doesn't pass unnoticed if it ever occurs.  
  
While at it, rename PG_CONTROL_SIZE to PG_CONTROL_FILE_SIZE to make it  
clearer what that symbol means, and convert the existing runtime  
comparisons of sizeof(ControlFileData) vs. PG_CONTROL_FILE_SIZE to be  
static asserts --- we didn't have that technology when this code was  
first written.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/pg_rewind.c
M src/include/catalog/pg_control.h

Doc: add missing note about permissions needed to change log_lock_waits.

commit   : 5752dcd45bd8b9a9115d4be12b9a391464884a39    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Jul 2017 12:58:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Jul 2017 12:58:36 -0400    

Click here for diff

log_lock_waits is PGC_SUSET, but config.sgml lacked the standard  
boilerplate sentence noting that.  
  
Report: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml

Improve make_tsvector() to handle empty input, and simplify its callers.

commit   : 04a2c7f412d01da8100de79b13df4fd39e15ce25    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Jul 2017 13:13:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Jul 2017 13:13:47 -0400    

Click here for diff

It seemed a bit silly that each caller of make_tsvector() was laboriously  
special-casing the situation where no lexemes were found, when it would  
be easy and much more bullet-proof to make make_tsvector() handle that.  

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

Fix serious performance problems in json(b) to_tsvector().

commit   : b4c6d31c0be0f5c42a75d50afcf13bdd392db4a1    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Jul 2017 12:45:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Jul 2017 12:45:51 -0400    

Click here for diff

In an off-list followup to bug #14745, Bob Jones complained that  
to_tsvector() on a 2MB jsonb value took an unreasonable amount of  
time and space --- enough to draw the wrath of the OOM killer on  
his machine.  On my machine, his example proved to require upwards  
of 18 seconds and 4GB, which seemed pretty bogus considering that  
to_tsvector() on the same data treated as text took just a couple  
hundred msec and 10 or so MB.  
  
On investigation, the problem is that the implementation scans each  
string element of the json(b) and converts it to tsvector separately,  
then applies tsvector_concat() to join those separate tsvectors.  
The unreasonable memory usage came from leaking every single one of  
the transient tsvectors --- but even without that mistake, this is an  
O(N^2) or worse algorithm, because tsvector_concat() has to repeatedly  
process the words coming from earlier elements.  
  
We can fix it by accumulating all the lexeme data and applying  
make_tsvector() just once.  As a side benefit, that also makes the  
desired adjustment of lexeme positions far cheaper, because we can  
just tweak the running "pos" counter between JSON elements.  
  
In passing, try to make the explanation of that tweak more intelligible.  
(I didn't think that a barely-readable comment far removed from the  
actual code was helpful.)  And do some minor other code beautification.  

M src/backend/tsearch/to_tsany.c
M src/include/tsearch/ts_type.h

Doc: fix thinko in v10 release notes.

commit   : fb9bd4b0469e06d96c8cfff86d231401b0916736    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Jul 2017 10:17:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Jul 2017 10:17:15 -0400    

Click here for diff

s/log_destination/log_directory/, per Jov in bug #14749.  
  
Report: https://postgr.es/m/[email protected]  

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

Reverse-convert row types in ExecWithCheckOptions.

commit   : c85ec643ff2586e2d144374f51f93bfa215088a2    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 17 Jul 2017 21:56:31 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 17 Jul 2017 21:56:31 -0400    

Click here for diff

Just as we already do in ExecConstraints, and for the same reason:  
to improve the quality of error messages.  
  
Etsuro Fujita, reviewed by Amit Langote  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/executor/execMain.c
M src/test/regress/expected/updatable_views.out

Use a real RT index when setting up partition tuple routing.

commit   : f81a91db4d1c2032632aa5df9fc14be24f5fe5ec    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 17 Jul 2017 21:29:45 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 17 Jul 2017 21:29:45 -0400    

Click here for diff

Before, we always used a dummy value of 1, but that's not right when  
the partitioned table being modified is inside of a WITH clause  
rather than part of the main query.  
  
Amit Langote, reported and reviewd by Etsuro Fujita, with a comment  
change by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/commands/copy.c
M src/backend/executor/execMain.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/executor.h
M src/test/regress/expected/insert.out
M src/test/regress/sql/insert.sql

Doc: explain dollar quoting in the intro part of the pl/pgsql chapter.

commit   : 533463307bf67e1bb7acc345ba7ea535c6aebb78    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Jul 2017 16:43:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Jul 2017 16:43:03 -0400    

Click here for diff

We're throwing people into the guts of the syntax with not much context;  
let's back up one step and point out that this goes inside a literal in  
a CREATE FUNCTION command.  Per suggestion from Kurt Kartaltepe.  
  
Discussion: https://postgr.es/m/CACawnnyWAmH+au8nfZhLiFfWKjXy4d0kY+eZWfcxPRnjVfaa_Q@mail.gmail.com  

M doc/src/sgml/plpgsql.sgml

Improve legibility of numeric literal

commit   : cde11fa3c003407fc6c4ddc427d57e588ea17d1c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 17 Jul 2017 15:35:19 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 17 Jul 2017 15:35:19 -0400    

Click here for diff

M src/test/perl/PostgresNode.pm

Merge large_object.sql test into largeobject.source.

commit   : a570feaf927b73c5036fa47ea949ca51f2687950    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Jul 2017 15:28:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Jul 2017 15:28:16 -0400    

Click here for diff

It seems pretty confusing to have tests named both largeobject and  
large_object.  The latter is of very recent vintage (commit ff992c074),  
so get rid of it in favor of merging into the former.  
  
Also, enable the LO comment test that was added by commit 70ad7ed4e,  
since the later commit added the then-missing pg_upgrade functionality.  
The large_object.sql test case is almost completely redundant with that,  
but not quite: it seems like creating a user-defined LO with an OID in  
the system range might be an interesting case for pg_upgrade, so let's  
keep it.  
  
Like the earlier patch, back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

D src/test/regress/expected/large_object.out
M src/test/regress/input/largeobject.source
M src/test/regress/output/largeobject.source
M src/test/regress/output/largeobject_1.source
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
D src/test/regress/sql/large_object.sql

Use usleep instead of select for timeouts in PostgresNode.pm

commit   : 6c6970a280a50434c28ccd461ba864798f5d2a04    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 17 Jul 2017 15:22:37 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 17 Jul 2017 15:22:37 -0400    

Click here for diff

select() for pure timeouts is not portable, and in particular doesn't  
work on Windows.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgresNode.pm

commit   : 09c2e7cd2ff0b884625c37ce8249832820c58710    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 17 Jul 2017 12:03:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 17 Jul 2017 12:03:35 -0400    

Click here for diff

One, logging for CREATE INDEX was oblivious to the fact that when  
an unlogged table is created, *only* operations on the init fork  
should be logged.  
  
Two, init fork buffers need to be flushed after they are written;  
otherwise, a filesystem-level copy following recovery may do the  
wrong thing.  (There may be a better fix for this issue than the  
one used here, but this is transposed from the similar logic already  
present in XLogReadBufferForRedoExtended, and a broader refactoring  
after beta2 seems inadvisable.)  
  
Amit Kapila, reviewed by Ashutosh Sharma, Kyotaro Horiguchi,  
and Michael Paquier  
  
Discussion: http://postgr.es/m/CAA4eK1JpcMsEtOL_J7WODumeEfyrPi7FPYHeVdS7fyyrCrgp4w@mail.gmail.com  

M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashpage.c

commit   : 2f7f45a64badec18ce75e44ca35c078f08e2651e    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 16 Jul 2017 23:13:58 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 16 Jul 2017 23:13:58 -0700    

Click here for diff

Doing so was useful in 273c458a2b3a0fb73968020ea5e9e35eb6928967 but  
became obsolete when 818fd4a67d610991757b610755e3065fb99d80a5 caused  
postgres.exe to provide the relevant symbols.  No other loadable module  
links to libpgcommon directly.  

M src/tools/msvc/Mkvcbuild.pm

fix typo

commit   : deb0129a222ec6b189d5d198cf77012591f300d8    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 16 Jul 2017 12:00:23 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 16 Jul 2017 12:00:23 -0400    

Click here for diff

M src/tools/msvc/vcregress.pl

Fix vcregress.pl PROVE_FLAGS bug in commit 93b7d9731f

commit   : fd2487e49f406471c11fc337b3e06dcb8579c809    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 16 Jul 2017 11:24:29 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 16 Jul 2017 11:24:29 -0400    

Click here for diff

This change didn't adjust the publicly visible taptest function, causing  
buildfarm failures on bowerbird.  
  
Backpatch to 9.4 like previous change.  

M src/tools/msvc/vcregress.pl

Improve comments for execExpr.c's handling of FieldStore subexpressions.

commit   : de2af6e001a3d6aeb2a10a802e73af8c7d1d3405    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Jul 2017 16:57:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Jul 2017 16:57:43 -0400    

Click here for diff

Given this code's general eagerness to use subexpressions' output variables  
as temporary workspace, it's not exactly clear that it is safe for  
FieldStore to tell a newval subexpression that it can write into the same  
variable that is being supplied as a potential input.  Document the chain  
of assumptions needed for that to be safe.  

M src/backend/executor/execExpr.c

Improve comments for execExpr.c's isAssignmentIndirectionExpr().

commit   : e9b64824a067f8180e2553127467d7522516122c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Jul 2017 14:03:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Jul 2017 14:03:32 -0400    

Click here for diff

I got confused about why this function doesn't need to recursively  
search the expression tree for a CaseTestExpr node.  After figuring  
that out, add a comment to save the next person some time.  

M src/backend/executor/execExpr.c

pg_upgrade i18n: Fix "%s server/cluster" wording

commit   : 837255cc81fb59b12f5a70ac2a8a9850bccf13e0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 14 Jul 2017 19:20:21 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 14 Jul 2017 19:20:21 -0400    

Click here for diff

The original wording was impossible to translate correctly.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/server.c

Code review for NextValueExpr expression node type.

commit   : decb08ebdf07f2fea4b6bb43380366ef5defbafb    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Jul 2017 15:25:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Jul 2017 15:25:43 -0400    

Click here for diff

Add missing infrastructure for this node type, notably in ruleutils.c where  
its lack could demonstrably cause EXPLAIN to fail.  Add outfuncs/readfuncs  
support.  (outfuncs support is useful today for debugging purposes.  The  
readfuncs support may never be needed, since at present it would only  
matter for parallel query and NextValueExpr should never appear in a  
parallelizable query; but it seems like a bad idea to have a primnode type  
that isn't fully supported here.)  Teach planner infrastructure that  
NextValueExpr is a volatile, parallel-unsafe, non-leaky expression node  
with cost cpu_operator_cost.  Given its limited scope of usage, there  
*might* be no live bug today from the lack of that knowledge, but it's  
certainly going to bite us on the rear someday.  Teach pg_stat_statements  
about the new node type, too.  
  
While at it, also teach cost_qual_eval() that MinMaxExpr, SQLValueFunction,  
XmlExpr, and CoerceToDomain should be charged as cpu_operator_cost.  
Failing to do this for SQLValueFunction was an oversight in my commit  
0bb51aa96.  The others are longer-standing oversights, but no time like the  
present to fix them.  (In principle, CoerceToDomain could have cost much  
higher than this, but it doesn't presently seem worth trying to examine the  
domain's constraints here.)  
  
Modify execExprInterp.c to execute NextValueExpr as an out-of-line  
function; it seems quite unlikely to me that it's worth insisting that  
it be inlined in all expression eval methods.  Besides, providing the  
out-of-line function doesn't stop anyone from inlining if they want to.  
  
Adjust some places where NextValueExpr support had been inserted with the  
aid of a dartboard rather than keeping it in the same order as elsewhere.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/catalog/dependency.c
M src/backend/executor/execExprInterp.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/clauses.c
M src/backend/utils/adt/ruleutils.c
M src/include/executor/execExpr.h
M src/include/nodes/nodes.h
M src/include/nodes/primnodes.h

commit   : c95275fc202c231e867d2f0a00e8d18621b67f0d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Jul 2017 12:26:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Jul 2017 12:26:53 -0400    

Click here for diff

In the frontend Makefiles that pull in libpgfeutils, we'd generally  
done it like this:  
  
LDFLAGS += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport)  
  
That method is badly broken, as seen in bug #14742 from Chris Ruprecht.  
The -L flag for src/fe_utils ends up being placed after whatever random  
-L flags are in LDFLAGS already.  That puts us at risk of pulling in  
libpgfeutils.a from some previous installation rather than the freshly  
built one in src/fe_utils.  Also, the lack of an "override" is hazardous  
if someone tries to specify some LDFLAGS on the make command line.  
  
The correct way to do it is like this:  
  
override LDFLAGS := -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport) $(LDFLAGS)  
  
so that libpgfeutils, along with libpq, libpgport, and libpgcommon, are  
guaranteed to be pulled in from the build tree and not from any referenced  
system directory, because their -L flags will appear first.  
  
In some places we'd been even lazier and done it like this:  
  
LDFLAGS += -L$(top_builddir)/src/fe_utils -lpgfeutils -lpq  
  
which is subtly wrong in an additional way: on platforms where we can't  
restrict the symbols exported by libpq.so, it allows libpgfeutils to  
latch onto libpgport and libpgcommon symbols from libpq.so, rather than  
directly from those static libraries as intended.  This carries hazards  
like those explained in the comments for the libpq_pgport macro.  
  
In addition to fixing the broken libpgfeutils usages, I tried to  
standardize on using $(libpq_pgport) like so:  
  
override LDFLAGS := $(libpq_pgport) $(LDFLAGS)  
  
even where libpgfeutils is not in the picture.  This makes no difference  
right now but will hopefully discourage future mistakes of the same ilk.  
And it's more like the way we handle CPPFLAGS in libpq-using Makefiles.  
  
In passing, just for consistency, make pgbench include PTHREAD_LIBS the  
same way everyplace else does, ie just after LIBS rather than in some  
random place in the command line.  This might have practical effect if  
there are -L switches in that macro on some platform.  
  
It looks to me like the MSVC build scripts are not affected by this  
error, but someone more familiar with them than I might want to double  
check.  
  
Back-patch to 9.6 where libpgfeutils was introduced.  In 9.6, the hazard  
this error creates is that a reinstallation might link to the prior  
installation's copy of libpgfeutils.a and thereby fail to absorb a  
minor-version bug fix.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/Makefile
M src/bin/pg_basebackup/Makefile
M src/bin/pg_ctl/Makefile
M src/bin/pg_dump/Makefile
M src/bin/pg_rewind/Makefile
M src/bin/pg_upgrade/Makefile
M src/bin/pgbench/Makefile
M src/bin/psql/Makefile
M src/bin/scripts/Makefile
M src/tools/findoidjoins/Makefile

Fix pg_basebackup output to stdout on Windows.

commit   : 8046465c2ecf6841ad80265f84294edd98aefd8b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 14 Jul 2017 16:02:53 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 14 Jul 2017 16:02:53 +0300    

Click here for diff

When writing a backup to stdout with pg_basebackup on Windows, put stdout  
to binary mode. Any CR bytes in the output will otherwise be output  
incorrectly as CR+LF.  
  
In the passing, standardize on using "_setmode" instead of "setmode", for  
the sake of consistency. They both do the same thing, but according to  
MSDN documentation, setmode is deprecated.  
  
Fixes bug #14634, reported by Henry Boehlert. Patch by Haribabu Kommi.  
Backpatch to all supported versions.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Fix dumping of FUNCTION RTEs that contain non-function-call expressions.

commit   : a3ca72ae9ac14acb2b1b9cd207ac0c8a01f1439a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Jul 2017 19:24:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Jul 2017 19:24:44 -0400    

Click here for diff

The grammar will only accept something syntactically similar to a function  
call in a function-in-FROM expression.  However, there are various ways  
to input something that ruleutils.c won't deparse that way, potentially  
leading to a view or rule that fails dump/reload.  Fix by inserting a  
dummy CAST around anything that isn't going to deparse as a function  
(which is one of the ways to get something like that in there in the  
first place).  
  
In HEAD, also make use of the infrastructure added by this to avoid  
emitting unnecessary parentheses in CREATE INDEX deparsing.  I did  
not change that in back branches, thinking that people might find it  
to be unexpected/unnecessary behavioral change.  
  
In HEAD, also fix incorrect logic for when to add extra parens to  
partition key expressions.  Somebody apparently thought they could  
get away with simpler logic than pg_get_indexdef_worker has, but  
they were wrong --- a counterexample is PARTITION BY LIST ((a[1])).  
Ignoring the prettyprint flag for partition expressions isn't exactly  
a nice solution anyway.  
  
This has been broken all along, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typo in v10 release notes

commit   : 2036f71b751152e443beecfdd8bffbb4e17447c2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Jul 2017 18:14:01 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Jul 2017 18:14:01 -0400    

Click here for diff

The new functions return a list of files in the corresponding directory,  
not the name of the directory itself.  
  
Pointed out by Gianni Ciolli.  

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

Fix race between GetNewTransactionId and GetOldestActiveTransactionId.

commit   : 74fc83869e169470e91363546d945002e71e54ab    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Jul 2017 15:47:02 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Jul 2017 15:47:02 +0300    

Click here for diff

The race condition goes like this:  
  
1. GetNewTransactionId advances nextXid e.g. from 100 to 101  
2. GetOldestActiveTransactionId reads the new nextXid, 101  
3. GetOldestActiveTransactionId loops through the proc array. There are no  
   active XIDs there, so it returns 101 as the oldest active XID.  
4. GetNewTransactionid stores XID 100 to MyPgXact->xid  
  
So, GetOldestActiveTransactionId returned XID 101, even though 100 only  
just started and is surely still running.  
  
This would be hard to hit in practice, and even harder to spot any ill  
effect if it happens. GetOldestActiveTransactionId is only used when  
creating a checkpoint in a master server, and the race condition can only  
happen on an online checkpoint, as there are no backends running during a  
shutdown checkpoint. The oldestActiveXid value of an online checkpoint is  
only used when starting up a hot standby server, to determine the starting  
point where pg_subtrans is initialized from. For the race condition to  
happen, there must be no other XIDs in the proc array that would hold back  
the oldest-active XID value, which means that the missed XID must be a top  
transaction's XID. However, pg_subtrans is not used for top XIDs, so I  
believe an off-by-one error is in fact inconsequential. Nevertheless, let's  
fix it, as it's clearly wrong and the fix is simple.  
  
This has been wrong ever since hot standby was introduced, so backport to  
all supported versions.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Fix ruleutils.c for domain-over-array cases, too.

commit   : bc2d716ad09fceeb391c755f78c256ddac9d3b9f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Jul 2017 18:00:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Jul 2017 18:00:04 -0400    

Click here for diff

Further investigation shows that ruleutils isn't quite up to speed either  
for cases where we have a domain-over-array: it needs to be prepared to  
look past a CoerceToDomain at the top level of field and element  
assignments, else it decompiles them incorrectly.  Potentially this would  
result in failure to dump/reload a rule, if it looked like the one in the  
new test case.  (I also added a test for EXPLAIN; that output isn't broken,  
but clearly we need more test coverage here.)  
  
Like commit b1cb32fb6, this bug is reachable in cases we already support,  
so back-patch all the way.  

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

Reduce memory usage of tsvector type analyze function.

commit   : da11977de9c685ef808d3a293727f9ce26753ec4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 12 Jul 2017 22:03:38 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 12 Jul 2017 22:03:38 +0300    

Click here for diff

compute_tsvector_stats() detoasted and kept in memory every tsvector value  
in the sample, but that can be a lot of memory. The original bug report  
described a case using over 10 gigabytes, with statistics target of 10000  
(the maximum).  
  
To fix, allocate a separate copy of just the lexemes that we keep around,  
and free the detoasted tsvector values as we go. This adds some palloc/pfree  
overhead, when you have a lot of distinct lexemes in the sample, but it's  
better than running out of memory.  
  
Fixes bug #14654 reported by James C. Reviewed by Tom Lane. Backport to  
all supported versions.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/tsearch/ts_typanalyze.c

commit_ts test: Set node name in test

commit   : ca793c59a51e94cedf8cbea5c29668bf8fa298f3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 12 Jul 2017 14:39:44 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 12 Jul 2017 14:39:44 -0400    

Click here for diff

Otherwise, the script output has a lot of pointless warnings.  
  
This was forgotten in 9def031bd2821f35b5f506260d922482648a8bb0  

M src/test/modules/commit_ts/t/001_base.pl

Avoid integer overflow while sifting-up a heap in tuplesort.c.

commit   : 512f67c8d02cc558f9c269cc848b0f0f788c4fe1    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Jul 2017 13:24:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Jul 2017 13:24:16 -0400    

Click here for diff

If the number of tuples in the heap exceeds approximately INT_MAX/2,  
this loop's calculation "2*i+1" could overflow, resulting in a crash.  
Fix it by using unsigned int rather than int for the relevant local  
variables; that shouldn't cost anything extra on any popular hardware.  
Per bug #14722 from Sergey Koposov.  
  
Original patch by Sergey Koposov, modified by me per a suggestion  
from Heikki Linnakangas to use unsigned int not int64.  
  
Back-patch to 9.4, where tuplesort.c grew the ability to sort as many  
as INT_MAX tuples in-memory (commit 263865a48).  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix variable and type name in comment.

commit   : ca906f68f22bf2076349394a5f28caf1f6e6f2f7    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 12 Jul 2017 17:07:35 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 12 Jul 2017 17:07:35 +0300    

Click here for diff

Kyotaro Horiguchi  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Fix ordering of operations in SyncRepWakeQueue to avoid assertion failure.

commit   : 49a3360209ba07d385f1a9e619854bbbe1b7005f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 12 Jul 2017 15:30:52 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 12 Jul 2017 15:30:52 +0300    

Click here for diff

Commit 14e8803f1 removed the locking in SyncRepWaitForLSN, but that  
introduced a race condition, where SyncRepWaitForLSN might see  
syncRepState already set to SYNC_REP_WAIT_COMPLETE, but the process was  
not yet removed from the queue. That tripped the assertion, that the  
process should no longer be in the uqeue. Reorder the operations in  
SyncRepWakeQueue to remove the process from the queue first, and update  
syncRepState only after that, and add a memory barrier in between to make  
sure the operations are made visible to other processes in that order.  
  
Fixes bug #14721 reported by Const Zhang. Analysis and fix by Thomas Munro.  
Backpatch down to 9.5, where the locking was removed.  
  
Discussion: https://www.postgresql.org/message-id/20170629023623.1480.26508%40wrigleys.postgresql.org  

M src/backend/replication/syncrep.c

Remove unnecessary braces, to match the surrounding style.

commit   : 09ed6c7e6765ac4638d1aad2d0babaeaecda5594    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 12 Jul 2017 12:30:50 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 12 Jul 2017 12:30:50 +0300    

Click here for diff

Mostly in the new subscription-related commands. Backport the few that  
were also present in older versions.  
  
Thomas Munro  
  
Discussion: https://www.postgresql.org/message-id/CAEepm=3CyW1QmXcXJXmqiJXtXzFDc8SvSfnxkEGD3Bkv2SrkeQ@mail.gmail.com  

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

Fix multiple assignments to a column of a domain type.

commit   : b1cb32fb62c9951c9ba35cb774fb8beec9090cb7    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Jul 2017 16:48:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Jul 2017 16:48:59 -0400    

Click here for diff

We allow INSERT and UPDATE commands to assign to the same column more than  
once, as long as the assignments are to subfields or elements rather than  
the whole column.  However, this failed when the target column was a domain  
over array rather than plain array.  Fix by teaching process_matched_tle()  
to look through CoerceToDomain nodes, and add relevant test cases.  
  
Also add a group of test cases exercising domains over array of composite.  
It's doubtless accidental that CREATE DOMAIN allows this case while not  
allowing straight domain over composite; but it does, so we'd better make  
sure we don't break it.  (I could not find any documentation mentioning  
either side of that, so no doc changes.)  
  
It's been like this for a long time, so back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/domain.out
M src/test/regress/sql/domain.sql

Stamp 10beta2.

commit   : 42171e2cd23c8307bbe0ec64e901f58e297db1c3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Jul 2017 16:26:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Jul 2017 16:26:20 -0400    

Click here for diff

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

Translation updates

commit   : 6c774caf0ea6977f00af4225192915f0a602ea3d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 10 Jul 2017 11:51:32 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 10 Jul 2017 11:51:32 -0400    

Click here for diff

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

M src/backend/po/es.po
M src/backend/po/it.po
M src/bin/initdb/po/es.po
M src/bin/initdb/po/fr.po
M src/bin/initdb/po/it.po
M src/bin/pg_archivecleanup/nls.mk
A src/bin/pg_archivecleanup/po/es.po
A src/bin/pg_archivecleanup/po/fr.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
M src/bin/pg_config/po/es.po
M src/bin/pg_config/po/it.po
M src/bin/pg_controldata/po/es.po
M src/bin/pg_controldata/po/fr.po
M src/bin/pg_controldata/po/it.po
M src/bin/pg_ctl/po/es.po
M src/bin/pg_ctl/po/fr.po
M src/bin/pg_ctl/po/it.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
M src/bin/pg_resetwal/po/es.po
M src/bin/pg_resetwal/po/fr.po
M src/bin/pg_rewind/po/es.po
M src/bin/pg_rewind/po/fr.po
M src/bin/pg_rewind/po/it.po
M src/bin/pg_test_fsync/nls.mk
A src/bin/pg_test_fsync/po/es.po
A src/bin/pg_test_fsync/po/fr.po
M src/bin/pg_test_timing/nls.mk
A src/bin/pg_test_timing/po/es.po
A src/bin/pg_test_timing/po/fr.po
M src/bin/pg_waldump/nls.mk
A src/bin/pg_waldump/po/es.po
A src/bin/pg_waldump/po/fr.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/scripts/po/es.po
M src/bin/scripts/po/fr.po
M src/bin/scripts/po/it.po
M src/interfaces/ecpg/ecpglib/po/es.po
M src/interfaces/ecpg/preproc/po/es.po
M src/interfaces/ecpg/preproc/po/fr.po
M src/interfaces/ecpg/preproc/po/it.po
M src/interfaces/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
M src/pl/plperl/po/es.po
M src/pl/plperl/po/fr.po
M src/pl/plperl/po/it.po
M src/pl/plpgsql/src/po/es.po
M src/pl/plpython/po/es.po
M src/pl/plpython/po/fr.po
M src/pl/plpython/po/it.po
M src/pl/tcl/po/es.po
M src/pl/tcl/po/fr.po
M src/pl/tcl/po/it.po

On Windows, retry process creation if we fail to reserve shared memory.

commit   : 45e004fb4e3937dbdabf6d5c1706f1a02fdceb94    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Jul 2017 11:00:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Jul 2017 11:00:09 -0400    

Click here for diff

We've heard occasional reports of backend launch failing because  
pgwin32_ReserveSharedMemoryRegion() fails, indicating that something  
has already used that address space in the child process.  It's not  
very clear what, given that we disable ASLR in Windows builds, but  
suspicion falls on antivirus products.  It'd be better if we didn't  
have to disable ASLR, anyway.  So let's try to ameliorate the problem  
by retrying the process launch after such a failure, up to 100 times.  
  
Patch by me, based on previous work by Amit Kapila and others.  
This is a longstanding issue, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAA4eK1+R6hSx6t_yvwtx+NRzneVp+MRqXAdGJZChcau8Uij-8g@mail.gmail.com  

M src/backend/postmaster/postmaster.c

Fix missing tag in the docs.

commit   : d137a6dc239bd32b424826acbb25277ac611ddb1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 10 Jul 2017 15:36:02 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 10 Jul 2017 15:36:02 +0300    

Click here for diff

Masahiko Sawada  
  
Discussion: https://www.postgresql.org/message-id/CAD21AoBCwcTNMdrVWq8T0hoOs2mWSYq9PRJ_fr6SH8HdO+m=0g@mail.gmail.com  

M doc/src/sgml/libpq.sgml

Fix check for empty hostname.

commit   : 4d06f1f858d0fea01a2cde74d8b831a823776355    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 10 Jul 2017 15:29:36 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 10 Jul 2017 15:29:36 +0300    

Click here for diff

As reported by Arthur Zakirov, Gcc 7.1 complained about this with  
-Wpointer-compare.  
  
Discussion: https://www.postgresql.org/message-id/CAKNkYnybV_NFVacGbW=VspzAo3TwRJFNi+9iBob66YqQMZopwg@mail.gmail.com  

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

Fix COPY's handling of transition tables with indexes.

commit   : 1add0b15f117769f619af12720bea2f73d4f7359    
  
author   : Andrew Gierth <[email protected]>    
date     : Mon, 10 Jul 2017 11:40:08 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Mon, 10 Jul 2017 11:40:08 +0100    

Click here for diff

Commit c46c0e5202e8cfe750c6629db7852fdb15d528f3 failed to pass the  
TransitionCaptureState object to ExecARInsertTriggers() in the case  
where it's using heap_multi_insert and there are indexes.  Repair.  
  
Thomas Munro, from a report by David Fetter  
Discussion: https://postgr.es/m/20170708084213.GA14720%40fetter.org  

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

Allow multiple hostaddrs to go with multiple hostnames.

commit   : 7b02ba62e9ffad5b14c24756a0c2aeae839c9d05    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 10 Jul 2017 12:28:57 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 10 Jul 2017 12:28:57 +0300    

Click here for diff

Also fix two other issues, while we're at it:  
  
* In error message on connection failure, if multiple network addresses  
were given as the host option, as in "host=127.0.0.1,127.0.0.2", the  
error message printed the address twice.  
  
* If there were many more ports than hostnames, the error message would  
always claim that there was one port too many, even if there was more than  
one. For example, if you gave 2 hostnames and 5 ports, the error message  
claimed that you gave 2 hostnames and 3 ports.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Doc: remove claim that PROVE_FLAGS defaults to '--verbose'.

commit   : 260ba8525a6365cfb3251d619767cc6ae19ddff8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Jul 2017 00:44:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Jul 2017 00:44:05 -0400    

Click here for diff

Commit e9c81b601 changed this, but missed updating the documentation.  
The adjacent claim that we use TAP tests only in src/bin seems pretty  
obsolete as well.  Minor other copy-editing.  

M doc/src/sgml/regress.sgml

Doc: clarify wording about tool requirements in sourcerepo.sgml.

commit   : 3834abe90c7359319d1909fdb69a40963276a690    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Jul 2017 00:08:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Jul 2017 00:08:19 -0400    

Click here for diff

Original wording had confusingly vague antecedent for "they", so replace  
that with a more repetitive but clearer formulation.  In passing, make the  
link to the installation requirements section more specific.  Per gripe  
from Martin Mai, though this is not the fix he initially proposed.  
  
Discussion: https://postgr.es/m/CAN_NWRu-cWuNaiXUjV3m4H-riWURuPW=j21bSaLADs6rjjzXgQ@mail.gmail.com  

M doc/src/sgml/sourcerepo.sgml

Doc: desultory copy-editing for v10 release notes.

commit   : 749eceff4a1f9740391b126c81af9fd4bf3b1eaa    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Jul 2017 20:11:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Jul 2017 20:11:21 -0400    

Click here for diff

Improve many item descriptions, improve markup, relocate some items  
that seemed to be in the wrong section.  

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

Doc: update v10 release notes through today.

commit   : fad7873c8c9fae04accbdd3b7c226f451e9ab3b9    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Jul 2017 15:27:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Jul 2017 15:27:21 -0400    

Click here for diff

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

Doc: fix backwards description of visibility map's all-frozen data.

commit   : 485c515d0176d3210b5405ef23be8ed32cf5c93a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Jul 2017 12:51:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Jul 2017 12:51:15 -0400    

Click here for diff

Thinko in commit a892234f8.  
  
Vik Fearing  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/storage.sgml

MSVC: Repair libpq.rc generator.

commit   : 3381898f983b9d41c20b50bb1b39c173aa0129e3    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 9 Jul 2017 00:43:17 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 9 Jul 2017 00:43:17 -0700    

Click here for diff

It generates an empty file, so libpq.dll advertises no version  
information.  Commit facde2a98f0b5f7689b4e30a9e7376e926e733b8  
mistranslated "print O;" in this one place.  

M src/tools/msvc/Solution.pm

Avoid unreferenced-function warning on low-functionality platforms.

commit   : ec4073f64130b40fabaa1b38ad402babda3a48eb    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 8 Jul 2017 12:42:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 8 Jul 2017 12:42:25 -0400    

Click here for diff

On platforms lacking both locale_t and ICU, collationcmds.c failed  
to make any use of its static function is_all_ascii(), thus probably  
drawing a compiler warning.  Oversight in my commit ddb5fdc06.  
Per buildfarm member gaur.  

M src/backend/commands/collationcmds.c

Fix typo

commit   : 46e91519425c5e98380c672d1b5c3acf18c5e565    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 7 Jul 2017 17:10:36 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 7 Jul 2017 17:10:36 -0400    

Click here for diff

Noticed while reviewing code.  

M src/backend/commands/vacuumlazy.c

Fix out of date comment

commit   : 4808d69955f5115686633cd3cc78b9957122e1ad    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 7 Jul 2017 15:08:55 +0300    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 7 Jul 2017 15:08:55 +0300    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

M src/bin/pg_basebackup/streamutil.c

Fix potential data corruption during freeze

commit   : 31b8db8e6c1fa4436116f4be5ca789f3a01b9ebf    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 6 Jul 2017 17:18:55 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 6 Jul 2017 17:18:55 +0300    

Click here for diff

Fix oversight in 3b97e6823b94 bug fix. Bitwise AND is used instead of OR and  
it cleans all bits in t_infomask heap tuple field.  
  
Backpatch to 9.3  

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

Clarify the contract of partition_rbound_cmp().

commit   : f1dae097f2945ffcb59a9f236843e0e0bbf0920d    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 6 Jul 2017 12:46:08 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 6 Jul 2017 12:46:08 +0100    

Click here for diff

partition_rbound_cmp() is intended to compare range partition bounds  
in a way such that if all the bound values are equal but one is an  
upper bound and one is a lower bound, the upper bound is treated as  
smaller than the lower bound. This particular ordering is required by  
RelationBuildPartitionDesc() when building the PartitionBoundInfoData,  
so that it can consistently keep only the upper bounds when upper and  
lower bounds coincide.  
  
Update the function comment to make that clearer.  
  
Also, fix a (currently unreachable) corner-case bug -- if the bound  
values coincide and they contain unbounded values, fall through to the  
lower-vs-upper comparison code, rather than immediately returning  
0. Currently it is not possible to define coincident upper and lower  
bounds containing unbounded columns, but that may change in the  
future, so code defensively.  
  
Discussion: https://postgr.es/m/CAAJ_b947mowpLdxL3jo3YLKngRjrq9+Ej4ymduQTfYR+8=YAYQ@mail.gmail.com  

M src/backend/catalog/partition.c

Simplify the logic checking new range partition bounds.

commit   : c03911d9454a0cf5d88910ad46b433ab342c39e0    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 6 Jul 2017 09:58:06 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 6 Jul 2017 09:58:06 +0100    

Click here for diff

The previous logic, whilst not actually wrong, was overly complex and  
involved doing two binary searches, where only one was really  
necessary. This simplifies that logic and improves the comments.  
  
One visible change is that if the new partition overlaps multiple  
existing partitions, the error message now always reports the overlap  
with the first existing partition (the one with the lowest  
bounds). The old code would sometimes report the clash with the first  
partition and sometimes with the last one.  
  
Original patch idea from Amit Langote, substantially rewritten by me.  
  
Discussion: https://postgr.es/m/CAAJ_b947mowpLdxL3jo3YLKngRjrq9+Ej4ymduQTfYR+8=YAYQ@mail.gmail.com  

M src/backend/catalog/partition.c
M src/test/regress/expected/create_table.out

Fix another race-condition-ish issue in recovery/t/001_stream_rep.pl.

commit   : ec86af917551f52246848dd148885df034273f3d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Jul 2017 23:59:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Jul 2017 23:59:20 -0400    

Click here for diff

Buildfarm members hornet and sungazer have shown multiple instances of  
"Failed test 'xmin of non-cascaded slot with hs feedback has changed'".  
The reason seems to be that the test is checking the current xmin of the  
master server's replication slot against a past xmin of the first slave  
server's replication slot.  Even though the latter slot is downstream of  
the former, it's possible for its reported xmin to be ahead of the former's  
reported xmin, because those numbers are updated whenever the respective  
downstream walreceiver feels like it (see logic in WalReceiverMain).  
Instrumenting this test shows that indeed the slave slot's xmin does often  
advance before the master's does, especially if an autovacuum transaction  
manages to occur during the relevant window.  If we happen to capture such  
an advanced xmin as $xmin, then the subsequent wait_slot_xmins call can  
fall through before the master's xmin has advanced at all, and then if it  
advances before the get_slot_xmins call, we can get the observed failure.  
Yeah, that's a bit of a long chain of deduction, but it's hard to explain  
any other way how the test can get past an "xmin <> '$xmin'" check only  
to have the next query find that xmin does equal $xmin.  
  
Fix by keeping separate images of the master and slave slots' xmins  
and testing their has-xmin-advanced conditions independently.  

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

Restore linking libpq into pg_ctl on Mingw builds.

commit   : ff68e909acd924b532e58c7699e93a1aff71654a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Jul 2017 15:23:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Jul 2017 15:23:22 -0400    

Click here for diff

Commit 1ae853654 missed this.  Per Andrew Dunstan.  

M src/bin/pg_ctl/Makefile

Remove unnecessary pg_is_in_recovery calls in tests

commit   : 6deb52b202e0f673b583b03ad141ccad6f8e7fba    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 May 2017 12:11:25 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 May 2017 12:11:25 -0400    

Click here for diff

Since pg_ctl promote already waits for recovery to end, these calls are  
obsolete.  

M src/test/modules/commit_ts/t/003_standby_2.pl
M src/test/recovery/t/008_fsm_truncation.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/012_subtransactions.pl

pg_ctl: Make failure to complete operation a nonzero exit

commit   : 1bac5f552a25aca3aa2ef1d404f7cdf7788c34d8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 May 2017 12:10:17 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 May 2017 12:10:17 -0400    

Click here for diff

If an operation being waited for does not complete within the timeout,  
then exit with a nonzero exit status.  This was previously handled  
inconsistently.  

M doc/src/sgml/ref/pg_ctl-ref.sgml
M src/bin/pg_ctl/pg_ctl.c

Fix output of char node fields

commit   : d80e73f2293429cf8a0a13c243852379ec2e37e2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jun 2017 22:57:23 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jun 2017 22:57:23 -0400    

Click here for diff

WRITE_CHAR_FIELD() didn't do any escaping, so that for example a zero  
byte would cause the whole output string to be truncated.  To fix, pass  
the char through outToken(), so it is escaped like a string.  Adjust the  
reading side to handle this.  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c

psql documentation fixes

commit   : 5191e357cf22e200a9baaf97bbe8a07ee2537537    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 4 Jul 2017 21:10:08 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 4 Jul 2017 21:10:08 -0400    

Click here for diff

Update the documentation for \pset to mention  
columns|linestyle|pager_min_lines.  Add various mentions of \pset  
command equivalences that were previously inconsistent.  
  
Author: Š”ŠøŠ»ŃŠ½ ŠŸŠ°Š»Š°ŃƒŠ·Š¾Š² <[email protected]>  

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

Document how logical replication deals with statement triggers

commit   : 012d83f57aff973a73214262f3d87105786e3500    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jul 2017 23:37:53 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jul 2017 23:37:53 -0400    

Click here for diff

Reported-by: ŠšŠ¾Š½ŃŃ‚Š°Š½Ń‚ŠøŠ½ Š•Š²Ń‚ŠµŠµŠ² <[email protected]>  
Bug: #14699  

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

Improve subscription locking

commit   : cb9079cd51a2df677dc182aec72d88383b9c2a79    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jul 2017 22:47:06 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jul 2017 22:47:06 -0400    

Click here for diff

This avoids "tuple concurrently updated" errors when a ALTER or DROP  
SUBSCRIPTION writes to pg_subscription_rel at the same time as a worker.  
  
Author: Petr Jelinek <[email protected]>  

M src/backend/catalog/pg_subscription.c
M src/backend/commands/subscriptioncmds.c

Don't mention SSL methods that aren't reachable in docs

commit   : 42794d6749f24636efbb198db17c30c63df10900    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 3 Jul 2017 16:16:35 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 3 Jul 2017 16:16:35 +0100    

Click here for diff

Author: Michael Paquier <[email protected]>  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/sslinfo.sgml

Treat clean shutdown of an SSL connection same as the non-SSL case.

commit   : b93827c745f346a765e7e59584127e07a37c78da    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Jul 2017 14:51:51 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Jul 2017 14:51:51 +0300    

Click here for diff

If the client closes an SSL connection, treat it the same as EOF on a  
non-SSL connection. In particular, don't write a message in the log about  
that.  
  
Michael Paquier.  
  
Discussion: https://www.postgresql.org/message-id/CAB7nPqSfyVV42Q2acFo%[email protected]  

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

Forbid gen_random_uuid() with --disable-strong-random

commit   : bf723a274cbb00c7fba66c66312a77940af13d79    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Jul 2017 12:10:11 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Jul 2017 12:10:11 +0300    

Click here for diff

Previously, gen_random_uuid() would fall back to a weak random number  
generator, unlike gen_random_bytes() which would just fail. And this was  
not made very clear in the docs. For consistency, also make  
gen_random_uuid() fail outright, if compiled with --disable-strong-random.  
  
Re-word the error message you get with --disable-strong-random. It is also  
used by pgp functions that require random salts, and now also  
gen_random_uuid().  
  
Reported by Radek Slupik.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/pgcrypto/expected/pgp-compression_1.out
M contrib/pgcrypto/expected/pgp-decrypt_1.out
M contrib/pgcrypto/expected/pgp-encrypt_1.out
M contrib/pgcrypto/expected/pgp-pubkey-encrypt_1.out
M contrib/pgcrypto/pgcrypto.c
M contrib/pgcrypto/px.c

Fix race condition in recovery/t/009_twophase.pl test.

commit   : 647675228f2b18964d8ade8a1061a719e527acfb    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Jul 2017 22:01:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Jul 2017 22:01:19 -0400    

Click here for diff

Since reducing pg_ctl's reaction time in commit c61559ec3, some  
slower buildfarm members have shown erratic failures in this test.  
The reason turns out to be that the test assumes synchronous  
replication (because it does not provide any lag time for a commit  
to replicate before shutting down the servers), but it had only  
enabled sync rep in one direction.  The observed symptoms correspond  
to failure to replicate the last committed transaction in the other  
direction, which can be expected to happen if the shutdown command  
is issued soon enough and we are providing no synchronous-commit  
guarantees.  
  
Fix that, and add a bit more paranoid state checking at the bottom  
of the script.  
  
Michael Paquier and myself  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/009_twophase.pl

Fix bug in PostgresNode::query_hash's split() call.

commit   : efdb4f29ba9ecbddb74d3a68577f068cf034c540    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Jul 2017 17:22:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Jul 2017 17:22:09 -0400    

Click here for diff

By default, Perl's split() function drops trailing empty fields,  
which is not what we want here.  Oversight in commit fb093e4cb.  
We'd managed to miss it thus far thanks to the very limited usage  
of this function.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgresNode.pm

Try to improve readability of recovery/t/009_twophase.pl test.

commit   : 4e15387d2d9d4045efd1a7b3634e5922774139fd    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Jul 2017 15:27:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Jul 2017 15:27:29 -0400    

Click here for diff

The original coding here was very confusing, because it named the  
two servers it set up "master" and "slave" even though it swapped  
their replication roles multiple times.  At any given point in the  
script it was very unobvious whether "$node_master" actually referred  
to the server named "master" or the other one.  Instead, pick arbitrary  
names for the two servers --- I used "london" and "paris" --- and  
distinguish those permanent names from the nonce references $cur_master  
and $cur_slave.  Add logging to help distinguish which is which at  
any given point.  Also, use distinct data and transaction names to  
make all the prepared transactions easily distinguishable in the  
postmaster logs.  (There was one place where we intentionally tested  
that the server could cope with re-use of a transaction name, but  
it seems like one place is sufficient for that purpose.)  
  
Also, add checks at the end to make sure that all the transactions  
that were supposed to be committed did survive.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/009_twophase.pl

Improve TAP test function PostgresNode::poll_query_until().

commit   : de3de0afd7da7b432e219aa38bde248fc5c5206a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Jul 2017 14:03:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Jul 2017 14:03:41 -0400    

Click here for diff

Add an optional "expected" argument to override the default assumption  
that we're waiting for the query to return "t".  This allows replacing  
a handwritten polling loop in recovery/t/007_sync_rep.pl with use of  
poll_query_until(); AFAICS that's the only remaining ad-hoc polling  
loop in our TAP tests.  
  
Change poll_query_until() to probe ten times per second not once per  
second.  Like some similar changes I've been making recently, the  
one-second interval seems to be rooted in ancient traditions rather  
than the actual likely wait duration on modern machines.  I'd consider  
reducing it further if there were a convenient way to spawn just one  
psql for the whole loop rather than one per probe attempt.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgresNode.pm
M src/test/recovery/t/007_sync_rep.pl

doc: Document that logical replication supports synchronous replication

commit   : 2dca03439f1f88e9102aa6bf613b434be0697dae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 2 Jul 2017 00:10:57 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 2 Jul 2017 00:10:57 -0400    

Click here for diff

Update the documentation a bit to include that logical replication as  
well as other and third-party replication clients can participate in  
synchronous replication.  

M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/logical-replication.sgml

Refine memory allocation in ICU conversions

commit   : d8b3c81335600ad3487ca9bd642ef354d62919dc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 24 Jun 2017 09:39:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 24 Jun 2017 09:39:24 -0400    

Click here for diff

The simple calculations done to estimate the size of the output buffers  
for ucnv_fromUChars() and ucnv_toUChars() could overflow int32_t for  
large strings.  To avoid that, go the long way and run the function  
first without an output buffer to get the correct output buffer size  
requirement.  

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

Clean up misuse and nonuse of poll_query_until().

commit   : b0f069d931f0a3d4a39aeeb230baf2f2b18cb3c3    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Jul 2017 14:25:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Jul 2017 14:25:09 -0400    

Click here for diff

Several callers of PostgresNode::poll_query_until() neglected to check  
for failure; I do not think that's optional.  Also, rewrite one place  
that had reinvented poll_query_until() for no very good reason.  

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/005_replay_delay.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl

Reduce delay for last logicalrep feedback message when master goes idle.

commit   : f32678c0163d7d966560bdaf41bfbc2cf179a260    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Jul 2017 12:15:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Jul 2017 12:15:51 -0400    

Click here for diff

The regression tests contain numerous cases where we do some activity on a  
master server and then wait till the slave has ack'd flushing its copy of  
that transaction.  Because WAL flush on the slave is asynchronous to the  
logicalrep worker process, the worker cannot send such a feedback message  
during the LogicalRepApplyLoop iteration where it processes the last data  
from the master.  In the previous coding, the feedback message would come  
out only when the loop's WaitLatchOrSocket call returned WL_TIMEOUT.  That  
requires one full second of delay (NAPTIME_PER_CYCLE); and to add insult  
to injury, it could take more than that if the WaitLatchOrSocket was  
interrupted a few times by latch-setting events.  
  
In reality we can expect the slave's walwriter process to have flushed the  
WAL data after, more or less, WalWriterDelay (typically 200ms).  Hence,  
if there are unacked transactions pending, make the wait delay only that  
long rather than the full NAPTIME_PER_CYCLE.  Also, move one of the  
send_feedback() calls into the loop main line, so that we'll check for the  
need to send feedback even if we were woken by a latch event and not either  
socket data or timeout.  
  
It's not clear how much this matters for production purposes, but  
it's definitely helpful for testing.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Shorten timeouts while waiting for logicalrep worker slot attach/detach.

commit   : 799f8bc76a92d48b0f7988f4cc50da438cacec7c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Jul 2017 11:59:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Jul 2017 11:59:44 -0400    

Click here for diff

When waiting for a logical replication worker process to start or stop,  
we have to busy-wait until we see it add or remove itself from the  
LogicalRepWorker slot in shared memory.  Those loops were using a  
one-second delay between checks, but on any reasonably modern machine, it  
doesn't take more than a couple of msec for a worker to spawn or shut down.  
Reduce the loop delays to 10ms to avoid wasting quite so much time in the  
related regression tests.  
  
In principle, a better solution would be to fix things so that the waiting  
process can be awakened via its latch at the right time.  But that seems  
considerably more invasive, which is undesirable for a post-beta fix.  
Worker start/stop performance likely isn't of huge interest anyway for  
production purposes, so we might not ever get around to it.  
  
In passing, rearrange the second wait loop in logicalrep_worker_stop()  
so that the lock is held at the top of the loop, thus saving one lock  
acquisition/release per call, and making it look more like the other loop.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix UPDATE of GENERATED ALWAYS identity columns

commit   : ef74e03ef65ea870a9c372f500d33cca0a18be6e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 23:44:17 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 23:44:17 -0400    

Click here for diff

The bug would previously prevent the update of any column in a table  
with identity columns, rather than just the actual identity column.  
  
Reported-by: [email protected]  
Bug: #14718  

M src/backend/rewrite/rewriteHandler.c

Fix locking in WAL receiver/sender shmem state structs

commit   : 572d6ee6d41b43b8871f42c7dbbef795523b2dbf    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 30 Jun 2017 18:06:33 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 30 Jun 2017 18:06:33 -0400    

Click here for diff

In WAL receiver and WAL server, some accesses to their corresponding  
shared memory control structs were done without holding any kind of  
lock, which could lead to inconsistent and possibly insecure results.  
  
In walsender, fix by clarifying the locking rules and following them  
correctly, as documented in the new comment in walsender_private.h;  
namely that some members can be read in walsender itself without a lock,  
because the only writes occur in the same process.  The rest of the  
struct requires spinlock for accesses, as usual.  
  
In walreceiver, fix by always holding spinlock while accessing the  
struct.  
  
While there is potentially a problem in all branches, it is minor in  
stable ones.  This only became a real problem in pg10 because of quorum  
commit in synchronous replication (commit 3901fd70cc7c), and a potential  
security problem in walreceiver because a superuser() check was removed  
by default monitoring roles (commit 25fff40798fc).  Thus, no backpatch.  
  
In passing, clean up some leftover braces which were used to create  
unconditional blocks.  Once upon a time these were used for  
volatile-izing accesses to those shmem structs, which is no longer  
required.  Many other occurrences of this pattern remain.  
  
Author: Michaƫl Paquier  
Reported-by: Michaƫl Paquier  
Reviewed-by: Masahiko Sawada, Kyotaro Horiguchi, Thomas Munro,  
	Robert Haas  
Discussion: https://postgr.es/m/CAB7nPqTWYqtzD=LN_oDaf9r-hAjUEPAy0B9yRkhcsLdRN8fzrw@mail.gmail.com  

M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/include/replication/walreceiver.h
M src/include/replication/walsender_private.h

PL/Python: Fix hint about returning composite type from Python

commit   : 898d24ae2ad7195869c558eb6c126ff6a90474e8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 16:51:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 16:51:14 -0400    

Click here for diff

('foo') is not a Python tuple: it is a string wrapped in parentheses.  A  
valid 1-element Python tuple is ('foo',).  
  
Author: Daniele Varrazzo <[email protected]>  

M src/pl/plpython/expected/plpython_composite.out
M src/pl/plpython/plpy_typeio.c

Fix typo in comment

commit   : b295cc3b9ab48c3c34724fa577d6c1cfb753058c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 15:54:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 15:54:14 -0400    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

M src/backend/catalog/aclchk.c

Fix race conditions and missed wakeups in syncrep worker signaling.

commit   : 1f201a818a5910a37530cc929bd345688f827942    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Jun 2017 14:57:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Jun 2017 14:57:06 -0400    

Click here for diff

When a sync worker is waiting for the associated apply worker to notice  
that it's in SYNCWAIT state, wait_for_worker_state_change() would just  
patiently wait for that to happen.  This generally required waiting for  
the 1-second timeout in LogicalRepApplyLoop to elapse.  Kicking the worker  
via its latch makes things significantly snappier.  
  
While at it, fix race conditions that could potentially result in crashes:  
we can *not* call logicalrep_worker_wakeup_ptr() once we've released the  
LogicalRepWorkerLock, because worker->proc might've been reset to NULL  
after we do that (indeed, there's no really solid reason to believe that  
the LogicalRepWorker slot even belongs to the same worker anymore).  
In logicalrep_worker_wakeup(), we can just move the wakeup inside the  
lock scope.  In process_syncing_tables_for_apply(), a bit more code  
rearrangement is needed.  
  
Also improve some nearby comments.  

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

Fix typo in comment

commit   : 1db49c3b6d2399f8f83a97f1fa34e749b9fada7c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 14:51:15 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 14:51:15 -0400    

Click here for diff

Author: Albe Laurenz <[email protected]>  

M contrib/postgres_fdw/postgres_fdw.c

Fix typo in comment

commit   : da8f26ec4eb6e3dced9e348efefac17d733008c0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 14:48:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 14:48:43 -0400    

Click here for diff

Author: Amit Langote <[email protected]>  

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

Remove outdated comment

commit   : 1acc04e4045d4e863c14d144f8c2bf18b80da504    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 14:43:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 14:43:05 -0400    

Click here for diff

Author: Thomas Munro <[email protected]>  

M src/include/access/slru.h

Update code comments for pg_xlog -> pg_wal

commit   : 4260c05c6d5ffed8f61d97ec26ebadd991a97c14    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 14:40:50 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 14:40:50 -0400    

Click here for diff

Author: Michael Paquier <[email protected]>  

M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h

Check for error during PQendcopy.

commit   : 609fa63db6d1e1f2c27a6dd31e9ac8d3b7bcae03    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Jun 2017 12:22:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Jun 2017 12:22:33 -0400    

Click here for diff

Oversight in commit 78c8c8143; noted while nosing around the  
walreceiver startup/shutdown code.  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Fix walsender to exit promptly if client requests shutdown.

commit   : fca85f8ef157d4d58dea1fdc8e1f1f957b74ee78    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Jun 2017 12:00:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Jun 2017 12:00:02 -0400    

Click here for diff

It's possible for WalSndWaitForWal to be asked to wait for WAL that doesn't  
exist yet.  That's fine, in fact it's the normal situation if we're caught  
up; but when the client requests shutdown we should not keep waiting.  
The previous coding could wait indefinitely if the source server was idle.  
  
In passing, improve the rather weak comments in this area, and slightly  
rearrange some related code for better readability.  
  
Back-patch to 9.4 where this code was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walsender.c

Prohibit creating ICU collation with different ctype

commit   : 13a57710dbafad26669833add0ae6ae60314f8dc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 11:24:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 11:24:00 -0400    

Click here for diff

ICU does not support "collate" and "ctype" being different, so the  
collctype catalog column is ignored.  But for catalog neatness, ensure  
that they are the same.  

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

Add missing period to comment.

commit   : 7d4a1838efc5a93ba96b8e0e77f39731603a1f48    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 30 Jun 2017 09:52:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 30 Jun 2017 09:52:47 -0400    

Click here for diff

Masahiko Sawada  
  
Discussion: http://postgr.es/m/CAD21AoA0jjXXhqK6Ym3jZNoUdVhXFyTkWTTTsVSr1vPuKcjsjA@mail.gmail.com  

M src/backend/catalog/partition.c

Copy collencoding in CREATE COLLATION / FROM

commit   : 54baa48139ae6b67347bea6a9183d494e625939b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 08:50:39 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jun 2017 08:50:39 -0400    

Click here for diff

This command used to compute the collencoding entry like when a  
completely new collation is created.  But for example when copying the  
"C" collation, this would then result in a collation that has a  
collencoding entry for the current database encoding rather than -1,  
thus not making an exact copy.  This has probably no practical impact,  
but making this change keeps the catalog contents neat.  
  
Reported-by: Tom Lane <[email protected]>  

M src/backend/commands/collationcmds.c

Eat XIDs more efficiently in recovery TAP test.

commit   : 08aed6604de2e6a9f4d499818d7c641cbf5eb9f7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Jun 2017 22:11:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Jun 2017 22:11:12 -0400    

Click here for diff

The point of this loop is to insert 1000 rows into the test table  
and consume 1000 XIDs.  I can't see any good reason why it's useful  
to launch 1000 psqls and 1000 backend processes to accomplish that.  
Pushing the looping into a plpgsql DO block shaves about 10 seconds  
off the runtime of the src/test/recovery TAP tests on my machine;  
that's over 10% of the runtime of that test suite.  
  
It is, in fact, sufficiently more efficient that we now demonstrably  
need wait_slot_xmins() afterwards, or the slaves' xmins may not have  
moved yet.  

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

Ooops, WIN32 code in pg_ctl.c still needs PQExpBuffer.

commit   : 1ae8536545b7ea486dbe15247e6dd817ee211297    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Jun 2017 18:00:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Jun 2017 18:00:16 -0400    

Click here for diff

Per buildfarm.  

M src/bin/pg_ctl/pg_ctl.c
M src/tools/msvc/Mkvcbuild.pm

Change pg_ctl to detect server-ready by watching status in postmaster.pid.

commit   : f13ea95f9e473a43ee4e1baeb94daaf83535d37c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Jun 2017 17:31:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Jun 2017 17:31:24 -0400    

Click here for diff

Traditionally, "pg_ctl start -w" has waited for the server to become  
ready to accept connections by attempting a connection once per second.  
That has the major problem that connection issues (for instance, a  
kernel packet filter blocking traffic) can't be reliably told apart  
from server startup issues, and the minor problem that if server startup  
isn't quick, we accumulate "the database system is starting up" spam  
in the server log.  We've hacked around many of the possible connection  
issues, but it resulted in ugly and complicated code in pg_ctl.c.  
  
In commit c61559ec3, I changed the probe rate to every tenth of a second.  
That prompted Jeff Janes to complain that the log-spam problem had become  
much worse.  In the ensuing discussion, Andres Freund pointed out that  
we could dispense with connection attempts altogether if the postmaster  
were changed to report its status in postmaster.pid, which "pg_ctl start"  
already relies on being able to read.  This patch implements that, teaching  
postmaster.c to report a status string into the pidfile at the same  
state-change points already identified as being of interest for systemd  
status reporting (cf commit 7d17e683f).  pg_ctl no longer needs to link  
with libpq at all; all its functions now depend on reading server files.  
  
In support of this, teach AddToDataDirLockFile() to allow addition of  
postmaster.pid lines in not-necessarily-sequential order.  This is needed  
on Windows where the SHMEM_KEY line will never be written at all.  We still  
have the restriction that we don't want to truncate the pidfile; document  
the reasons for that a bit better.  
  
Also, fix the pg_ctl TAP tests so they'll notice if "start -w" mode  
is broken --- before, they'd just wait out the sixty seconds until  
the loop gives up, and then report success anyway.  (Yes, I found that  
out the hard way.)  
  
While at it, arrange for pg_ctl to not need to #include miscadmin.h;  
as a rather low-level backend header, requiring that to be compilable  
client-side is pretty dubious.  This requires moving the #define's  
associated with the pidfile into a new header file, and moving  
PG_BACKEND_VERSIONSTR someplace else.  For lack of a clearly better  
"someplace else", I put it into port.h, beside the declaration of  
find_other_exec(), since most users of that macro are passing the value to  
find_other_exec().  (initdb still depends on miscadmin.h, but at least  
pg_ctl and pg_upgrade no longer do.)  
  
In passing, fix main.c so that PG_BACKEND_VERSIONSTR actually defines the  
output of "postgres -V", which remarkably it had never done before.  
  
Discussion: https://postgr.es/m/CAMkU=1xJW8e+CTotojOMBd-yzUvD0e_JZu2xHo=MnuZ4__m7Pg@mail.gmail.com  

M src/backend/main/main.c
M src/backend/port/sysv_shmem.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/init/miscinit.c
M src/bin/pg_ctl/Makefile
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_upgrade/option.c
M src/common/config_info.c
M src/include/miscadmin.h
M src/include/port.h
A src/include/utils/pidfile.h
M src/tools/msvc/Mkvcbuild.pm

Fix transition tables for ON CONFLICT.

commit   : 8c55244ae379822d8bf62f6db0b5b1f7637eea3a    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 28 Jun 2017 19:00:55 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 28 Jun 2017 19:00:55 +0100    

Click here for diff

We now disallow having triggers with both transition tables and ON  
INSERT OR UPDATE (which was a PG extension to the spec anyway),  
because in this case it's not at all clear how the transition tables  
should work for an INSERT ... ON CONFLICT query.  Separate ON INSERT  
and ON UPDATE triggers with transition tables are allowed, and the  
transition tables for these reflect only the inserted and only the  
updated tuples respectively.  
  
Patch by Thomas Munro  
  
Discussion: https://postgr.es/m/CAEepm%3D11KHQ0JmETJQihSvhZB5mUZL2xrqHeXbCeLhDiqQ39%3Dw%40mail.gmail.com  

M src/backend/commands/trigger.c
M src/include/commands/trigger.h
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/triggers.out
M src/test/regress/sql/plpgsql.sql
M src/test/regress/sql/triggers.sql

Fix transition tables for wCTEs.

commit   : c46c0e5202e8cfe750c6629db7852fdb15d528f3    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 28 Jun 2017 18:59:01 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 28 Jun 2017 18:59:01 +0100    

Click here for diff

The original coding didn't handle this case properly; each separate  
DML substatement needs its own set of transitions.  
  
Patch by Thomas Munro  
  
Discussion: https://postgr.es/m/CAL9smLCDQ%3D2o024rBgtD4WihzX8B3C6u_oSQ2K3%2BR5grJrV0bg%40mail.gmail.com  

M src/backend/commands/copy.c
M src/backend/commands/trigger.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/include/commands/trigger.h
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Fix transition tables for partition/inheritance.

commit   : 501ed02cf6f4f60c3357775eb07578aebc912d3a    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 28 Jun 2017 18:55:03 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 28 Jun 2017 18:55:03 +0100    

Click here for diff

We disallow row-level triggers with transition tables on child tables.  
Transition tables for triggers on the parent table contain only those  
columns present in the parent.  (We can't mix tuple formats in a  
single transition table.)  
  
Patch by Thomas Munro  
  
Discussion: https://postgr.es/m/CA%2BTgmoZzTBBAsEUh4MazAN7ga%3D8SsMC-Knp-6cetts9yNZUCcg%40mail.gmail.com  

M doc/src/sgml/ref/create_trigger.sgml
M src/backend/catalog/pg_inherits.c
M src/backend/commands/copy.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/include/catalog/pg_inherits_fn.h
M src/include/commands/trigger.h
M src/include/nodes/execnodes.h
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Second try at fixing tcp_keepalives_idle option on Solaris.

commit   : 99255d73c07c89b69be028a1a7b8027a78befed4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Jun 2017 12:30:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Jun 2017 12:30:16 -0400    

Click here for diff

Buildfarm evidence shows that TCP_KEEPALIVE_THRESHOLD doesn't exist  
after all on Solaris < 11.  This means we need to take positive action to  
prevent the TCP_KEEPALIVE code path from being taken on that platform.  
I've chosen to limit it with "&& defined(__darwin__)", since it's unclear  
that anyone else would follow Apple's precedent of spelling the symbol  
that way.  
  
Also, follow a suggestion from Michael Paquier of eliminating code  
duplication by defining a couple of intermediate symbols for the  
socket option.  
  
In passing, make some effort to reduce the number of translatable messages  
by replacing "setsockopt(foo) failed" with "setsockopt(%s) failed", etc,  
throughout the affected files.  And update relevant documentation so  
that it doesn't claim to provide an exhaustive list of the possible  
socket option names.  
  
Like the previous commit (f0256c774), back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Do not require 'public' to exist for pg_dump -c

commit   : 4500edc7e9cf771bf8960d1f3f620917871bdb6f    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 28 Jun 2017 10:33:57 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 28 Jun 2017 10:33:57 -0400    

Click here for diff

Commit 330b84d8c4 didn't contemplate the case where the public schema  
has been dropped and introduced a query which fails when there is no  
public schema into pg_dump (when used with -c).  
  
Adjust the query used by pg_dump to handle the case where the public  
schema doesn't exist and add tests to check that such a case no longer  
fails.  
  
Back-patch the specific fix to 9.6, as the prior commit was.  
  
Adding tests for this case involved adding support to the pg_dump  
TAP tests to work with multiple databases, which, while not a large  
change, is a bit much to back-patch, so that's only done in master.  
  
Addresses bug #14650  
Discussion: https://www.postgresql.org/message-id/20170512181801.1795.47483%40wrigleys.postgresql.org  

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

Support tcp_keepalives_idle option on Solaris.

commit   : f0256c774daa0dac96154e7ddf54197fb2b83f4d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Jun 2017 18:47:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Jun 2017 18:47:57 -0400    

Click here for diff

Turns out that the socket option for this is named TCP_KEEPALIVE_THRESHOLD,  
at least according to the tcp(7P) man page for Solaris 11.  (But since that  
text refers to "SunOS", it's likely pretty ancient.)  It appears that the  
symbol TCP_KEEPALIVE does get defined on that platform, but it doesn't  
seem to represent a valid protocol-level socket option.  This leads to  
bleats in the postmaster log, and no tcp_keepalives_idle functionality.  
  
Per bug #14720 from Andrey Lizenko, as well as an earlier report from  
Dhiraj Chawla that nobody had followed up on.  The issue's been there  
since we added the TCP_KEEPALIVE code path in commit 5acd417c8, so  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Re-allow SRFs and window functions within sub-selects within aggregates.

commit   : 9c7dc89282b3dac5685c39d4d792b02ca573c2d3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Jun 2017 17:51:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Jun 2017 17:51:11 -0400    

Click here for diff

check_agg_arguments_walker threw an error upon seeing a SRF or window  
function, but that is too aggressive: if the function is within a  
sub-select then it's perfectly fine.  I broke the SRF case in commit  
0436f6bde by copying the logic for window functions ... but that was  
broken too, and had been since commit eaccfded9.  
  
Repair both cases in HEAD, and the window function case back to 9.3.  
9.2 gets this right.  

M src/backend/parser/parse_agg.c
M src/test/regress/expected/tsrf.out
M src/test/regress/sql/tsrf.sql

Reduce wal_retrieve_retry_interval in applicable TAP tests.

commit   : 2710ccd782d0308a3fa1ab193531183148e9b626    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Jun 2017 19:01:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Jun 2017 19:01:26 -0400    

Click here for diff

By default, wal_retrieve_retry_interval is five seconds, which is far  
more than is needed in any of our TAP tests, leaving the test cases  
just twiddling their thumbs for significant stretches.  Moreover,  
because it's so large, we get basically no testing of the retry-before-  
master-is-ready code path.  Hence, make PostgresNode::init set up  
wal_retrieve_retry_interval = '500ms' as part of its customization of  
test clusters' postgresql.conf.  This shaves quite a few seconds off  
the runtime of the recovery TAP tests.  
  
Back-patch into 9.6.  We have wal_retrieve_retry_interval in 9.5,  
but the test infrastructure isn't there.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgresNode.pm

Don't lose walreceiver start requests due to race condition in postmaster.

commit   : e5d494d78cf6c60f04a5d3f571205f452a78d81f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Jun 2017 17:31:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Jun 2017 17:31:56 -0400    

Click here for diff

When a walreceiver dies, the startup process will notice that and send  
a PMSIGNAL_START_WALRECEIVER signal to the postmaster, asking for a new  
walreceiver to be launched.  There's a race condition, which at least  
in HEAD is very easy to hit, whereby the postmaster might see that  
signal before it processes the SIGCHLD from the walreceiver process.  
In that situation, sigusr1_handler() just dropped the start request  
on the floor, reasoning that it must be redundant.  Eventually, after  
10 seconds (WALRCV_STARTUP_TIMEOUT), the startup process would make a  
fresh request --- but that's a long time if the connection could have  
been re-established almost immediately.  
  
Fix it by setting a state flag inside the postmaster that we won't  
clear until we do launch a walreceiver.  In cases where that results  
in an extra walreceiver launch, it's up to the walreceiver to realize  
it's unwanted and go away --- but we have, and need, that logic anyway  
for the opposite race case.  
  
I came across this through investigating unexpected delays in the  
src/test/recovery TAP tests: it manifests there in test cases where  
a master server is stopped and restarted while leaving streaming  
slaves active.  
  
This logic has been broken all along, so back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c

Ignore old stats file timestamps when starting the stats collector.

commit   : ad1b5c842ba28aab0f487e77f8cac46a30b3b63e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Jun 2017 16:17:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Jun 2017 16:17:05 -0400    

Click here for diff

The stats collector disregards inquiry messages that bear a cutoff_time  
before when it last wrote the relevant stats file.  That's fine, but at  
startup when it reads the "permanent" stats files, it absorbed their  
timestamps as if they were the times at which the corresponding temporary  
stats files had been written.  In reality, of course, there's no data  
out there at all.  This led to disregarding inquiry messages soon after  
startup if the postmaster had been shut down and restarted within less  
than PGSTAT_STAT_INTERVAL; which is a pretty common scenario, both for  
testing and in the field.  Requesting backends would hang for 10 seconds  
and then report failure to read statistics, unless they got bailed out  
by some other backend coming along and making a newer request within  
that interval.  
  
I came across this through investigating unexpected delays in the  
src/test/recovery TAP tests: it manifests there because the autovacuum  
launcher hangs for 10 seconds when it can't get statistics at startup,  
thus preventing a second shutdown from occurring promptly.  We might  
want to do some things in the autovac code to make it less prone to  
getting stuck that way, but this change is a good bug fix regardless.  
  
In passing, also fix pgstat_read_statsfiles() to ensure that it  
re-zeroes its global stats variables if they are corrupted by a  
short read from the stats file.  (Other reads in that function  
go into temp variables, so that the issue doesn't arise.)  
  
This has been broken since we created the separation between permanent  
and temporary stats files in 8.4, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c

Reduce pg_ctl's reaction time when waiting for postmaster start/stop.

commit   : c61559ec3a41ad72a13c18d95b1eee8251de94c6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Jun 2017 15:13:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Jun 2017 15:13:23 -0400    

Click here for diff

pg_ctl has traditionally waited one second between probes for whether  
the start or stop request has completed.  That behavior was embodied  
in the original shell script written in 1999 (commit 5b912b089) and  
I doubt anyone's questioned it since.  Nowadays, machines are a lot  
faster, and the shell script is long since replaced by C code, so it's  
fair to reconsider how long we ought to wait.  
  
This patch adjusts the coding so that the wait time can be any even  
divisor of 1 second, and sets the actual probe rate to 10 per second.  
That's based on experimentation with the src/test/recovery TAP tests,  
which include a lot of postmaster starts and stops.  This patch alone  
reduces the (non-parallelized) runtime of those tests from ~4m30s to  
~3m5s on my machine.  Increasing the probe rate further doesn't help  
much, so this seems like a good number.  
  
In the real world this probably won't have much impact, since people  
don't start/stop production postmasters often, and the shutdown checkpoint  
usually takes nontrivial time too.  But it makes development work and  
testing noticeably snappier, and that's good enough reason for me.  
  
Also, by reducing the dead time in postmaster restart sequences, this  
change has made it easier to reproduce some bugs that have been lurking  
for awhile.  Patches for those will follow.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/pg_ctl.c

Improve wait logic in TAP tests for streaming replication.

commit   : 5c77690f6f419c504b7d8248db30c2280217e72e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Jun 2017 14:39:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Jun 2017 14:39:55 -0400    

Click here for diff

Remove hard-wired sleep(2) delays in 001_stream_rep.pl in favor of using  
poll_query_until to check for the desired state to appear.  In addition,  
add such a wait before the last test in the script, as it's possible  
to demonstrate failures there after upcoming improvements in pg_ctl.  
  
(We might end up adding polling before each of the get_slot_xmins calls in  
this script, but I feel no great need to do that until shown necessary.)  
  
In passing, clarify the description strings for some of the test cases.  
  
Michael Paquier and Craig Ringer, pursuant to a complaint from me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid useless "x = ANY(ARRAY[])" test for empty partition list.

commit   : 5efccc1cb43005a832776ed9158d2704fd976f8f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Jun 2017 10:43:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Jun 2017 10:43:20 -0400    

Click here for diff

This arises in practice if the partition only admits NULL values.  
  
Jeevan Ladhe  
  
Discussion: https://postgr.es/m/CAOgcT0OChrN--uuqH6wG6Z8+nxnCWJ+2Q-uhnK4KOANdRRxuAw@mail.gmail.com  

M src/backend/catalog/partition.c

Minor code review for parse_phrase_operator().

commit   : 00c5e511b94059396150c406f5d71598034a2061    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Jun 2017 10:31:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Jun 2017 10:31:10 -0400    

Click here for diff

Fix its header comment, which described the old behavior of the <N>  
phrase distance operator; we missed updating that in commit 028350f61.  
Also, reset errno before strtol() call, to defend against the possibility  
that it was already ERANGE at entry.  (The lack of complaints says that  
it generally isn't, but this is at least a latent bug.)  Very minor  
stylistic improvements as well.  
  
Victor Drobny noted the obsolete comment, I noted the errno issue.  
Back-patch to 9.6 where this code was added, just in case the errno  
issue is a live bug in some cases.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Consistently use () for function calls in release notes

commit   : 59cd3987afd61191483a4cfe8f6a0abfb8c878d6    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 26 Jun 2017 15:32:21 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 26 Jun 2017 15:32:21 +0200    

Click here for diff

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

commit   : de0c60b7d3f69c75c69c6577ae44caa3aae44800    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Jun 2017 12:27:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Jun 2017 12:27:04 -0400    

Click here for diff

M doc/src/sgml/ref/alter_collation.sgml
M doc/src/sgml/ref/create_collation.sgml

Further hacking on ICU collation creation and usage.

commit   : ddb5fdc068635d003a0d1c303cb109d1cb3ebeb1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Jun 2017 13:54:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Jun 2017 13:54:15 -0400    

Click here for diff

pg_import_system_collations() refused to create any ICU collations if  
the current database's encoding didn't support ICU.  This is wrongheaded:  
initdb must initialize pg_collation in an encoding-independent way  
since it might be used in other databases with different encodings.  
The reason for the restriction seems to be that get_icu_locale_comment()  
used icu_from_uchar() to convert the UChar-format display name, and that  
unsurprisingly doesn't know what to do in unsupported encodings.  
But by the same token that the initial catalog contents must be  
encoding-independent, we can't allow non-ASCII characters in the comment  
strings.  So we don't really need icu_from_uchar() here: just check for  
Unicode codes outside the ASCII range, and if there are none, the format  
conversion is trivial.  If there are some, we can simply not install the  
comment.  (In my testing, this affects only Norwegian BokmƄl, which has  
given us trouble before.)  
  
For paranoia's sake, also check for non-ASCII characters in ICU locale  
names, and skip such locales, as we do for libc locales.  I don't  
currently have a reason to believe that this will ever reject anything,  
but then again the libc maintainers should have known better too.  
  
With just the import changes, ICU collations can be found in pg_collation  
in databases with unsupported encodings.  This resulted in more or less  
clean failures at runtime, but that's not how things act for unsupported  
encodings with libc collations.  Make it work the same as our traditional  
behavior for libc collations by having collation lookup take into account  
whether is_encoding_supported_by_icu().  
  
Adjust documentation to match.  Also, expand Table 23.1 to show which  
encodings are supported by ICU.  
  
catversion bump because of likely change in pg_collation/pg_description  
initial contents in ICU-enabled builds.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/charset.sgml
M src/backend/catalog/namespace.c
M src/backend/commands/collationcmds.c
M src/include/catalog/catversion.h

Fix typo in comment in SerializeSnapshot

commit   : a15b47df357d6c9ac6ebc2ce63bb24c6faddd44c    
  
author   : Simon Riggs <[email protected]>    
date     : Sat, 24 Jun 2017 13:51:26 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Sat, 24 Jun 2017 13:51:26 +0100    

Click here for diff

Author: Masahiko Sawada  

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

Revert 1f30295eab65eddaa88528876ab66e7095f4bb65

commit   : 829f12e2690c0442e156069092b05f1edc78b08a    
  
author   : Simon Riggs <[email protected]>    
date     : Sat, 24 Jun 2017 13:03:55 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Sat, 24 Jun 2017 13:03:55 +0100    

Click here for diff

Reported-by: Tom Lane  

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

Fix incorrect buffer-length argument to uloc_getDisplayName().

commit   : d1fcc622987c1a5b490b956d89f36ac9fed8f9d1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Jun 2017 16:00:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Jun 2017 16:00:45 -0400    

Click here for diff

The maxResultSize argument of uloc_getDisplayName is the number of  
UChars in the output buffer, not the number of bytes.  In principle  
this could result in a stack smash, although at least in my Fedora 25  
install there are no ICU locales with display names long enough to  
overrun the buffer.  But it's easily proven to be wrong by reducing  
the length of displayname to around 20, whereupon a stack smash  
does happen.  
  
(This is a rather scary bug, because the same mistake could easily  
have been made in other places; but in a quick code search looking  
at uses of UChar I could not find any other instances.)  

M src/backend/commands/collationcmds.c

Fix replication with replica identity full

commit   : 08859bb5c2cebc132629ca838113d27bb31b990c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Jun 2017 15:12:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Jun 2017 15:12:36 -0400    

Click here for diff

The comparison with the target rows on the subscriber side was done with  
datumIsEqual(), which can have false negatives.  For instance, it didn't  
work reliably for text columns.  So use the equality operator provided  
by the type cache instead.  
  
Also add more user documentation about replica identity requirements.  
  
Reported-by: Tatsuo Ishii <[email protected]>  

M doc/src/sgml/logical-replication.sgml
M src/backend/executor/execReplication.c
M src/test/subscription/t/001_rep_changes.pl

Rethink behavior of pg_import_system_collations().

commit   : 0b13b2a7712b6f91590b7589a314240a14520c2f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Jun 2017 14:19:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Jun 2017 14:19:48 -0400    

Click here for diff

Marco Atzeri reported that initdb would fail if "locale -a" reported  
the same locale name more than once.  All previous versions of Postgres  
implicitly de-duplicated the results of "locale -a", but the rewrite  
to move the collation import logic into C had lost that property.  
It had also lost the property that locale names matching built-in  
collation names were silently ignored.  
  
The simplest way to fix this is to make initdb run the function in  
if-not-exists mode, which means that there's no real use-case for  
non if-not-exists mode; we might as well just drop the boolean argument  
and simplify the function's definition to be "add any collations not  
already known".  This change also gets rid of some odd corner cases  
caused by the fact that aliases were added in if-not-exists mode even  
if the function argument said otherwise.  
  
While at it, adjust the behavior so that pg_import_system_collations()  
doesn't spew "collation foo already exists, skipping" messages during a  
re-run; that's completely unhelpful, especially since there are often  
hundreds of them.  And make it return a count of the number of collations  
it did add, which seems like it might be helpful.  
  
Also, re-integrate the previous coding's property that it would make a  
deterministic selection of which alias to use if there were conflicting  
possibilities.  This would only come into play if "locale -a" reports  
multiple equivalent locale names, say "de_DE.utf8" and "de_DE.UTF-8",  
but that hardly seems out of the question.  
  
In passing, fix incorrect behavior in pg_import_system_collations()'s  
ICU code path: it neglected CommandCounterIncrement, which would result  
in failures if ICU returns duplicate names, and it would try to create  
comments even if a new collation hadn't been created.  
  
Also, reorder operations in initdb so that the 'ucs_basic' collation  
is created before calling pg_import_system_collations() not after.  
This prevents a failure if "locale -a" were to report a locale named  
that.  There's no reason to think that that ever happens in the wild,  
but the old coding would have survived it, so let's be equally robust.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/catalog/pg_collation.c
M src/backend/commands/collationcmds.c
M src/bin/initdb/initdb.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_collation_fn.h
M src/include/catalog/pg_proc.h

Improve replication lag interpolation after idle period

commit   : 9ea3c64124af039219aa5030d7af675dce5daa60    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 23 Jun 2017 18:58:46 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 23 Jun 2017 18:58:46 +0100    

Click here for diff

After sitting idle and fully replayed for a while and then encountering  
a new burst of WAL activity, we interpolate between an ancient sample and the  
not-yet-reached one for the new traffic. That produced a corner case report  
of lag after receiving first new reply from standby, which might sometimes  
be a large spike.  
  
Correct this by resetting last_read time and handle that new case.  
  
Author: Thomas Munro  

M src/backend/replication/walsender.c

Minor corrections to high availability docs

commit   : a79122b06194927d2b79465f335b94f2b4472816    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 23 Jun 2017 18:16:00 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 23 Jun 2017 18:16:00 +0100    

Click here for diff

Startup process is displayed in pg_stat_activity, noted by Yugo Nagata.  
Transactions can be resolved at end of recovery.  
  
Author: Yugo Nagata, with addition by me  

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

Fix memory leakage in ICU encoding conversion, and other code review.

commit   : b6159202c99d4021fb078cede90b26f94883143d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Jun 2017 12:22:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Jun 2017 12:22:06 -0400    

Click here for diff

Callers of icu_to_uchar() neglected to pfree the result string when done  
with it.  This results in catastrophic memory leaks in varstr_cmp(),  
because of our prevailing assumption that btree comparison functions don't  
leak memory.  For safety, make all the call sites clean up leaks, though  
I suspect that we could get away without it in formatting.c.  I audited  
callers of icu_from_uchar() as well, but found no places that seemed to  
have a comparable issue.  
  
Add function API specifications for icu_to_uchar() and icu_from_uchar();  
the lack of any thought-through specification is perhaps not unrelated  
to the existence of this bug in the first place.  Fix icu_to_uchar()  
to guarantee a nul-terminated result; although no existing caller appears  
to care, the fact that it would have been nul-terminated except in  
extreme corner cases seems ideally designed to bite someone on the rear  
someday.  Fix ucnv_fromUChars() destCapacity argument --- in the worst  
case, that could perhaps have led to a non-nul-terminated result, too.  
Fix icu_from_uchar() to have a more reasonable definition of the function  
result --- no callers are actually paying attention, so this isn't a live  
bug, but it's certainly sloppily designed.  Const-ify icu_from_uchar()'s  
input string for consistency.  
  
That is not the end of what needs to be done to these functions, but  
it's as much as I have the patience for right now.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/collationcmds.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/varlena.c
M src/include/utils/pg_locale.h

Add testing to detect errors of omission in "pin" dependency creation.

commit   : 8be8510cf89d4e150816941029d7cdddfe9aa474    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Jun 2017 11:03:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Jun 2017 11:03:04 -0400    

Click here for diff

It's essential that initdb.c's setup_depend() scan each system catalog  
that could contain objects that need to have "p" (pin) entries in pg_depend  
or pg_shdepend.  Forgetting to add that, either when a catalog is first  
invented or when it first acquires DATA() entries, is an obvious bug  
hazard.  We can detect such omissions at reasonable cost by probing every  
OID-containing system catalog to see whether the lowest-numbered OID in it  
is pinned.  If so, the catalog must have been properly accounted for in  
setup_depend().  If the lowest OID is above FirstNormalObjectId then the  
catalog must have been empty at the end of initdb, so it doesn't matter.  
There are a small number of catalogs whose first entry is made later in  
initdb than setup_depend(), resulting in nonempty expected output of the  
test, but these can be manually inspected to see that they are OK.  Any  
future mistake of this ilk will manifest as a new entry in the test's  
output.  
  
Since pg_conversion is already in the test's output, add it to the set of  
catalogs scanned by setup_depend().  That has no effect today (hence, no  
catversion bump here) but it will protect us if we ever do add pin-worthy  
conversions.  
  
This test is very much like the catalog sanity checks embodied in  
opr_sanity.sql and type_sanity.sql, but testing pg_depend doesn't seem to  
fit naturally into either of those scripts' charters.  Hence, invent a new  
test script misc_sanity.sql, which can be a home for this as well as tests  
on any other catalogs we might want in future.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/initdb.c
A src/test/regress/expected/misc_sanity.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/misc_sanity.sql

Fix typos in README.dependencies

commit   : da2322883b9e50b1aac70a3b6eaf2a4f0e486469    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jun 2017 17:12:27 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jun 2017 17:12:27 -0400    

Click here for diff

There was a logic error in a formula, reported by Atsushi Torokoshi.  
Ashutosh Bapat furthermore recommended to change notation for a variable  
that was re-using a letter from a previous formula, though his proposed  
patch contained a small error in attributing what the new letter is for.  
Also, instead of his proposed d' I ended up using e, to avoid confusing  
the reader with quotes which are used differently in the explaining  
prose.  
  
Bugs appeared in commit 2686ee1b7ccfb9214064d4d2a98ea77382880306.  
  
Reported-by: Atsushi Torikoshi, Ashutosh Bapat  
Discussion: https://postgr.es/m/CAFjFpRd03YojT4wyuDcjhCfYuygfWfnt68XGn2CKv=rcjRCtTA@mail.gmail.com  

M src/backend/statistics/README.dependencies

Fix typo in comment

commit   : 82c1507e3067d6d7884e823b09c921f9119dbe6f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jun 2017 16:42:38 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jun 2017 16:42:38 -0400    

Click here for diff

Once upon a time, WAL pointers could be NULL, but no longer.  We talk about  
"valid" now.  
  
Reported-by: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

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

Document partitioned_rels in create_modifytable_path header comment.

commit   : 6af9f1bd4bcbb0de15e826205b8e60632147dbe2    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Jun 2017 13:51:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Jun 2017 13:51:39 -0400    

Click here for diff

Etsuro Fujita, slightly adjusted by me.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Fix autovacuum launcher attachment to its DSA

commit   : a4f06606a328664d79f34b6041e816908d93e063    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jun 2017 13:50:26 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jun 2017 13:50:26 -0400    

Click here for diff

The autovacuum launcher doesn't actually do anything with its DSA other  
than creating it and attaching to it, but it's been observed that after  
longjmp'ing to the standard error handling block (for example after  
getting SIGINT) the autovacuum enters an infinite loop reporting that it  
cannot attach to its DSA anymore (which is correct, because it's already  
attached to it.)  Fix by only attempting to attach if not already  
attached.  
  
I introduced this bug together with BRIN autosummarization in  
7526e10224f0.  
  
Reported-by: Yugo Nagata.  
Author: Thomas Munro.  I added the comment to go with it.  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/autovacuum.c

Update out-of-date comment in vacuumlazy.c

commit   : 2a6db5eba69c0d6c842360f836cadd20e6cd9a0c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Jun 2017 13:35:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Jun 2017 13:35:39 -0400    

Click here for diff

Commit 15c121b3ed7eb2f290e19533e41ccca734d23574 seems to have  
overlooked the need to trim this part of the comment.  
  
Pavan Deolasee  
  
Discussion: http://postgr.es/m/CABOikdPq_9+cWRNZ0RLKTwuZyj=uL85X=Usifa-CbPee1ZCM5A@mail.gmail.com  

M src/backend/commands/vacuumlazy.c

Fix IF NOT EXISTS in CREATE STATISTICS

commit   : 5dfd564b1001f20c9def6ae938a92f39ddbd9984    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jun 2017 13:17:08 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jun 2017 13:17:08 -0400    

Click here for diff

I misplaced the IF NOT EXISTS clause in commit 7b504eb282, before the  
word STATISTICS.  Put it where it belongs.  
  
Patch written independently by Amit Langote and myself.  I adopted his  
submitted test case with a slight edit also.  
  
Reported-by: Bruno Wolff III  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/gram.y
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

postgres_fdw: Move function prototype to correct section.

commit   : 2c77903b2bfba01f159138ba34b95d4b470395a8    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Jun 2017 12:44:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Jun 2017 12:44:53 -0400    

Click here for diff

Etsuro Fujita, reviewed by Ashutosh Bapat.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.h

psql: Restore alphabetical order in words_after_create.

commit   : da6bf130750dec5bcaab0696b00c513c17b14ff9    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Jun 2017 11:07:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Jun 2017 11:07:58 -0400    

Click here for diff

Rushabh Lathia  
  
Discussion: http://postgr.es/m/CAGPqQf3yKG0Eo04ePfLPG_-KTo=7ZkxbGDVUWfSGN35Y3SG+PA@mail.gmail.com  

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

Update comment to account for table partitioning.

commit   : 1300276042f9c4b9db10825f0b4431da423ebb57    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Jun 2017 10:52:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Jun 2017 10:52:25 -0400    

Click here for diff

Ashutosh Bapat and Amit Langote  
  
Discussion: http://postgr.es/m/CAFjFpRcG_NaAv6cDHD-9VfGdvB8maAtSfB=fTQr5+kxP2_sXzg@mail.gmail.com  

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

Fix typo in comment

commit   : f0415a30e0bd56c9badecf097e8568ec1b3e3b0e    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 22 Jun 2017 15:37:30 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 22 Jun 2017 15:37:30 +0200    

Click here for diff

Author: Masahiko Sawada  

M src/backend/catalog/partition.c

Teach pgrowlocks to check relkind before scanning

commit   : b56818abd450a87e2e3cb03b2cf3eede73487926    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jun 2017 23:19:13 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jun 2017 23:19:13 -0400    

Click here for diff

Author: Amit Langote <[email protected]>  

M contrib/pgrowlocks/pgrowlocks.c

Fix possibility of creating a "phantom" segment after promotion.

commit   : fb886c153bc168eeb1c3fd2f24562b5b808357d6    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 21 Jun 2017 14:14:45 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 21 Jun 2017 14:14:45 -0700    

Click here for diff

When promoting a standby just after a XLOG_SWITCH record was replayed,  
and next segment(s) are already are locally available (via walsender,  
restore_command + trigger/recovery target), that segment could  
accidentally be recycled onto the past of the new timeline.  Later  
checkpointer would create a .ready file for it, assuming there was an  
error during creation, and it would get archived.  That causes trouble  
if another standby is later brought up from a basebackup from before  
the timeline creation, because it would try to read the  
segment, because XLogFileReadAnyTLI just tries all possible timelines,  
which doesn't have valid contents.  Thus replay would fail.  
  
The problem, if already occurred, can be fixed by removing the segment  
and/or having restore_command filter it out.  
  
The reason for the creation of such "phantom" segments was, that after  
an XLOG_SWITCH record the EndOfLog variable points to the beginning of  
the next segment, and RemoveXlogFile() used XLByteToPrevSeg().  
Normally RemoveXlogFile() doing so is harmless, because the last  
segment will still exist preventing InstallXLogFileSegment() from  
causing harm, but just after promotion there's no previous segment on  
the new timeline.  
  
Fix that by using XLByteToSeg() instead of XLByteToPrevSeg().  
  
Author: Andres Freund  
Reported-By: Greg Burek  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.2-, bug older than all supported versions  

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

Manually un-break a few URLs that pgindent used to insist on splitting.

commit   : 780b3a4c43fd47867825d5d628e96a0966e63aa8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Jun 2017 16:02:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Jun 2017 16:02:08 -0400    

Click here for diff

These will no longer get re-split by pgindent runs, so it's worth cleaning  
them up now.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/selfuncs.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/psql/copy.c

Remove entab and associated detritus.

commit   : 81f056c7256f01a39ecc926bf6a4d2d1fa525633    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Jun 2017 15:46:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Jun 2017 15:46:20 -0400    

Click here for diff

We don't need this anymore, because pg_bsd_indent has been taught to  
follow the same tab-vs-space rules that entab used to enforce.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

D src/tools/entab/.gitignore
D src/tools/entab/Makefile
D src/tools/entab/entab.1
D src/tools/entab/entab.c
M src/tools/pgindent/README
M src/tools/pgindent/pgindent
M src/tools/pgindent/pgindent.man

Reformat comments about ResultRelInfo

commit   : 113b0045e20d40f726a0a30e33214455e4f1385e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Jun 2017 14:29:48 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Jun 2017 14:29:48 -0400    

Click here for diff

Also add a comment on its new member PartitionRoot.  
  
Reported-by: Etsuro Fujita <[email protected]>  

M src/include/nodes/execnodes.h

Phase 3 of pgindent updates.

commit   : 382ceffdf7f620d8f2d50e451b4167d291ae2348    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Jun 2017 15:35:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Jun 2017 15:35:54 -0400    

Click here for diff

Don't move parenthesized lines to the left, even if that means they  
flow past the right margin.  
  
By default, BSD indent lines up statement continuation lines that are  
within parentheses so that they start just to the right of the preceding  
left parenthesis.  However, traditionally, if that resulted in the  
continuation line extending to the right of the desired right margin,  
then indent would push it left just far enough to not overrun the margin,  
if it could do so without making the continuation line start to the left of  
the current statement indent.  That makes for a weird mix of indentations  
unless one has been completely rigid about never violating the 80-column  
limit.  
  
This behavior has been pretty universally panned by Postgres developers.  
Hence, disable it with indent's new -lpl switch, so that parenthesized  
lines are always lined up with the preceding left paren.  
  
This patch is much less interesting than the first round of indent  
changes, but also bulkier, so I thought it best to separate the effects.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/adminpack/adminpack.c
M contrib/amcheck/verify_nbtree.c
M contrib/auth_delay/auth_delay.c
M contrib/auto_explain/auto_explain.c
M contrib/bloom/bloom.h
M contrib/bloom/blvacuum.c
M contrib/btree_gin/btree_gin.c
M contrib/btree_gist/btree_cash.c
M contrib/btree_gist/btree_date.c
M contrib/btree_gist/btree_enum.c
M contrib/btree_gist/btree_float4.c
M contrib/btree_gist/btree_float8.c
M contrib/btree_gist/btree_inet.c
M contrib/btree_gist/btree_int2.c
M contrib/btree_gist/btree_int4.c
M contrib/btree_gist/btree_int8.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_macaddr.c
M contrib/btree_gist/btree_macaddr8.c
M contrib/btree_gist/btree_oid.c
M contrib/btree_gist/btree_time.c
M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_utils_var.c
M contrib/btree_gist/btree_uuid.c
M contrib/cube/cube.c
M contrib/dblink/dblink.c
M contrib/earthdistance/earthdistance.c
M contrib/file_fdw/file_fdw.c
M contrib/hstore/hstore_io.c
M contrib/hstore/hstore_op.c
M contrib/intarray/_int_bool.c
M contrib/intarray/_int_gist.c
M contrib/intarray/_int_op.c
M contrib/intarray/_int_selfuncs.c
M contrib/isn/isn.c
M contrib/ltree/_ltree_op.c
M contrib/ltree/lquery_op.c
M contrib/ltree/ltree.h
M contrib/ltree/ltree_gist.c
M contrib/ltree/ltree_io.c
M contrib/oid2name/oid2name.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/rawpage.c
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_standby/pg_standby.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pgcrypto/crypt-blowfish.c
M contrib/pgcrypto/crypt-gensalt.c
M contrib/pgcrypto/pgp-pgsql.c
M contrib/pgcrypto/px-crypt.h
M contrib/pgrowlocks/pgrowlocks.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/pgstattuple/pgstatindex.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/seg/seg.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/proc.c
M contrib/sepgsql/uavc.c
M contrib/spi/refint.c
M contrib/sslinfo/sslinfo.c
M contrib/tablefunc/tablefunc.c
M contrib/tcn/tcn.c
M contrib/test_decoding/test_decoding.c
M contrib/unaccent/unaccent.c
M contrib/xml2/xpath.c
M contrib/xml2/xslt_proc.c
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/reloptions.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/ginscan.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.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/hashutil.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/rmgrdesc/brindesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/rmgrdesc/logicalmsgdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/spgdesc.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/spgquadtreeproc.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/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/timeline.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/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/bootstrap.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_type.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/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.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/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumlazy.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execReplication.c
M src/backend/executor/execSRF.c
M src/backend/executor/execTuples.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/executor/tstoreReceiver.c
M src/backend/lib/pairingheap.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/hba.c
M src/backend/libpq/pqcomm.c
M src/backend/main/main.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/tidbitmap.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_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/port/dynloader/hpux.c
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/port/win32/crashdump.c
M src/backend/port/win32/mingwcompat.c
M src/backend/port/win32/signal.c
M src/backend/port/win32/socket.c
M src/backend/port/win32/timer.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/slot.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/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rowsecurity.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mvdistinct.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/fd.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/latch.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/shm_toc.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/sinval.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/lock.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/page/bufpage.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.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/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_thesaurus.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_typanalyze.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/amutils.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/date.c
M src/backend/utils/adt/datetime.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/float.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/inet_cidr_ntop.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/nabstime.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/pg_locale.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/rangetypes.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/timestamp.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsvector_op.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/xml.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/ts_cache.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/hash/dynahash.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/mb/wchar.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/help_config.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/pg_rusage.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/combocid.c
M src/backend/utils/time/snapmgr.c
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_test_timing/pg_test_timing.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/function.c
M src/bin/pg_upgrade/info.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/server.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/version.c
M src/bin/pg_waldump/compat.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.c
M src/bin/pgevent/pgevent.c
M src/bin/psql/command.c
M src/bin/psql/crosstabview.c
M src/bin/psql/describe.c
M src/bin/psql/help.c
M src/bin/psql/large_obj.c
M src/bin/psql/mainloop.c
M src/bin/psql/tab-complete.c
M src/bin/scripts/common.h
M src/bin/scripts/dropdb.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/common/file_utils.c
M src/common/restricted_token.c
M src/common/username.c
M src/fe_utils/mbprint.c
M src/fe_utils/print.c
M src/include/access/amapi.h
M src/include/access/clog.h
M src/include/access/genam.h
M src/include/access/gin_private.h
M src/include/access/hash.h
M src/include/access/heapam.h
M src/include/access/xlog.h
M src/include/catalog/pg_constraint_fn.h
M src/include/commands/createas.h
M src/include/commands/explain.h
M src/include/executor/executor.h
M src/include/executor/nodeIndexscan.h
M src/include/foreign/fdwapi.h
M src/include/lib/pairingheap.h
M src/include/mb/pg_wchar.h
M src/include/optimizer/cost.h
M src/include/parser/parse_relation.h
M src/include/pgtar.h
M src/include/postgres.h
M src/include/replication/logical.h
M src/include/replication/reorderbuffer.h
M src/include/rewrite/rewriteManip.h
M src/include/storage/procarray.h
M src/include/storage/sinval.h
M src/include/tcop/utility.h
M src/include/utils/acl.h
M src/include/utils/elog.h
M src/include/utils/jsonapi.h
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/error.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/extern.h
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/preproc/descriptor.c
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/type.c
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-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/win32.c
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_elog.h
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_typeio.c
M src/pl/tcl/pltcl.c
M src/port/dirmod.c
M src/port/getaddrinfo.c
M src/port/getopt_long.c
M src/port/gettimeofday.c
M src/port/inet_net_ntop.c
M src/port/open.c
M src/port/path.c
M src/port/win32security.c
M src/test/isolation/isolationtester.c
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/worker.c
M src/test/modules/worker_spi/worker_spi.c
M src/test/regress/pg_regress.c
M src/test/regress/regress.c
M src/timezone/pgtz.c
M src/tools/findoidjoins/findoidjoins.c
M src/tools/pgindent/pgindent

Phase 2 of pgindent updates.

commit   : c7b8998ebbf310a156aa38022555a24d98fdbfb4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Jun 2017 15:18:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Jun 2017 15:18:54 -0400    

Click here for diff

Change pg_bsd_indent to follow upstream rules for placement of comments  
to the right of code, and remove pgindent hack that caused comments  
following #endif to not obey the general rule.  
  
Commit e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 wasn't actually using  
the published version of pg_bsd_indent, but a hacked-up version that  
tried to minimize the amount of movement of comments to the right of  
code.  The situation of interest is where such a comment has to be  
moved to the right of its default placement at column 33 because there's  
code there.  BSD indent has always moved right in units of tab stops  
in such cases --- but in the previous incarnation, indent was working  
in 8-space tab stops, while now it knows we use 4-space tabs.  So the  
net result is that in about half the cases, such comments are placed  
one tab stop left of before.  This is better all around: it leaves  
more room on the line for comment text, and it means that in such  
cases the comment uniformly starts at the next 4-space tab stop after  
the code, rather than sometimes one and sometimes two tabs after.  
  
Also, ensure that comments following #endif are indented the same  
as comments following other preprocessor commands such as #else.  
That inconsistency turns out to have been self-inflicted damage  
from a poorly-thought-through post-indent "fixup" in pgindent.  
  
This patch is much less interesting than the first round of indent  
changes, but also bulkier, so I thought it best to separate the effects.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/bloom.h
M contrib/btree_gist/btree_utils_num.h
M contrib/btree_gist/btree_utils_var.c
M contrib/btree_gist/btree_utils_var.h
M contrib/btree_gist/btree_uuid.c
M contrib/cube/cubedata.h
M contrib/dblink/dblink.c
M contrib/file_fdw/file_fdw.c
M contrib/fuzzystrmatch/dmetaphone.c
M contrib/hstore/hstore.h
M contrib/hstore/hstore_io.c
M contrib/intarray/_int.h
M contrib/intarray/_int_tool.c
M contrib/isn/isn.c
M contrib/isn/isn.h
M contrib/lo/lo.c
M contrib/ltree/ltree.h
M contrib/ltree/ltree_gist.c
M contrib/pageinspect/pageinspect.h
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_standby/pg_standby.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm.h
M contrib/pg_trgm/trgm_regexp.c
M contrib/pgcrypto/crypt-des.c
M contrib/pgcrypto/imath.c
M contrib/pgcrypto/imath.h
M contrib/pgcrypto/internal.c
M contrib/pgcrypto/mbuf.h
M contrib/pgcrypto/md5.h
M contrib/pgcrypto/pgp.h
M contrib/pgcrypto/px-crypt.h
M contrib/pgcrypto/px.h
M contrib/pgcrypto/rijndael.c
M contrib/pgcrypto/rijndael.h
M contrib/pgcrypto/sha1.h
M contrib/pgstattuple/pgstatindex.c
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/sepgsql/label.c
M contrib/sepgsql/sepgsql.h
M contrib/spi/refint.c
M contrib/spi/timetravel.c
M contrib/tablefunc/tablefunc.c
M contrib/tablefunc/tablefunc.h
M contrib/tcn/tcn.c
M contrib/uuid-ossp/uuid-ossp.c
M contrib/xml2/xpath.c
M contrib/xml2/xslt_proc.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/printsimple.c
M src/backend/access/common/tupconvert.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginvacuum.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/hash/hashfunc.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/rewriteheap.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtinsert.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/rmgrdesc/xlogdesc.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/twophase_rmgr.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/storage.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/copy.c
M src/backend/commands/dbcommands.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/portalcmds.c
M src/backend/commands/proclang.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/vacuumlazy.c
M src/backend/commands/view.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execMain.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/lib/ilist.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/hba.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/pqcomm.c
M src/backend/main/main.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/params.c
M src/backend/nodes/readfuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/optimizer/geqo/geqo_cx.c
M src/backend/optimizer/geqo/geqo_erx.c
M src/backend/optimizer/geqo/geqo_misc.c
M src/backend/optimizer/geqo/geqo_mutation.c
M src/backend/optimizer/geqo/geqo_ox1.c
M src/backend/optimizer/geqo/geqo_ox2.c
M src/backend/optimizer/geqo/geqo_pmx.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_px.c
M src/backend/optimizer/geqo/geqo_recombination.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/pathkeys.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/prep/prepjointree.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_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_relation.c
M src/backend/parser/parse_utilcmd.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/darwin.c
M src/backend/port/dynloader/freebsd.c
M src/backend/port/dynloader/freebsd.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/solaris.h
M src/backend/port/dynloader/win32.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/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_color.c
M src/backend/regex/regc_lex.c
M src/backend/regex/regc_locale.c
M src/backend/regex/regc_nfa.c
M src/backend/regex/regc_pg_locale.c
M src/backend/regex/regcomp.c
M src/backend/regex/rege_dfa.c
M src/backend/regex/regerror.c
M src/backend/regex/regexec.c
M src/backend/regex/regexport.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/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/rewriteHandler.c
M src/backend/statistics/dependencies.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/large_object/inv_api.c
M src/backend/storage/lmgr/deadlock.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/s_lock.c
M src/backend/storage/lmgr/spin.c
M src/backend/storage/page/bufpage.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.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/dict_thesaurus.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/cash.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/nabstime.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varlena.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/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/syscache.c
M src/backend/utils/cache/typcache.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/hash/dynahash.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/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/backend/utils/mb/encnames.c
M src/backend/utils/mb/wchar.c
M src/backend/utils/misc/backend_random.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/misc/sampling.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/memdebug.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/time/snapmgr.c
M src/backend/utils/time/tqual.c
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/compress_io.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/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_tar.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_resetwal/pg_resetwal.c
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/datapagemap.h
M src/bin/pg_rewind/fetch.h
M src/bin/pg_rewind/file_ops.h
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/logging.h
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pg_waldump/rmgrdesc.h
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/conditional.h
M src/bin/psql/copy.c
M src/bin/psql/crosstabview.h
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/input.c
M src/bin/psql/input.h
M src/bin/psql/large_obj.h
M src/bin/psql/mainloop.c
M src/bin/psql/mainloop.h
M src/bin/psql/prompt.c
M src/bin/psql/prompt.h
M src/bin/psql/settings.h
M src/bin/psql/startup.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/common.c
M src/bin/scripts/common.h
M src/common/exec.c
M src/common/file_utils.c
M src/common/ip.c
M src/common/keywords.c
M src/common/md5.c
M src/common/pg_lzcompress.c
M src/common/psprintf.c
M src/common/scram-common.c
M src/common/sha2.c
M src/fe_utils/mbprint.c
M src/fe_utils/print.c
M src/fe_utils/string_utils.c
M src/include/access/amapi.h
M src/include/access/amvalidate.h
M src/include/access/attnum.h
M src/include/access/brin.h
M src/include/access/brin_internal.h
M src/include/access/brin_page.h
M src/include/access/brin_pageops.h
M src/include/access/brin_revmap.h
M src/include/access/brin_tuple.h
M src/include/access/brin_xlog.h
M src/include/access/clog.h
M src/include/access/commit_ts.h
M src/include/access/genam.h
M src/include/access/generic_xlog.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/ginblock.h
M src/include/access/ginxlog.h
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/hash.h
M src/include/access/hash_xlog.h
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/hio.h
M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/access/parallel.h
M src/include/access/printsimple.h
M src/include/access/printtup.h
M src/include/access/reloptions.h
M src/include/access/relscan.h
M src/include/access/rewriteheap.h
M src/include/access/rmgr.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/spgxlog.h
M src/include/access/stratnum.h
M src/include/access/subtrans.h
M src/include/access/sysattr.h
M src/include/access/timeline.h
M src/include/access/transam.h
M src/include/access/tsmapi.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/tupmacs.h
M src/include/access/tuptoaster.h
M src/include/access/twophase.h
M src/include/access/twophase_rmgr.h
M src/include/access/valid.h
M src/include/access/visibilitymap.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogdefs.h
M src/include/access/xloginsert.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/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/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/partition.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_constraint_fn.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_init_privs.h
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_operator_fn.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_proc_fn.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.h
M src/include/catalog/pg_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/proclang.h
M src/include/commands/publicationcmds.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/sequence.h
M src/include/commands/subscriptioncmds.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/commands/user.h
M src/include/commands/vacuum.h
M src/include/commands/variable.h
M src/include/commands/view.h
M src/include/common/base64.h
M src/include/common/config_info.h
M src/include/common/controldata_utils.h
M src/include/common/fe_memutils.h
M src/include/common/file_utils.h
M src/include/common/int128.h
M src/include/common/ip.h
M src/include/common/keywords.h
M src/include/common/pg_lzcompress.h
M src/include/common/relpath.h
M src/include/common/restricted_token.h
M src/include/common/saslprep.h
M src/include/common/scram-common.h
M src/include/common/sha2.h
M src/include/common/string.h
M src/include/common/unicode_norm.h
M src/include/common/unicode_norm_table.h
M src/include/common/username.h
M src/include/datatype/timestamp.h
M src/include/executor/execExpr.h
M src/include/executor/execParallel.h
M src/include/executor/execdebug.h
M src/include/executor/execdesc.h
M src/include/executor/executor.h
M src/include/executor/functions.h
M src/include/executor/hashjoin.h
M src/include/executor/instrument.h
M src/include/executor/nodeAgg.h
M src/include/executor/nodeAppend.h
M src/include/executor/nodeBitmapAnd.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeBitmapIndexscan.h
M src/include/executor/nodeBitmapOr.h
M src/include/executor/nodeCtescan.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/executor/nodeFunctionscan.h
M src/include/executor/nodeGather.h
M src/include/executor/nodeGatherMerge.h
M src/include/executor/nodeGroup.h
M src/include/executor/nodeHash.h
M src/include/executor/nodeHashjoin.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h
M src/include/executor/nodeLimit.h
M src/include/executor/nodeLockRows.h
M src/include/executor/nodeMaterial.h
M src/include/executor/nodeMergeAppend.h
M src/include/executor/nodeMergejoin.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/nodeNamedtuplestorescan.h
M src/include/executor/nodeNestloop.h
M src/include/executor/nodeProjectSet.h
M src/include/executor/nodeRecursiveunion.h
M src/include/executor/nodeResult.h
M src/include/executor/nodeSamplescan.h
M src/include/executor/nodeSeqscan.h
M src/include/executor/nodeSetOp.h
M src/include/executor/nodeSort.h
M src/include/executor/nodeSubplan.h
M src/include/executor/nodeSubqueryscan.h
M src/include/executor/nodeTableFuncscan.h
M src/include/executor/nodeTidscan.h
M src/include/executor/nodeUnique.h
M src/include/executor/nodeValuesscan.h
M src/include/executor/nodeWindowAgg.h
M src/include/executor/nodeWorktablescan.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.h
M src/include/executor/tablefunc.h
M src/include/executor/tqueue.h
M src/include/executor/tstoreReceiver.h
M src/include/executor/tuptable.h
M src/include/fe_utils/mbprint.h
M src/include/fe_utils/print.h
M src/include/fe_utils/psqlscan.h
M src/include/fe_utils/psqlscan_int.h
M src/include/fe_utils/simple_list.h
M src/include/fe_utils/string_utils.h
M src/include/fmgr.h
M src/include/foreign/fdwapi.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/getaddrinfo.h
M src/include/getopt_long.h
M src/include/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/knapsack.h
M src/include/lib/pairingheap.h
M src/include/lib/rbtree.h
M src/include/lib/simplehash.h
M src/include/lib/stringinfo.h
M src/include/libpq/auth.h
M src/include/libpq/be-fsstubs.h
M src/include/libpq/hba.h
M src/include/libpq/ifaddr.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq-fs.h
M src/include/libpq/libpq.h
M src/include/libpq/pqcomm.h
M src/include/libpq/pqformat.h
M src/include/libpq/pqmq.h
M src/include/libpq/pqsignal.h
M src/include/libpq/scram.h
M src/include/mb/pg_wchar.h
M src/include/miscadmin.h
M src/include/nodes/bitmapset.h
M src/include/nodes/execnodes.h
M src/include/nodes/extensible.h
M src/include/nodes/lockoptions.h
M src/include/nodes/makefuncs.h
M src/include/nodes/memnodes.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/print.h
M src/include/nodes/readfuncs.h
M src/include/nodes/relation.h
M src/include/nodes/replnodes.h
M src/include/nodes/tidbitmap.h
M src/include/nodes/value.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_copy.h
M src/include/optimizer/geqo_gene.h
M src/include/optimizer/geqo_misc.h
M src/include/optimizer/geqo_mutation.h
M src/include/optimizer/geqo_pool.h
M src/include/optimizer/geqo_random.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/orclauses.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/optimizer/predtest.h
M src/include/optimizer/prep.h
M src/include/optimizer/restrictinfo.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/include/optimizer/var.h
M src/include/parser/analyze.h
M src/include/parser/gramparse.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_collate.h
M src/include/parser/parse_cte.h
M src/include/parser/parse_enr.h
M src/include/parser/parse_expr.h
M src/include/parser/parse_func.h
M src/include/parser/parse_node.h
M src/include/parser/parse_oper.h
M src/include/parser/parse_param.h
M src/include/parser/parse_relation.h
M src/include/parser/parse_target.h
M src/include/parser/parse_type.h
M src/include/parser/parse_utilcmd.h
M src/include/parser/parser.h
M src/include/parser/parsetree.h
M src/include/parser/scanner.h
M src/include/parser/scansup.h
M src/include/pg_getopt.h
M src/include/pg_trace.h
M src/include/pgstat.h
M src/include/pgtime.h
M src/include/port.h
M src/include/port/atomics.h
M src/include/port/pg_bswap.h
M src/include/port/pg_crc32c.h
M src/include/port/win32.h
M src/include/port/win32/sys/socket.h
M src/include/portability/instr_time.h
M src/include/portability/mem.h
M src/include/postgres.h
M src/include/postgres_ext.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/regex.h
M src/include/regex/regexport.h
M src/include/regex/regguts.h
M src/include/replication/basebackup.h
M src/include/replication/logicallauncher.h
M src/include/replication/logicalproto.h
M src/include/replication/logicalrelation.h
M src/include/replication/logicalworker.h
M src/include/replication/message.h
M src/include/replication/origin.h
M src/include/replication/output_plugin.h
M src/include/replication/pgoutput.h
M src/include/replication/slot.h
M src/include/replication/snapbuild.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/replication/worker_internal.h
M src/include/rewrite/prs2lock.h
M src/include/rewrite/rewriteDefine.h
M src/include/rewrite/rewriteHandler.h
M src/include/rewrite/rewriteManip.h
M src/include/rewrite/rewriteRemove.h
M src/include/rewrite/rewriteSupport.h
M src/include/rewrite/rowsecurity.h
M src/include/rusagestub.h
M src/include/snowball/header.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/include/storage/backendid.h
M src/include/storage/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/condition_variable.h
M src/include/storage/copydir.h
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h
M src/include/storage/fd.h
M src/include/storage/freespace.h
M src/include/storage/fsm_internals.h
M src/include/storage/indexfsm.h
M src/include/storage/ipc.h
M src/include/storage/item.h
M src/include/storage/itemid.h
M src/include/storage/itemptr.h
M src/include/storage/large_object.h
M src/include/storage/latch.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/lockdefs.h
M src/include/storage/lwlock.h
M src/include/storage/off.h
M src/include/storage/pg_sema.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/procsignal.h
M src/include/storage/reinit.h
M src/include/storage/relfilenode.h
M src/include/storage/shm_mq.h
M src/include/storage/shm_toc.h
M src/include/storage/shmem.h
M src/include/storage/sinval.h
M src/include/storage/sinvaladt.h
M src/include/storage/smgr.h
M src/include/storage/spin.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/include/tcop/deparse_utility.h
M src/include/tcop/dest.h
M src/include/tcop/fastpath.h
M src/include/tcop/pquery.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/tsearch/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/backend_random.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h
M src/include/utils/cash.h
M src/include/utils/catcache.h
M src/include/utils/combocid.h
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/include/utils/datum.h
M src/include/utils/dsa.h
M src/include/utils/dynahash.h
M src/include/utils/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/freepage.h
M src/include/utils/geo_decls.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/hsearch.h
M src/include/utils/index_selfuncs.h
M src/include/utils/inet.h
M src/include/utils/int8.h
M src/include/utils/inval.h
M src/include/utils/json.h
M src/include/utils/jsonapi.h
M src/include/utils/jsonb.h
M src/include/utils/logtape.h
M src/include/utils/lsyscache.h
M src/include/utils/memdebug.h
M src/include/utils/memutils.h
M src/include/utils/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/ps_status.h
M src/include/utils/queryenvironment.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/relptr.h
M src/include/utils/reltrigger.h
M src/include/utils/resowner.h
M src/include/utils/resowner_private.h
M src/include/utils/rls.h
M src/include/utils/ruleutils.h
M src/include/utils/sampling.h
M src/include/utils/selfuncs.h
M src/include/utils/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/xml.h
M src/include/windowapi.h
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/extern.h
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/ecpglib/pg_type.h
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/ecpglib/typename.c
M src/interfaces/ecpg/include/datetime.h
M src/interfaces/ecpg/include/decimal.h
M src/interfaces/ecpg/include/ecpg-pthread-win32.h
M src/interfaces/ecpg/include/ecpg_informix.h
M src/interfaces/ecpg/include/ecpgerrno.h
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/include/ecpgtype.h
M src/interfaces/ecpg/include/pgtypes_date.h
M src/interfaces/ecpg/include/pgtypes_interval.h
M src/interfaces/ecpg/include/pgtypes_numeric.h
M src/interfaces/ecpg/include/pgtypes_timestamp.h
M src/interfaces/ecpg/include/sql3types.h
M src/interfaces/ecpg/include/sqlca.h
M src/interfaces/ecpg/include/sqlda-compat.h
M src/interfaces/ecpg/include/sqlda-native.h
M src/interfaces/ecpg/include/sqlda.h
M src/interfaces/ecpg/include/sqltypes.h
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/extern.h
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/ecpg/preproc/extern.h
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/preproc/type.c
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/test/expected/compat_informix-describe.c
M src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
M src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c
M src/interfaces/ecpg/test/expected/preproc-init.c
M src/interfaces/ecpg/test/expected/preproc-outofscope.c
M src/interfaces/ecpg/test/expected/sql-array.c
M src/interfaces/ecpg/test/expected/sql-code100.c
M src/interfaces/ecpg/test/expected/sql-copystdout.c
M src/interfaces/ecpg/test/expected/sql-define.c
M src/interfaces/ecpg/test/expected/sql-describe.c
M src/interfaces/ecpg/test/expected/sql-dynalloc.c
M src/interfaces/ecpg/test/expected/sql-dynalloc2.c
M src/interfaces/ecpg/test/expected/sql-dyntest.c
M src/interfaces/ecpg/test/expected/sql-indicators.c
M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/expected/thread-alloc.c
M src/interfaces/ecpg/test/expected/thread-descriptor.c
M src/interfaces/ecpg/test/expected/thread-prep.c
M src/interfaces/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-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.h
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/pl/plperl/plperl.c
M src/pl/plperl/plperl.h
M src/pl/plperl/plperl_helpers.h
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_cursorobject.h
M src/pl/plpython/plpy_elog.h
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_exec.h
M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_main.h
M src/pl/plpython/plpy_planobject.h
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_plpymodule.h
M src/pl/plpython/plpy_procedure.h
M src/pl/plpython/plpy_resultobject.h
M src/pl/plpython/plpy_spi.h
M src/pl/plpython/plpy_subxactobject.h
M src/pl/plpython/plpy_typeio.h
M src/pl/plpython/plpy_util.c
M src/pl/plpython/plpy_util.h
M src/pl/plpython/plpython.h
M src/pl/tcl/pltcl.c
M src/port/chklocale.c
M src/port/crypt.c
M src/port/dirent.c
M src/port/dirmod.c
M src/port/getaddrinfo.c
M src/port/getopt.c
M src/port/getrusage.c
M src/port/mkdtemp.c
M src/port/pg_crc32c_sb8.c
M src/port/pg_crc32c_sse42.c
M src/port/pgsleep.c
M src/port/pqsignal.c
M src/port/snprintf.c
M src/test/isolation/isolationtester.h
M src/test/regress/pg_regress.c
M src/test/regress/regress.c
M src/test/thread/thread_test.c
M src/timezone/localtime.c
M src/timezone/pgtz.h
M src/timezone/private.h
M src/timezone/strftime.c
M src/timezone/tzfile.h
M src/timezone/zic.c
M src/tools/pgindent/pgindent
M src/tutorial/funcs.c
M src/tutorial/funcs_new.c

Restart logical replication launcher when killed

commit   : f669c09989bda894d6ba01634ccb229f0687c08a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jun 2017 15:15:29 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jun 2017 15:15:29 -0400    

Click here for diff

Author: Yugo Nagata <[email protected]>  

M src/backend/tcop/postgres.c

Initial pgindent run with pg_bsd_indent version 2.0.

commit   : e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Jun 2017 14:39:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Jun 2017 14:39:04 -0400    

Click here for diff

The new indent version includes numerous fixes thanks to Piotr Stefaniak.  
The main changes visible in this commit are:  
  
* Nicer formatting of function-pointer declarations.  
* No longer unexpectedly removes spaces in expressions using casts,  
  sizeof, or offsetof.  
* No longer wants to add a space in "struct structname *varname", as  
  well as some similar cases for const- or volatile-qualified pointers.  
* Declarations using PG_USED_FOR_ASSERTS_ONLY are formatted more nicely.  
* Fixes bug where comments following declarations were sometimes placed  
  with no space separating them from the code.  
* Fixes some odd decisions for comments following case labels.  
* Fixes some cases where comments following code were indented to less  
  than the expected column 33.  
  
On the less good side, it now tends to put more whitespace around typedef  
names that are not listed in typedefs.list.  This might encourage us to  
put more effort into typedef name collection; it's not really a bug in  
indent itself.  
  
There are more changes coming after this round, having to do with comment  
indentation and alignment of lines appearing within parentheses.  I wanted  
to limit the size of the diffs to something that could be reviewed without  
one's eyes completely glazing over, so it seemed better to split up the  
changes as much as practical.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/blutils.c
M contrib/btree_gist/btree_utils_var.c
M contrib/dblink/dblink.c
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/intarray/_int_gin.c
M contrib/ltree/lquery_op.c
M contrib/oid2name/oid2name.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_op.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pgcrypto/imath.c
M contrib/pgcrypto/imath.h
M contrib/pgcrypto/internal.c
M contrib/pgcrypto/mbuf.h
M contrib/pgcrypto/pgp-decrypt.c
M contrib/pgcrypto/pgp-pgsql.c
M contrib/pgcrypto/px-crypt.c
M contrib/pgcrypto/px.h
M contrib/pgcrypto/rijndael.h
M contrib/pgcrypto/sha1.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/pgstattuple/pgstattuple.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h
M contrib/sepgsql/uavc.c
M contrib/spi/timetravel.c
M contrib/uuid-ossp/uuid-ossp.c
M contrib/vacuumlo/vacuumlo.c
M contrib/xml2/xpath.c
M src/backend/access/common/reloptions.c
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/index.c
M src/backend/catalog/partition.c
M src/backend/commands/copy.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/vacuumlazy.c
M src/backend/executor/execCurrent.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/lib/binaryheap.c
M src/backend/lib/ilist.c
M src/backend/lib/rbtree.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/hba.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/pqcomm.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/predtest.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/port/win32/crashdump.c
M src/backend/port/win32/socket.c
M src/backend/port/win32/timer.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/regex/regc_color.c
M src/backend/regex/regc_cvec.c
M src/backend/regex/regc_lex.c
M src/backend/regex/regc_locale.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/regerror.c
M src/backend/regex/regexec.c
M src/backend/regex/regexport.c
M src/backend/regex/regprefix.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/snowball/dict_snowball.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mvdistinct.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/ipc/dsm.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/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/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/postgres.c
M src/backend/tcop/utility.c
M src/backend/tsearch/regis.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/cash.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/nabstime.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/typcache.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/hash/dynahash.c
M src/backend/utils/mb/wchar.c
M src/backend/utils/misc/backend_random.c
M src/backend/utils/misc/guc.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/tuplesort.c
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/version.c
M src/bin/pgbench/pgbench.c
M src/bin/pgevent/pgevent.c
M src/bin/psql/conditional.h
M src/bin/psql/copy.c
M src/bin/psql/describe.c
M src/bin/psql/mainloop.c
M src/bin/psql/startup.c
M src/bin/psql/stringutils.c
M src/bin/psql/tab-complete.c
M src/common/exec.c
M src/common/ip.c
M src/common/unicode/norm_test.c
M src/fe_utils/mbprint.c
M src/fe_utils/print.c
M src/fe_utils/simple_list.c
M src/fe_utils/string_utils.c
M src/include/access/amapi.h
M src/include/access/gin_private.h
M src/include/access/ginxlog.h
M src/include/access/hash.h
M src/include/access/hash_xlog.h
M src/include/access/hio.h
M src/include/access/itup.h
M src/include/access/relscan.h
M src/include/access/slru.h
M src/include/access/tsmapi.h
M src/include/access/tupdesc.h
M src/include/access/tuptoaster.h
M src/include/access/twophase_rmgr.h
M src/include/access/xact.h
M src/include/access/xloginsert.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/c.h
M src/include/catalog/index.h
M src/include/catalog/namespace.h
M src/include/catalog/objectaccess.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_trigger.h
M src/include/commands/explain.h
M src/include/commands/seclabel.h
M src/include/commands/vacuum.h
M src/include/common/int128.h
M src/include/common/ip.h
M src/include/common/unicode_norm_table.h
M src/include/executor/executor.h
M src/include/executor/hashjoin.h
M src/include/executor/tablefunc.h
M src/include/fe_utils/mbprint.h
M src/include/fe_utils/print.h
M src/include/fe_utils/psqlscan.h
M src/include/fmgr.h
M src/include/foreign/fdwapi.h
M src/include/getaddrinfo.h
M src/include/getopt_long.h
M src/include/lib/pairingheap.h
M src/include/lib/simplehash.h
M src/include/libpq/ifaddr.h
M src/include/libpq/libpq-be.h
M src/include/mb/pg_wchar.h
M src/include/nodes/execnodes.h
M src/include/nodes/extensible.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/primnodes.h
M src/include/nodes/relation.h
M src/include/optimizer/cost.h
M src/include/optimizer/paths.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/parser/analyze.h
M src/include/parser/parse_node.h
M src/include/parser/parser.h
M src/include/pg_getopt.h
M src/include/pgstat.h
M src/include/pgtime.h
M src/include/port.h
M src/include/port/win32.h
M src/include/postgres.h
M src/include/postmaster/bgworker.h
M src/include/regex/regguts.h
M src/include/replication/logical.h
M src/include/replication/output_plugin.h
M src/include/replication/reorderbuffer.h
M src/include/replication/walreceiver.h
M src/include/rewrite/rowsecurity.h
M src/include/rusagestub.h
M src/include/statistics/statistics.h
M src/include/storage/itemptr.h
M src/include/storage/lock.h
M src/include/storage/lwlock.h
M src/include/storage/pg_shmem.h
M src/include/storage/predicate_internals.h
M src/include/tcop/dest.h
M src/include/tcop/utility.h
M src/include/tsearch/ts_utils.h
M src/include/utils/bytea.h
M src/include/utils/datetime.h
M src/include/utils/elog.h
M src/include/utils/expandeddatum.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/hsearch.h
M src/include/utils/nabstime.h
M src/include/utils/portal.h
M src/include/utils/rangetypes.h
M src/include/utils/rel.h
M src/include/utils/resowner.h
M src/include/utils/selfuncs.h
M src/include/utils/snapshot.h
M src/include/utils/timestamp.h
M src/include/utils/xml.h
M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/ecpglib/connect.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/extern.h
M src/interfaces/ecpg/ecpglib/memory.c
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/ecpglib/sqlda.c
M src/interfaces/ecpg/include/ecpg_informix.h
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/include/ecpgtype.h
M src/interfaces/ecpg/include/pgtypes_date.h
M src/interfaces/ecpg/include/pgtypes_interval.h
M src/interfaces/ecpg/include/pgtypes_numeric.h
M src/interfaces/ecpg/include/pgtypes_timestamp.h
M src/interfaces/ecpg/include/sqlca.h
M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/ecpg/preproc/extern.h
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/preproc/type.c
M src/interfaces/ecpg/preproc/variable.c
M src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c
M src/interfaces/ecpg/test/expected/preproc-init.c
M src/interfaces/ecpg/test/expected/preproc-outofscope.c
M src/interfaces/ecpg/test/expected/sql-array.c
M src/interfaces/ecpg/test/expected/sql-code100.c
M src/interfaces/ecpg/test/expected/sql-copystdout.c
M src/interfaces/ecpg/test/expected/sql-define.c
M src/interfaces/ecpg/test/expected/sql-dynalloc.c
M src/interfaces/ecpg/test/expected/sql-dynalloc2.c
M src/interfaces/ecpg/test/expected/sql-dyntest.c
M src/interfaces/ecpg/test/expected/sql-indicators.c
M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/expected/thread-alloc.c
M src/interfaces/ecpg/test/expected/thread-descriptor.c
M src/interfaces/ecpg/test/expected/thread-prep.c
M src/interfaces/ecpg/test/regression.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-events.h
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/win32.c
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/plpy_exec.c
M src/pl/tcl/pltcl.c
M src/port/crypt.c
M src/port/dirmod.c
M src/port/getaddrinfo.c
M src/port/getopt.c
M src/port/getopt_long.c
M src/port/getrusage.c
M src/port/gettimeofday.c
M src/port/inet_aton.c
M src/port/mkdtemp.c
M src/port/thread.c
M src/port/win32error.c
M src/port/win32setlocale.c
M src/test/modules/worker_spi/worker_spi.c
M src/test/regress/pg_regress.h
M src/test/regress/regress.c
M src/timezone/localtime.c
M src/timezone/pgtz.h
M src/timezone/strftime.c
M src/timezone/zic.c
M src/tools/ifaddrs/test_ifaddrs.c
M src/tools/testint128.c
M src/tutorial/complex.c
M src/tutorial/funcs.c

Adjust pgindent script to use pg_bsd_indent 2.0.

commit   : 8ff6d4ec7840b0af56f1207073f44b7f2afae96d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Jun 2017 14:26:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Jun 2017 14:26:21 -0400    

Click here for diff

Update version-checking code and list of switches.  Delete obsolete  
quasi-support for using GNU indent.  Remove a lot of no-longer-needed  
workarounds for bugs of the old version, and improve comments for  
the hacks that remain.  Update run_build() subroutine to fetch the  
pg_bsd_indent code from the newly established git repo for it.  
  
In passing, fix pgindent to not overwrite files that require no changes;  
this makes it a bit more friendly to run on a built tree.  
  
Adjust relevant documentation.  
  
Remove indent.bsd.patch; it's not relevant anymore (and was obsolete  
long ago anyway).  Likewise remove pgcppindent, since we're no longer  
in the business of shipping C++ code.  
  
Piotr Stefaniak is responsible for most of the algorithmic changes  
to the pgindent script; I did the rest.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/pgindent/README
D src/tools/pgindent/indent.bsd.patch
D src/tools/pgindent/pgcppindent
M src/tools/pgindent/pgindent
M src/tools/pgindent/pgindent.man

Final pgindent run with old pg_bsd_indent (version 1.3).

commit   : 9ef2dbefc7fb3ac22e1528bc22a41a5c6c6a9539    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Jun 2017 14:09:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Jun 2017 14:09:24 -0400    

Click here for diff

This is just to have a clean basis for comparison with the results of  
the new version (which will indeed end up reverting some of these  
changes...)  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/objectaddress.c
M src/backend/optimizer/plan/createplan.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/time/snapmgr.c
M src/bin/pg_upgrade/check.c
M src/bin/psql/describe.c
M src/include/catalog/pg_proc.h
M src/include/nodes/parsenodes.h
M src/include/replication/reorderbuffer.h
M src/tools/pgindent/typedefs.list

Prevent table partitions from being turned into views.

commit   : bcbf392ec84362040faf72daad22c647c74e2b2a    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 21 Jun 2017 10:43:17 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 21 Jun 2017 10:43:17 +0100    

Click here for diff

A table partition must be a table, not a view, so don't allow a  
"_RETURN" rule to be added that would convert an existing table  
partition into a view.  
  
Amit Langote  
  
Discussion: https://postgr.es/m/CAEZATCVzFcAjZwC1bTFvJ09skB_sgkF4SwPKMywev-XTnimp9Q%40mail.gmail.com  

M src/backend/rewrite/rewriteDefine.c
M src/test/regress/expected/rules.out
M src/test/regress/sql/rules.sql

Fix typo in comment.

commit   : ba1f017069dd87d309e2716bf08a40df42b29baa    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 21 Jun 2017 11:55:07 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 21 Jun 2017 11:55:07 +0300    

Click here for diff

Etsuro Fujita  

M src/backend/executor/execMain.c

Make opr_sanity test complain about built-in functions marked prosecdef.

commit   : d412f79381935186dc8f95fd2dc30227a82f012f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Jun 2017 17:06:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Jun 2017 17:06:43 -0400    

Click here for diff

Currently, there are no built-in functions that are SECURITY DEFINER.  
But we just found an instance where one was mistakenly marked that way,  
so it seems prudent to add a test about it.  If we ever grow some  
functions that are intentionally SECURITY DEFINER, we can alter the  
expected output of this test, or adjust the query to filter out functions  
for which it's okay.  
  
Per suggestion from Robert Haas.  
  
Discussion: https://postgr.es/m/CA+TgmoYXg7McY33+jbWmG=rS-HNUur0S6W8Q8kVNFf7epFimVA@mail.gmail.com  

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

Fix typo in code comment

commit   : 15c91568cfa4777892207a85000fdfd72b59b677    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Jun 2017 14:31:29 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Jun 2017 14:31:29 -0400    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

M src/backend/catalog/partition.c

Upgrade documentation connected with shared_preload_libraries et al.

commit   : ba63dbd9edc0d58e5f0891ead979674b1b45ad17    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Jun 2017 13:39:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Jun 2017 13:39:57 -0400    

Click here for diff

Noplace in the documentation actually defined what these variables  
contain.  Define them as lists of arguments for LOAD, and improve  
that command's documentation a bit.  
  
Discussion: https://postgr.es/m/CAB-oJtxHVDc3H+Km3CjB9mY1VDzuyaVH_ZYSz7iXcRqCtb93Ew@mail.gmail.com  

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

pg_upgrade: start/stop new server after pg_resetwal

commit   : b710248dd3f90c46bd4208e6bf1290048b9d76cd    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 20 Jun 2017 13:20:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 20 Jun 2017 13:20:02 -0400    

Click here for diff

When commit 0f33a719fdbb5d8c43839ea0d2c90cd03e2af2d2 removed the  
instructions to start/stop the new cluster before running rsync, it was  
now possible for pg_resetwal/pg_resetxlog to leave the final WAL record  
at wal_level=minimum, preventing upgraded standby servers from  
reconnecting.  
  
This patch fixes that by having pg_upgrade unconditionally start/stop  
the new cluster after pg_resetwal/pg_resetxlog has run.  
  
Backpatch through 9.2 since, though the instructions were added in PG  
9.5, they worked all the way back to 9.2.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.2  

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

Don't downcase entries within shared_preload_libraries et al.

commit   : a69dfe5f40f77d586e8d4d9ecfc39d81612c7dda    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Jun 2017 13:02:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Jun 2017 13:02:42 -0400    

Click here for diff

load_libraries(), which processes the various xxx_preload_libraries GUCs,  
was parsing them using SplitIdentifierString() which isn't really  
appropriate for values that could be path names: it downcases unquoted  
text, and it doesn't allow embedded whitespace unless quoted.  
Use SplitDirectoriesString() instead.  That also allows us to simplify  
load_libraries() a bit, since canonicalize_path() is now done for it.  
  
While this definitely seems like a bug fix, it has the potential to  
break configuration settings that accidentally worked before because  
of the downcasing behavior.  Also, there's an easy workaround for the  
bug, namely to double-quote troublesome text.  Hence, no back-patch.  
  
QL Zhuo, tweaked a bit by me  
  
Discussion: https://postgr.es/m/CAB-oJtxHVDc3H+Km3CjB9mY1VDzuyaVH_ZYSz7iXcRqCtb93Ew@mail.gmail.com  

M src/backend/utils/adt/varlena.c
M src/backend/utils/init/miscinit.c

Tweak publication fetching in psql

commit   : a2141c42f9ebc51b4501a4fafea9dd3fb7eda23d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Jun 2017 12:25:07 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Jun 2017 12:25:07 -0400    

Click here for diff

Viewing a table with \d in psql also shows the publications at table is  
in.  If a publication is concurrently dropped, this shows an error,  
because the view pg_publication_tables internally uses  
pg_get_publication_tables(), which uses a catalog snapshot.  This can be  
particularly annoying if a for-all-tables publication is concurrently  
dropped.  
  
To avoid that, write the query in psql differently.  Expose the function  
pg_relation_is_publishable() to SQL and write the query using that.  
That still has a risk of being affected by concurrent catalog changes,  
but in this case it would be a table drop that causes problems, and then  
the psql \d command wouldn't be interesting anymore anyway.  
  
Reported-by: Tom Lane <[email protected]>  

M src/backend/catalog/pg_publication.c
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h

Change pg_get_publication_tables to prosecdef false

commit   : 20d7d68b098dde6106e6c382e787c8b10c4403df    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Jun 2017 10:03:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Jun 2017 10:03:35 -0400    

Click here for diff

This was apparently a mistake in the original commit.  
  
Reported-by: Tom Lane <[email protected]>  

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

Fix materialized-view documentation oversights.

commit   : d14c85ed1abb5d01b10313715ab73aadb9a7a7af    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Jun 2017 18:32:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Jun 2017 18:32:22 -0400    

Click here for diff

When materialized views were added, psql's \d commands were made to  
treat them as a separate object category ... but not everyplace in the  
documentation or comments got the memo.  
  
Noted by David Johnston.  Back-patch to 9.3 where matviews came in.  
  
Discussion: https://postgr.es/m/CAKFQuwb27M3VXRhHErjCpkWwN9eKThbqWb1=trtoXi9_ejqPXQ@mail.gmail.com  

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

doc: Improve logical replication security setup info

commit   : 1c25ef6363f38253e5ac080373eef7f3305fa5dc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Jun 2017 17:30:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Jun 2017 17:30:52 -0400    

Click here for diff

Reported-by: Jeff Janes <[email protected]>  

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

Avoid regressions in foreign-key-based selectivity estimates.

commit   : d8e6b84bd2ac045cdbae231012ab5ea4471a02cd    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Jun 2017 15:33:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Jun 2017 15:33:41 -0400    

Click here for diff

David Rowley found that the "use the smallest per-column selectivity"  
heuristic applied in some cases by get_foreign_key_join_selectivity()  
was badly off if the FK columns are independent, producing estimates  
much worse than we got before that code was added in 9.6.  
  
One case where that heuristic was used was for LEFT and FULL outer joins  
with the referenced rel on the outside of the join.  But we should not  
really need to special-case those here.  eqjoinsel() never has had such a  
special case; the correction is applied by calc_joinrel_size_estimate()  
instead.  Let's just estimate such cases like inner joins and rely on that  
later adjustment.  (I think there was something of a thinko here, in that  
the comments seem to be thinking about the selectivity as defined for  
semi/anti joins; but that shouldn't apply to left/full joins.)  Add a  
regression test exercising such a case to show that this is sane in  
at least some cases.  
  
The other case where we used that heuristic was for SEMI/ANTI outer joins,  
either if the referenced rel was on the outside, or if it was on the inside  
but was part of a join within the RHS.  In either case, the FK doesn't give  
us a lot of traction towards estimating the selectivity.  To ensure that  
we don't have regressions from what happened before 9.6, let's punt by  
ignoring the FK in such cases and applying the traditional selectivity  
calculation.  (We might be able to improve on that later, but for now  
I just want to be sure it's not worse than 9.5.)  
  
Report and patch by David Rowley, simplified a bit by me.  Back-patch  
to 9.6 where this code was added.  
  
Discussion: https://postgr.es/m/CAKJS1f8NO8oCDcxrteohG6O72uU1saEVT9qX=R8pENr5QWerXw@mail.gmail.com  

M src/backend/optimizer/path/costsize.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

On Windows, make pg_dump use binary mode for compressed plain text output.

commit   : bd61d5a194ac24f0c282ed414e1378846f78dee4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Jun 2017 11:02:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Jun 2017 11:02:45 -0400    

Click here for diff

The combination of -Z -Fp and output to stdout resulted in corrupted  
output data, because we left stdout in text mode, resulting in newline  
conversion being done on the compressed stream.  Switch stdout to binary  
mode for this case, at the same place where we do it for non-text output  
formats.  
  
Report and patch by Kuntal Ghosh, tested by Ashutosh Sharma and Neha  
Sharma.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAGz5QCJPvbBjXAmJuGx1B_41yVCetAJhp7rtaDf7XQGWuB1GSw@mail.gmail.com  

M src/bin/pg_dump/pg_backup_archiver.c

Fix leaking of small spilled subtransactions during logical decoding.

commit   : 3bdea167eb01491a4898e977d308508374e97bfa    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 18 Jun 2017 18:48:22 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 18 Jun 2017 18:48:22 -0700    

Click here for diff

When, during logical decoding, a transaction gets too big, it's  
contents get spilled to disk. Not just the top-transaction gets  
spilled, but *also* all of its subtransactions, even if they're not  
that large themselves.  Unfortunately we didn't clean up  
such small spilled subtransactions from disk.  
  
Fix that, by keeping better track of whether a transaction has been  
spilled to disk.  
  
Author: Andres Freund  
Reported-By: Dmitriy Sarafannikov, FabrĆ­zio de Royes Mello  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/CAFcNs+qNMhNYii4nxpO6gqsndiyxNDYV0S=JNq0v_sEE+9PHXg@mail.gmail.com  
Backpatch: 9.4-, where logical decoding was introduced  

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

Improve PostgreSQL 10.0 release note regarding pg_current_logfile().

commit   : b4166a8df914f56b3b7d2dc1b74897e7525c5cea    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Mon, 19 Jun 2017 09:10:18 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Mon, 19 Jun 2017 09:10:18 +0900    

Click here for diff

Author: Yugo Nagata  

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

Documentation spell checking and markup improvements

commit   : bbaf9e8f840acb8e4a52dc1809bd2c9b320e9df8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 18 Jun 2017 14:01:45 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 18 Jun 2017 14:01:45 -0400    

Click here for diff

M doc/src/sgml/adminpack.sgml
M doc/src/sgml/amcheck.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/generic-wal.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/create_statistics.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/explain.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/release-10.sgml
M doc/src/sgml/user-manag.sgml
M doc/src/sgml/xfunc.sgml

Fix copy/paste error in docs

commit   : 81a4dcf2f2f92dc01ce0cf318dc9fabfb3021bd7    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 18 Jun 2017 19:41:46 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 18 Jun 2017 19:41:46 +0200    

Click here for diff

Author: Julien Rouhaud <[email protected]>  

M doc/src/sgml/ref/drop_publication.sgml

doc: Fix typo

commit   : f6da23f526cf622d2dbcee47695b4aedf8ab2c69    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 17 Jun 2017 19:03:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 17 Jun 2017 19:03:12 -0400    

Click here for diff

Author: Julien Rouhaud <[email protected]>  

M doc/src/sgml/planstats.sgml

doc: Fix typo

commit   : 806dccee23dfa3dd3b326354255cf0d5cb032f02    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 17 Jun 2017 10:21:41 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 17 Jun 2017 10:21:41 -0400    

Click here for diff

Author: Julien Rouhaud <[email protected]>  

M doc/src/sgml/ref/create_subscription.sgml

Set statement timestamp in apply worker

commit   : 033370179a6d15b2e1b519462d14419d6dc84e73    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 17 Jun 2017 08:54:21 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 17 Jun 2017 08:54:21 -0400    

Click here for diff

This ensures that triggers can see an up-to-date timestamp.  
  
Reported-by: Konstantin Evteev <[email protected]>  

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

Remove incorrect comment

commit   : 7f5cb14e3c507973392e90b25cb4d36932dd42da    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 17 Jun 2017 10:19:48 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 17 Jun 2017 10:19:48 +0200    

Click here for diff

Author: Michael Paquier <[email protected]>  

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

Fix typos in comments

commit   : bb1f8f9e5bb13af43ab65faa98ae898a68995070    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 17 Jun 2017 10:17:01 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 17 Jun 2017 10:17:01 +0200    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M src/backend/access/transam/xlogfuncs.c
M src/include/lib/simplehash.h
M src/include/nodes/execnodes.h

Define HAVE_UCOL_STRCOLLUTF8 on Windows

commit   : e42645ad92687a2250ad17e1a045da73e54a5064    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Jun 2017 21:23:22 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Jun 2017 21:23:22 -0400    

Click here for diff

This should normally be determined by a configure check, but until  
someone figures out how to do that on Windows, it's better that the code  
uses the new function by default.  

M src/include/pg_config.h.win32

Teach pgindent to skip files generated by bison or flex automatically.

commit   : cea258b63d9c7a6d0a7c5e91e539bb89df4bc078    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Jun 2017 23:14:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Jun 2017 23:14:27 -0400    

Click here for diff

If a .c or .h file corresponds to a .y or .l file, skip indenting it.  
There's no point in reindenting derived files, and these files tend to  
confuse pgindent.  (Which probably indicates a bug in BSD indent, but  
I can't get excited about trying to fix it.)  
  
For the same reasons, add src/backend/utils/fmgrtab.c to the set of  
files excluded by src/tools/pgindent/exclude_file_patterns.  
  
The point of doing this is that it makes it safe to run pgindent over  
the tree without doing "make maintainer-clean" first.  While these are  
not the only derived .c/.h files in the tree, they are the only ones  
pgindent fails on.  Removing that prerequisite step results in one less  
way to mess up a pgindent run, and it's necessary if we ever hope to get  
to the ease of running pgindent via "make indent".  

M src/tools/pgindent/README
M src/tools/pgindent/exclude_file_patterns
M src/tools/pgindent/pgindent

doc: Add note that COPY commands are published as INSERTs

commit   : 57fb1d677d98d9c02565e47afdbf5e887b095c9f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Jun 2017 21:04:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Jun 2017 21:04:34 -0400    

Click here for diff

M doc/src/sgml/ref/create_publication.sgml

Use RangeVarGetRelidExtended() in AlterSequence()

commit   : 94da2a6a9a05776953524424a3d8079e54bc5d94    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 14:58:17 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 14:58:17 -0400    

Click here for diff

This allows us to combine the opening and the ownership check.  
  
Reported-by: Robert Haas <[email protected]>  

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

Fix ICU collation use on Windows

commit   : 41839b7abc85f21dd7ce76ab9cd1d7533c53cf9c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Jun 2017 10:08:54 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Jun 2017 10:08:54 -0400    

Click here for diff

Windows uses a separate code path for libc locales.  The code previously  
ended up there also if an ICU collation should be used, leading to a  
crash.  
  
Reported-by: Ashutosh Sharma <[email protected]>  

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

doc: Add section about logical replication restrictions

commit   : 3ef97e725e2cbb050ff2e88adc36299bafa188c4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Jun 2017 09:55:55 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Jun 2017 09:55:55 -0400    

Click here for diff

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

Fix dependency, when changing a function's argument/return type.

commit   : 30681c830d69ca88cf66105c94e63d3e4d905681    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 16 Jun 2017 11:33:12 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 16 Jun 2017 11:33:12 +0300    

Click here for diff

When a new base type is created using the old-style procedure of first  
creating the input/output functions with "opaque" in place of the base  
type, the "opaque" argument/return type is changed to the final base type,  
on CREATE TYPE. However, we did not create a pg_depend record when doing  
that, so the functions were left not depending on the type.  
  
Fixes bug #14706, reported by Karen Huddleston.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Reconcile nodes/*funcs.c with PostgreSQL 10 work.

commit   : 39ac55918fc31b9bf88185d28ebe7ddc58d01181    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 16 Jun 2017 00:16:11 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 16 Jun 2017 00:16:11 -0700    

Click here for diff

The _equalTableFunc() omission of coltypmods has semantic significance,  
but I did not track down resulting user-visible bugs, if any.  The other  
changes are cosmetic only, affecting order.  catversion bump due to  
readfuncs.c field order change.  

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

Make configure check for IPC::Run when --enable-tap-tests is specified.

commit   : c254970ad6092d201443cced570450d5b29d4234    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Jun 2017 15:56:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Jun 2017 15:56:12 -0400    

Click here for diff

The TAP tests mostly don't work without IPC::Run, and the reason for  
the failure is not immediately obvious from the error messages you get.  
So teach configure to reject --enable-tap-tests unless IPC::Run exists.  
Mostly this just involves adding ax_prog_perl_modules.m4 from the GNU  
autoconf archives.  
  
This was discussed last year, but we held off on the theory that we might  
be switching to CMake soon.  That's evidently not happening for v10,  
so let's absorb this now.  
  
Eugene Kazakov and Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAB7nPqRVKG_CR4Dy_AMfE6DXcr6F7ygy2goa2atJU4XkerDRUg@mail.gmail.com  

M aclocal.m4
A config/ax_prog_perl_modules.m4
M configure
M configure.in

Fix low-probability leaks of PGresult objects in the backend.

commit   : a3bed62d44f83283414a82717bc8e96e9f398dcc    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Jun 2017 15:03:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Jun 2017 15:03:39 -0400    

Click here for diff

We had three occurrences of essentially the same coding pattern  
wherein we tried to retrieve a query result from a libpq connection  
without blocking.  In the case where PQconsumeInput failed (typically  
indicating a lost connection), all three loops simply gave up and  
returned, forgetting to clear any previously-collected PGresult  
object.  Since those are malloc'd not palloc'd, the oversight results  
in a process-lifespan memory leak.  
  
One instance, in libpqwalreceiver, is of little significance because  
the walreceiver process would just quit anyway if its connection fails.  
But we might as well fix it.  
  
The other two instances, in postgres_fdw, are somewhat more worrisome  
because at least in principle the scenario could be repeated, allowing  
the amount of memory leaked to build up to something worth worrying  
about.  Moreover, in these cases the loops contain CHECK_FOR_INTERRUPTS  
calls, as well as other calls that could potentially elog(ERROR),  
providing another way to exit without having cleared the PGresult.  
Here we need to add PG_TRY logic similar to what exists in quite a  
few other places in postgres_fdw.  
  
Coverity noted the libpqwalreceiver bug; I found the other two cases  
by checking all calls of PQconsumeInput.  
  
Back-patch to all supported versions as appropriate (9.2 lacks  
postgres_fdw, so this is really quite unexciting for that branch).  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/connection.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

doc: remove mention of Windows junction points by pg_upgrade

commit   : 07fb943335f3cdd11a9146ae6fdee237cc83c5f6    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 15 Jun 2017 13:25:45 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 15 Jun 2017 13:25:45 -0400    

Click here for diff

pg_upgrade never used Windows junction points but instead always used  
Windows hard links.  
  
Reported-by: Adrian Klaver  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.3, where the mention first appeared  

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

docs: Fix pg_upgrade standby server upgrade docs

commit   : 0f33a719fdbb5d8c43839ea0d2c90cd03e2af2d2    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 15 Jun 2017 12:30:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 15 Jun 2017 12:30:02 -0400    

Click here for diff

It was unsafe to instruct users to start/stop the server after  
pg_upgrade was run but before the standby servers were rsync'ed.  The  
new instructions avoid this.  
  
RELEASE NOTES:  This fix should be mentioned in the minor release notes.  
  
Reported-by: Dmitriy Sarafannikov and Sergey Burladyan  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5, where standby server upgrade instructions first appeared  

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

Rename function for consistency

commit   : 3ab7912c18b6df4d6843d0e0cd6183e7f4912cbb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 15 Jun 2017 11:44:33 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 15 Jun 2017 11:44:33 -0400    

Click here for diff

Avoid using prefix "staext" when everything else uses "statext".  
  
Author: Kyotaro HORIGUCHI  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/statistics/dependencies.c
M src/include/statistics/statistics.h

psql: Improve display of "for all tables" publications

commit   : 915379c3c2613f2b24d4e9c6fa79a43e7c6a86ec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 15 Jun 2017 10:46:41 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 15 Jun 2017 10:46:41 -0400    

Click here for diff

Show "All tables" property in \dRp and \dRp+.  Don't list tables for  
such publications in \dRp+, since it's redundant and the list could be  
very long.  
  
Author: Masahiko Sawada <[email protected]>  
Author: Jeff Janes <[email protected]>  

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

Fix typo in code comment

commit   : 6c6a1149b5662f685ddbb0c6dc83eb110992044a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 15 Jun 2017 09:45:13 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 15 Jun 2017 09:45:13 -0400    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M src/interfaces/ecpg/pgtypeslib/datetime.c

Remove unnecessary IPC::Run inclusion

commit   : 878b7d9eaa9cbf5f121f9ee8676d82b22decedf0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 15 Jun 2017 09:19:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 15 Jun 2017 09:19:12 -0400    

Click here for diff

This is no longer needed because the tests use PostgresNode.  
  
Reported-by: Michael Paquier <[email protected]>  

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

Fix typo in PostgreSQL 10.0 release note.

commit   : e800656d9a9b40b2f55afabe76354ab6d93353b3    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Thu, 15 Jun 2017 11:24:47 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Thu, 15 Jun 2017 11:24:47 +0900    

Click here for diff

Patch by Yugo Nagata.  

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

Fix document bug regarding read only transactions.

commit   : 6108348c09df33773bed6e0ac762fe47bdcbb9e6    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Thu, 15 Jun 2017 10:01:39 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Thu, 15 Jun 2017 10:01:39 +0900    

Click here for diff

It was explained that read only transactions (not in standby) allow to  
update sequences. This had been wrong since the commit:  
05d8a561ff85db1545f5768fe8d8dc9d99ad2ef7  
  
Discussion: https://www.postgresql.org/message-id/20170614.110826.425627939780392324.t-ishii%40sraoss.co.jp  

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

commit   : f32d57fd7088a558dadbe21b9859b09d2f877c19    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 14 Jun 2017 16:19:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 14 Jun 2017 16:19:46 -0400    

Click here for diff

Commit 18ce3a4ab22d2984f8540ab480979c851dae5338 failed to update  
the comments in parsenodes.h for the new members, and made only  
incomplete updates to src/backend/nodes  
  
Thomas Munro, per a report from Noah Misch.  
  
Discussion: http://postgr.es/m/[email protected]  

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/nodes/parsenodes.h

Don't force-assign transaction id when exporting a snapshot.

commit   : 6c2003f8a1bbc7c192a2e83ec51581c018aa162f    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 14 Jun 2017 11:57:21 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 14 Jun 2017 11:57:21 -0700    

Click here for diff

Previously we required every exported transaction to have an xid  
assigned. That was used to check that the exporting transaction is  
still running, which in turn is needed to guarantee that that  
necessary rows haven't been removed in between exporting and importing  
the snapshot.  
  
The exported xid caused unnecessary problems with logical decoding,  
because slot creation has to wait for all concurrent xid to finish,  
which in turn serializes concurrent slot creation.   It also  
prohibited snapshots to be exported on hot-standby replicas.  
  
Instead export the virtual transactionid, which avoids the unnecessary  
serialization and the inability to export snapshots on standbys. This  
changes the file name of the exported snapshot, but since we never  
documented what that one means, that seems ok.  
  
Author: Petr Jelinek, slightly editorialized by me  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/set_transaction.sgml
M src/backend/replication/logical/snapbuild.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/time/snapmgr.c
M src/include/storage/predicate.h
M src/include/storage/procarray.h

Use DEFACLOBJ_ macros in error message instead of hardcoding

commit   : b6966d4627c0297ad42fe2592c66ac2f76e9962e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Jun 2017 14:44:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Jun 2017 14:44:24 -0400    

Click here for diff

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/object_address.out

Add missing serial comma

commit   : 4e88fe8f8f148a45feacb50c2eaed9ca9ddea8bb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Jun 2017 14:43:54 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Jun 2017 14:43:54 -0400    

Click here for diff

M src/bin/pg_basebackup/pg_basebackup.c

doc: Whitespace fixes in man pages

commit   : f0cfff9da2c577a19dd6a15ffc7b404693b700bc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Jun 2017 13:55:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Jun 2017 13:55:43 -0400    

Click here for diff

M doc/src/sgml/ref/alter_aggregate.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/alter_system.sgml
M doc/src/sgml/ref/alter_type.sgml
M doc/src/sgml/ref/create_access_method.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/drop_aggregate.sgml
M doc/src/sgml/ref/drop_policy.sgml
M doc/src/sgml/ref/drop_publication.sgml
M doc/src/sgml/ref/drop_statistics.sgml
M doc/src/sgml/ref/drop_subscription.sgml
M doc/src/sgml/ref/import_foreign_schema.sgml
M doc/src/sgml/ref/insert.sgml

Teach predtest.c about CHECK clauses to fix partitioning bugs.

commit   : b08df9cab777427fdafe633ca7b8abf29817aa55    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 14 Jun 2017 13:13:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 14 Jun 2017 13:13:11 -0400    

Click here for diff

In a CHECK clause, a null result means true, whereas in a WHERE clause  
it means false.  predtest.c provided different functions depending on  
which set of semantics applied to the predicate being proved, but had  
no option to control what a null meant in the clauses provided as  
axioms.  Add one.  
  
Use that in the partitioning code when figuring out whether the  
validation scan on a new partition can be skipped.  Rip out the  
old logic that attempted (not very successfully) to compensate  
for the absence of the necessary support in predtest.c.  
  
Ashutosh Bapat and Robert Haas, reviewed by Amit Langote and  
incorporating feedback from Tom Lane.  
  
Discussion: http://postgr.es/m/CAFjFpReT_kq_uwU_B8aWDxR7jNGE=P0iELycdq5oupi=xSQTOw@mail.gmail.com  

M src/backend/commands/tablecmds.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/utils/adt/selfuncs.c
M src/include/optimizer/predtest.h
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Improve release note text about set-returning-function changes.

commit   : a12c09ad86e60a8acb269744b8ee86429dda2cd8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Jun 2017 11:44:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Jun 2017 11:44:34 -0400    

Click here for diff

Paul Ramsey griped about this awhile ago, but I'd been holding fire  
on changing it until we settled what to do about the CASE/COALESCE  
issue.  
  
Discussion: https://postgr.es/m/CACowWR0AMyUt5fwtvuDqWyYNdp-hQJj9XqSxJR6YM9sKWov=_w@mail.gmail.com  

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

Avoid bogus TwoPhaseState locking sequences

commit   : e90ceeaa495f5f40f224bcf84d2b0700eae8d7a3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 14 Jun 2017 11:29:05 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 14 Jun 2017 11:29:05 -0400    

Click here for diff

The optimized code in 728bd991c3c4 contains a few invalid locking  
sequences.  To wit, the original code would try to acquire an lwlock  
that it already holds.  Avoid this by moving lock acquisitions to  
higher-level code, and install appropriate assertions in low-level that  
the correct mode is held.  
  
Authors: Michael Paquier, Ɓlvaro Herrera  
Reported-By: chuanting wang  
Bug: #14680  
Discussion: https://postgr.es/m/[email protected]  

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

Put documentation of options and commands in more alphabetical order

commit   : 0d9bdbcaae00dac89a82c25e66e4a859130e2fe8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Jun 2017 11:09:33 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Jun 2017 11:09:33 -0400    

Click here for diff

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

Fix no-longer-valid shortcuts in expression_returns_set().

commit   : 8e72239e9d961c27f02b242e33fa832c364c7a4b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Jun 2017 11:10:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Jun 2017 11:10:05 -0400    

Click here for diff

expression_returns_set() used to short-circuit its recursion upon  
seeing certain node types, such as DistinctExpr, that it knew the  
executor did not support set-valued arguments for.  That was never  
inherent, though, just a reflection of laziness in execQual.c.  
With the new implementation of SRFs there is no reason to think  
that any scalar-valued expression node could not have a set-valued  
subexpression, except for AggRefs and WindowFuncs where we know there  
is a parser check rejecting it.  And indeed, the shortcut causes  
unexpected failures for cases such as a SRF underneath DistinctExpr,  
because the planner stops looking for SRFs too soon.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/nodeFuncs.c
M src/test/regress/expected/tsrf.out
M src/test/regress/sql/tsrf.sql

Fix violations of CatalogTupleInsert/Update/Delete abstraction.

commit   : a571c7f661a7b601aafcb12196d004cdb8b8cb23    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Jun 2017 10:26:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Jun 2017 10:26:46 -0400    

Click here for diff

In commits 2f5c9d9c9 and ab0289651 we invented an abstraction layer  
to insulate catalog manipulations from direct heap update calls.  
But evidently some patches that hadn't landed in-tree at that point  
didn't get the memo completely.  Fix a couple of direct calls to  
simple_heap_delete to use CatalogTupleDelete instead; these appear  
to have been added in commits 7c4f52409 and 7b504eb28.  This change is  
purely cosmetic ATM, but there's no point in having an abstraction layer  
if we allow random code to break it.  
  
Masahiko Sawada and Tom Lane  
  
Discussion: https://postgr.es/m/CAD21AoDOPRSVcwbnCN3Y1n_68ATyTspsU6=ygtHz_uY0VcdZ8A@mail.gmail.com  

M src/backend/catalog/pg_subscription.c
M src/backend/commands/statscmds.c

Teach PL/pgSQL about partitioned tables.

commit   : d3c3f2b1e25cc96d3078bf4d47a2f58fefb70560    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 14 Jun 2017 09:00:01 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 14 Jun 2017 09:00:01 +0100    

Click here for diff

Table partitioning, introduced in commit f0e44751d7, added a new  
relkind - RELKIND_PARTITIONED_TABLE. Update a couple of places in  
PL/pgSQL to handle it. Specifically plpgsql_parse_cwordtype() and  
build_row_from_class() needed updating in order to make table%ROWTYPE  
and table.col%TYPE work for partitioned tables.  
  
Dean Rasheed, reviewed by Amit Langote.  
  
Discussion: https://postgr.es/m/CAEZATCUnNOKN8sLML9jUzxecALWpEXK3a3W7y0PgFR4%2Buhgc%3Dg%40mail.gmail.com  

M src/pl/plpgsql/src/pl_comp.c
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Teach RemoveRoleFromObjectPolicy() about partitioned tables.

commit   : f356ec57444e42e53474ad5a029cdf6dca195069    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 14 Jun 2017 08:43:40 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 14 Jun 2017 08:43:40 +0100    

Click here for diff

Table partitioning, introduced in commit f0e44751d7, added a new  
relkind - RELKIND_PARTITIONED_TABLE. Update  
RemoveRoleFromObjectPolicy() to handle it, otherwise DROP OWNED BY  
will fail if the role has any RLS policies referring to partitioned  
tables.  
  
Dean Rasheed, reviewed by Amit Langote.  
  
Discussion: https://postgr.es/m/CAEZATCUnNOKN8sLML9jUzxecALWpEXK3a3W7y0PgFR4%2Buhgc%3Dg%40mail.gmail.com  

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

Disallow set-returning functions inside CASE or COALESCE.

commit   : 0436f6bde8848b7135f19dd7f8548b8c2ae89a34    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Jun 2017 23:46:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Jun 2017 23:46:39 -0400    

Click here for diff

When we reimplemented SRFs in commit 69f4b9c85, our initial choice was  
to allow the behavior to vary from historical practice in cases where a  
SRF call appeared within a conditional-execution construct (currently,  
only CASE or COALESCE).  But that was controversial to begin with, and  
subsequent discussion has resulted in a consensus that it's better to  
throw an error instead of executing the query differently from before,  
so long as we can provide a reasonably clear error message and a way to  
rewrite the query.  
  
Hence, add a parser mechanism to allow detection of such cases during  
parse analysis.  The mechanism just requires storing, in the ParseState,  
a pointer to the set-returning FuncExpr or OpExpr most recently emitted  
by parse analysis.  Then the parsing functions for CASE and COALESCE can  
detect the presence of a SRF in their arguments by noting whether this  
pointer changes while analyzing their arguments.  Furthermore, if it does,  
it provides a suitable error cursor location for the complaint.  (This  
means that if there's more than one SRF in the arguments, the error will  
point at the last one to be analyzed not the first.  While connoisseurs of  
parsing behavior might find that odd, it's unlikely the average user would  
ever notice.)  
  
While at it, we can also provide more specific error messages than before  
about some pre-existing restrictions, such as no-SRFs-within-aggregates.  
Also, reject at parse time cases where a NULLIF or IS DISTINCT FROM  
construct would need to return a set.  We've never supported that, but the  
restriction is depended on in more subtle ways now, so it seems wise to  
detect it at the start.  
  
Also, provide some documentation about how to rewrite a SRF-within-CASE  
query using a custom wrapper SRF.  
  
It turns out that the information_schema.user_mapping_options view  
contained an instance of exactly the behavior we're now forbidding; but  
rewriting it makes it more clear and safer too.  
  
initdb forced because of user_mapping_options change.  
  
Patch by me, with error message suggestions from Alvaro Herrera and  
Andres Freund, pursuant to a complaint from Regina Obe.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/xfunc.sgml
M src/backend/catalog/information_schema.sql
M src/backend/executor/functions.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_oper.c
M src/include/catalog/catversion.h
M src/include/parser/parse_func.h
M src/include/parser/parse_node.h
M src/include/parser/parse_oper.h
M src/test/regress/expected/create_table.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/expected/tsrf.out
M src/test/regress/sql/rangefuncs.sql
M src/test/regress/sql/tsrf.sql

doc: Update example version numbers in pg_upgrade documentation

commit   : 39da0f709db4d9f16f46be56ae401df72aab93c0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 16:10:11 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 16:10:11 -0400    

Click here for diff

The exact numbers don't matter, since they are examples, but it was  
looking quite dated.  
  
For the target version, we now automatically substitute the current  
major version.  The updated example source version should be good for a  
couple of years.  

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

psql: Use more consistent capitalization of some output headings

commit   : 272171279f8676c57b3a8edf7daf792ad55b2c2c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 14:38:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 14:38:35 -0400    

Click here for diff

M contrib/hstore_plperl/expected/create_transform.out
M contrib/postgres_fdw/expected/postgres_fdw.out
M src/bin/psql/describe.c
M src/test/modules/test_extensions/expected/test_extensions.out
M src/test/modules/test_extensions/sql/test_extensions.sql
M src/test/regress/expected/foreign_data.out

Re-run pgindent.

commit   : 651902deb1551db8b401fdeab9bdb8a61cee7f9f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Jun 2017 13:05:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Jun 2017 13:05:59 -0400    

Click here for diff

This is just to have a clean base state for testing of Piotr Stefaniak's  
latest version of FreeBSD indent.  I fixed up a couple of places where  
pgindent would have changed format not-nicely.  perltidy not included.  
  
Discussion: https://postgr.es/m/VI1PR03MB119959F4B65F000CA7CD9F6BF2CC0@VI1PR03MB1199.eurprd03.prod.outlook.com  

M src/backend/access/brin/brin_pageops.c
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/catalog/index.c
M src/backend/commands/copy.c
M src/backend/commands/vacuumlazy.c
M src/backend/commands/variable.c
M src/backend/executor/execMain.c
M src/backend/executor/nodeModifyTable.c
M src/backend/libpq/auth-scram.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/storage/page/bufpage.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/bin/psql/describe.c
M src/include/storage/procsignal.h
M src/interfaces/ecpg/ecpglib/pg_type.h
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c

Always initialize PartitionBoundInfoData's null_index.

commit   : 096f1ccd5290286b135822bb282fa884454d4b69    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 13 Jun 2017 12:36:45 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 13 Jun 2017 12:36:45 -0400    

Click here for diff

This doesn't actually matter at present, because the current code  
never consults null_index for range partitions.  However, leaving  
it uninitialized is still a bad idea, so let's not do that.  
  
Amul Sul, reviewed by Ashutosh Bapat  
  
Discussion: http://postgr.es/m/CAAJ_b94AkEzcx+12ySCnbMDX7=UdF4BjnoBGfMQbB0RNSTo3Ng@mail.gmail.com  

M src/backend/catalog/partition.c

Teach relation_is_updatable() about partitioned tables.

commit   : b6263cd851ef245a5dc38119448e029ca1592da4    
  
author   : Dean Rasheed <[email protected]>    
date     : Tue, 13 Jun 2017 17:30:36 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Tue, 13 Jun 2017 17:30:36 +0100    

Click here for diff

Table partitioning, introduced in commit f0e44751d7, added a new  
relkind - RELKIND_PARTITIONED_TABLE. Update relation_is_updatable() to  
handle it. Specifically, partitioned tables and simple views built on  
top of them are updatable.  
  
This affects the SQL-callable functions pg_relation_is_updatable() and  
pg_column_is_updatable(), and the views information_schema.views and  
information_schema.columns.  
  
Dean Rasheed, reviewed by Ashutosh Bapat.  
  
Discussion: https://postgr.es/m/CAEZATCXnbiFkMXgF4Ez1pmM2c-tS1z33bSq7OGbw7QQhHov%2B6Q%40mail.gmail.com  

M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/updatable_views.sql

libpq: Message style improvements

commit   : 2e3fc7a7d322289c70f89199be0a5e899ec7d9b9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 11:53:26 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 11:53:26 -0400    

Click here for diff

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

Fix failure to remove dependencies when a partition is detached.

commit   : ee252f074b88e34ff7ac2b45a73d3cee12b1c671    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 13 Jun 2017 11:51:42 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 13 Jun 2017 11:51:42 -0400    

Click here for diff

Otherwise, dropping the partitioned table will automatically drop  
any previously-detached children, which would be unfortunate.  
  
Ashutosh Bapat and Rahila Syed, reviewed by Amit Langote and by me.  
  
Discussion: http://postgr.es/m/CAFjFpRdOwHuGj45i25iLQ4QituA0uH6RuLX1h5deD4KBZJ25yg@mail.gmail.com  

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

doc: Fix typo

commit   : 506b565831e6c88666c18a467377c2f98066ccac    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 11:28:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 11:28:52 -0400    

Click here for diff

Author: Julien Rouhaud <[email protected]>  

M doc/src/sgml/brin.sgml

In initdb, defend against assignment of NULL values to not-null columns.

commit   : b74701043e396a93f1f18098044741daaf75f761    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Jun 2017 10:54:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Jun 2017 10:54:39 -0400    

Click here for diff

Previously, you could write _null_ in a BKI DATA line for a column that's  
supposed to be NOT NULL and initdb would let it pass, probably breaking  
subsequent accesses to the row.  No doubt the original coding overlooked  
this simple sanity check because in the beginning we didn't have any way  
to mark catalog columns NOT NULL at initdb time.  

M src/backend/bootstrap/bootstrap.c

Fix typo

commit   : f2a886104a6683227bfcb0932dde97d30b123961    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 10:54:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 10:54:03 -0400    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

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

Improve code comments

commit   : 88c6cff8e71eccac00fe68f4c15530161b99e6c5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 10:43:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 10:43:36 -0400    

Click here for diff

Author: Erik Rijkers <[email protected]>  

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

Use correct ICU path for Windows 32 vs. 64 bit

commit   : ae1aa28eb6a0adb1ae0b36eb25a7d0ee2ee3db0b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 09:13:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 09:13:32 -0400    

Click here for diff

Author: Ashutosh Sharma <[email protected]>  

M src/tools/msvc/Solution.pm

Fix collprovider of predefined collations

commit   : ec7129b7812ce276520f749d0946875663c34093    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 08:55:09 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 08:55:09 -0400    

Click here for diff

An earlier version of the patch had collprovider as an integer and thus  
set these to 0, but the correct setting is now null.  

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

pg_dump: Allow dumping default collation

commit   : 4955109d2281eacec6af8aee203382ac3991f1cf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 08:52:48 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 08:52:48 -0400    

Click here for diff

This will not work on restore, but it will allow dumping out pg_catalog  
for research and documentation.  
  
Reported-by: Neil Anderson <[email protected]>  
Bug: #14701  

M src/bin/pg_dump/pg_dump.c

Prevent copying default collation

commit   : 17082a88eadfca79b50c04c5a78a2c38ee4f5d9c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 08:49:41 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Jun 2017 08:49:41 -0400    

Click here for diff

This will not have the desired effect and might lead to crashes when the  
copied collation is used.  
  
Reported-by: Tom Lane <[email protected]>  

M src/backend/commands/collationcmds.c

Fix confusion about number of subplans in partitioned INSERT setup.

commit   : 78a030a441966d91bc7e932ef84da39c3ea7d970    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Jun 2017 23:29:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Jun 2017 23:29:44 -0400    

Click here for diff

ExecInitModifyTable() thought there was a plan per partition, but no,  
there's only one.  The problem had escaped detection so far because there  
would only be visible misbehavior if there were a SubPlan (not an InitPlan)  
in the quals being duplicated for each partition.  However, valgrind  
detected a bogus memory access in test cases added by commit 4f7a95be2,  
and investigation of that led to discovery of the bug.  The additional  
test case added here crashes without the patch.  
  
Patch by Amit Langote, test case by me.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pg_dump: Fix harmless type mixup

commit   : 791ef001c9fe980e32092227a72ec24a7d66fa3d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 23:06:38 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 23:06:38 -0400    

Click here for diff

M src/bin/pg_dump/pg_dump.c

doc: Update external PL list

commit   : 2440c442d167d9d081a3e69c4fa78f3b6f8932e9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 22:34:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 22:34:04 -0400    

Click here for diff

Add PL/Lua, PL/v8.  
  
Remove stale/unmaintained PL/PHP, PL/Py, PL/Ruby, PL/Scheme.  
  
Reported-by: Adam Sah <[email protected]>  

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

Assert that we don't invent relfilenodes or type OIDs in binary upgrade.

commit   : 7332c3cbb39026e62f4bd0a8acf3df8f701a9e2f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Jun 2017 20:04:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Jun 2017 20:04:32 -0400    

Click here for diff

During pg_upgrade's restore run, all relfilenode choices should be  
overridden by commands in the dump script.  If we ever find ourselves  
choosing a relfilenode in the ordinary way, someone blew it.  Likewise for  
pg_type OIDs.  Since pg_upgrade might well succeed anyway, if there happens  
not to be a conflict during the regression test run, we need assertions  
here to keep us on the straight and narrow.  
  
We might someday be able to remove the assertion in GetNewRelFileNode,  
if pg_upgrade is rewritten to remove its assumption that old and new  
relfilenodes always match.  But it's hard to see how to get rid of the  
pg_type OID constraint, since those OIDs are embedded in user tables  
in some cases.  
  
Back-patch as far as 9.5, because of the risk of back-patches breaking  
something here even if it works in HEAD.  I'd prefer to go back further,  
but 9.4 fails both assertions due to get_rel_infos()'s use of a temporary  
table.  We can't use the later-branch solution of a CTE for compatibility  
reasons (cf commit 5d16332e9), and it doesn't seem worth inventing some  
other way to do the query.  (I did check, by dint of changing the Asserts  
to elog(WARNING), that there are no other cases of unwanted OID assignments  
during 9.4's regression test run.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/catalog.c

Fix ALTER SEQUENCE OWNED BY to not rewrite the sequence relation.

commit   : a475e46634dc7abde1d5a6fc7aaa708219383004    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Jun 2017 16:57:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Jun 2017 16:57:31 -0400    

Click here for diff

It's not necessary for it to do that, since OWNED BY requires only ordinary  
catalog updates and doesn't affect future sequence values.  And pg_upgrade  
needs to use OWNED BY without having it change the sequence's relfilenode.  
Commit 3d79013b9 broke this by making all forms of ALTER SEQUENCE change  
the relfilenode; that seems to be the explanation for the hard-to-reproduce  
buildfarm failures we've been seeing since then.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/sequence.c

doc: Update information_schema documentation for identity columns

commit   : 5d8beac8bee344bdf4b05a63b93f06e05d999b39    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 16:20:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 16:20:12 -0400    

Click here for diff

This was apparently forgotten in the original patch.  

M doc/src/sgml/information_schema.sgml

Add ICU_CFLAGS to global CPPFLAGS

commit   : 94c2ed0ebe005aa6389b02a61e3c16d08035299c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 15:57:22 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 15:57:22 -0400    

Click here for diff

The original code only added ICU_CFLAGS to the backend build.  But it is  
also needed for building external modules that include pg_locale.h.  So  
add it to the global CPPFLAGS.  (This is only relevant if ICU is not in  
a compiler default path, so it apparently hasn't bitten many.)  

M src/Makefile.global.in
M src/backend/common.mk
M src/backend/snowball/Makefile

Remove "synchronized table states" notice message

commit   : 7f28a7946a37e1716fe12c9e8466dbb868292087    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 11:42:06 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 11:42:06 -0400    

Click here for diff

It appears to be more confusing than useful.  
  
Reported-by: Jeff Janes <[email protected]>  

M src/backend/commands/subscriptioncmds.c

Add MSVC build system support for ICU

commit   : 03c396080ddc77b188a11dd54aa2a075ab2718e0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 11:05:20 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 11:05:20 -0400    

Click here for diff

Author: Ashutosh Sharma <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M src/tools/msvc/Solution.pm
M src/tools/msvc/config_default.pl

Fix build of ICU support in Windows

commit   : 253504fb9f804b6aa7cec9b9b2506fa88accf0dc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 10:28:37 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 10:28:37 -0400    

Click here for diff

and also any platform that does not have locale_t but enabled ICU.  
  
Author: Ashutosh Sharma <[email protected]>  

M src/backend/commands/collationcmds.c

Trim trailing whitespace

commit   : bf6e4c3c82d349dc311ef795cc8eb7a9badf49eb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 09:51:18 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jun 2017 09:51:18 -0400    

Click here for diff

M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/parallel.sgml
M doc/src/sgml/pgstattuple.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/copy.sgml

Stop table sync workers when subscription relation entry is removed

commit   : ddd7b22b225ae41d16ceb218b387645cb9becfdc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 09:47:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 09:47:52 -0400    

Click here for diff

When a table sync worker is in waiting state and the subscription table  
entry is removed because of a concurrent subscription refresh, the  
worker could be left orphaned.  To avoid that, explicitly stop the  
worker when the pg_subscription_rel entry is removed.  
  
Reported-by: Masahiko Sawada <[email protected]>  

M src/backend/commands/subscriptioncmds.c

Fix ALTER TABLE doc examples.

commit   : eab86897bd8cbeb21ae8959ca9a095ce7cb663df    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Mon, 12 Jun 2017 14:49:25 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Mon, 12 Jun 2017 14:49:25 +0900    

Click here for diff

Patch by Yugo Nagata <[email protected]>.  Confirmed by Amit  
Langote, who is the original author of the document part.  

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

Handle unqualified SEQUENCE NAME options properly in parse_utilcmd.c.

commit   : 51893985d3bcf27304283f7fa67f17e017d2dafd    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Jun 2017 19:00:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Jun 2017 19:00:01 -0400    

Click here for diff

generateSerialExtraStmts() was sloppy about handling the case where  
SEQUENCE NAME is given with a not-schema-qualified name.  It was generating  
a CreateSeqStmt with an unqualified sequence name, and an AlterSeqStmt  
whose "owned_by" DefElem contained a T_String Value with a null string  
pointer in the schema-name position.  The generated nextval() argument was  
also underqualified.  This accidentally failed to fail at runtime, but only  
so long as the current default creation namespace at runtime is the right  
namespace.  That's bogus; the parse-time transformation is supposed to be  
inserting the right schema name in all cases, so as to avoid any possible  
skew in that selection.  I'm not sure this could fail in pg_dump's usage,  
but it's still wrong; we have had real bugs in this area before adopting  
the policy that parse_utilcmd.c should generate only fully-qualified  
auxiliary commands.  A slightly lesser problem, which is what led me to  
notice this in the first place, is that pprint() dumped core on the  
AlterSeqStmt because of the bogus T_String.  
  
Noted while poking into the open problem with ALTER SEQUENCE breaking  
pg_upgrade.  

M src/backend/parser/parse_utilcmd.c

Apply RLS policies to partitioned tables.

commit   : 4f7a95be2c112bdc8da5f7e46cbb743b8ba4cc21    
  
author   : Joe Conway <[email protected]>    
date     : Sun, 11 Jun 2017 08:51:18 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Sun, 11 Jun 2017 08:51:18 -0700    

Click here for diff

The new partitioned table capability added a new relkind, namely  
RELKIND_PARTITIONED_TABLE. Update fireRIRrules() to apply RLS  
policies on RELKIND_PARTITIONED_TABLE as it does RELKIND_RELATION.  
  
In addition, add RLS regression test coverage for partitioned tables.  
  
Issue raised by Fakhroutdinov Evgenievich and patch by Mike Palmiotto.  
Regression test editorializing by me.  
  
Discussion: https://postgr.es/m/flat/[email protected]  

M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Take PROVE_FLAGS from the command line but not the environment

commit   : 93b7d9731f184e764c642266ecd74be24db73a6e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 10 Jun 2017 10:19:06 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 10 Jun 2017 10:19:06 -0400    

Click here for diff

This reverts commit 56b6ef893fee9e9bf47d927a02f4d1ea911f4d9c and instead  
makes vcregress.pl parse out PROVE_FLAGS from a command line argument  
when doing a TAP test, thus making it consistent with the makefile  
treatment.  
  
Discussion: https://postgr.es/m/c26a7416-2fb9-34ab-7991-618c922f896e%402ndquadrant.com  
  
Backpatch to 9.4 like previous patch.  

M src/Makefile.global.in
M src/tools/msvc/vcregress.pl

doc: Add Node.js and Go drivers to client interfaces

commit   : e20f679f66fb7930215a1b59f13b5b1c06bfc456    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 20:34:27 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 20:34:27 -0400    

Click here for diff

Also, fix client interface JDBC language name to Java.  
  
Author: Sehrope Sarkuni <[email protected]>  

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

doc: Improve types in example

commit   : 0332993c4e14f13b211f41535f77aadb305fd354    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 19:49:18 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 19:49:18 -0400    

Click here for diff

Reported-by: Nikolaus Thiel <[email protected]>  

M doc/src/sgml/xfunc.sgml

doc: Document that subscriptions to same server might hang

commit   : 0933fcee9851eb2afcd41db1ee4425153f4cbdd3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 17:11:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 17:11:46 -0400    

Click here for diff

M doc/src/sgml/ref/create_subscription.sgml

Silence warning about uninitialized 'ret' variable on some compilers.

commit   : 493490cbcb19c5232038827b114a4ec72aa3e731    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 9 Jun 2017 21:50:35 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 9 Jun 2017 21:50:35 +0300    

Click here for diff

If the compiler doesn't notice that the switch-statement handles all  
possible values of the enum, it might complain that 'ret' is being used  
without initialization. Jeff Janes reported that on gcc 4.4.7.  
  
Discussion: https://www.postgresql.org/message-id/CAMkU=1x31RvP+cpooFbmc8K8nt-gNO8woGFhXcgQYYZ5ozYpFA@mail.gmail.com  

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

Formatting improvements in config file samples

commit   : e11e24b1ed619ca329a532e5e5ae8b4e5e728f71    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 14:38:33 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 14:38:33 -0400    

Click here for diff

M src/backend/access/transam/recovery.conf.sample
M src/backend/utils/misc/postgresql.conf.sample

Update code comments

commit   : 8c9387c55e67ca7c23bb8ffd7e8342cca7be127b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 14:04:22 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 14:04:22 -0400    

Click here for diff

Author: Neha Khatri <[email protected]>  

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

Fix typo

commit   : dabbe8d56470f456e997700efa7d592306ca4274    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 11:40:08 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 11:40:08 -0400    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

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

psql: Update tab completion for ALTER SUBSCRIPTION

commit   : 57f2ff00d7e25ffe33d7e2955428c005d2511277    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 10:17:06 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 10:17:06 -0400    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

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

Improve tablesync behavior with concurrent changes

commit   : 8dc7c338129d22a52d4afcf2f83a73041119efda    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 09:20:54 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 9 Jun 2017 09:20:54 -0400    

Click here for diff

When a table is removed from a subscription before the tablesync worker  
could start, this would previously result in an error when reading  
pg_subscription_rel.  Now we just ignore this.  
  
Author: Masahiko Sawada <[email protected]>  

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

Give a better error message on invalid hostaddr option.

commit   : 76b11e8a43eca4612dfccfe7f3ebd293fb8a46ec    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 9 Jun 2017 13:05:41 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 9 Jun 2017 13:05:41 +0300    

Click here for diff

If you accidentally pass a host name in the hostaddr option, e.g.  
hostaddr=localhost, you get an error like:  
  
psql: could not translate host name "localhost" to address: Name or service not known  
  
That's a bit confusing, because it implies that we tried to look up  
"localhost" in DNS, but it failed. To make it more clear that we tried to  
parse "localhost" as a numeric network address, change the message to:  
  
psql: could not parse network address "localhost": Name or service not known  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Fix script name in README.

commit   : 67d370e619897ace44285b1fe10fd788119242ac    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 9 Jun 2017 12:05:03 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 9 Jun 2017 12:05:03 +0300    

Click here for diff

The script was rewritten in Perl, and renamed from regress.sh to regress.pl,  
back in 2012.  

M src/interfaces/libpq/test/README

Use standard interrupt handling in logical replication launcher.

commit   : 2c48f5db64b1b999b08052115a5ce873343c372a    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 8 Jun 2017 15:00:53 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 8 Jun 2017 15:00:53 -0700    

Click here for diff

Previously the exit handling was only able to exit from within the  
main loop, and not from within the backend code it calls.  Fix that by  
using the standard die() SIGTERM handler, and adding the necessary  
CHECK_FOR_INTERRUPTS() call.  
  
This requires adding yet another process-type-specific branch to  
ProcessInterrupts(), which hints that we probably should generalize  
that handling.  But that's work for another day.  
  
Author: Petr Jelinek  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/launcher.c
M src/backend/tcop/postgres.c
M src/include/replication/logicallauncher.h

Again report a useful error message when walreceiver's connection closes.

commit   : 5fd56b9f5b4a007a4122c313a184f78f1647c4ab    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 8 Jun 2017 14:42:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 8 Jun 2017 14:42:18 -0700    

Click here for diff

Since 7c4f52409a8c (merged in v10), a shutdown master is reported as  
  FATAL:  unexpected result after CommandComplete: server closed the connection unexpectedly  
by walsender. It used to be  
  LOG:  replication terminated by primary server  
  FATAL:  could not send end-of-streaming message to primary: no COPY in progress  
while the old message clearly is not perfect, it's definitely better  
than what's reported now.  
  
The change comes from the attempt to handle finished COPYs without  
erroring out, needed for the new logical replication, which wasn't  
needed before.  
  
There's probably better ways to handle this, but for now just  
explicitly check for a closed connection.  
  
Author: Petr Jelinek  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: -  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Update key words table for version 10

commit   : 5c4109f2c8c2027114cfdc7c0617f81928a0b10e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Jun 2017 17:19:50 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Jun 2017 17:19:50 -0400    

Click here for diff

M doc/src/sgml/keywords.sgml

Mark to_tsvector(regconfig,json[b]) functions immutable

commit   : f7e6853e1a2ee2badd988f5e49e4ceb6a2b15b7f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 8 Jun 2017 15:47:10 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 8 Jun 2017 15:47:10 -0400    

Click here for diff

This make them consistent with the text function and means they can be  
used in functional indexes.  
  
Catalog version bumped.  
  
Per gripe from Josh Berkus.  

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

Fix bit-rot in pg_upgrade's test.sh, and improve documentation.

commit   : 5bab1985dfc25eecf4b098145789955c0b246160    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 8 Jun 2017 13:48:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 8 Jun 2017 13:48:27 -0400    

Click here for diff

Doing a cross-version upgrade test with test.sh evidently hasn't been  
tested since circa 9.2, because the script lacked case branches for  
old-version servers newer than 9.1.  Future-proof that a bit, and  
clean up breakage induced by our recent drop of V0 function call  
protocol (namely that oldstyle_length() isn't in the regression  
suite anymore).  
  
(This isn't enough to make the test work perfectly cleanly across  
versions, but at least it finishes and provides dump files that  
you can diff manually.  One issue I didn't touch is that we might  
want to execute the "reindex_hash.sql" file in the new DB before  
dumping it, so that the hash indexes don't vanish from the dump.)  
  
Improve the TESTING doc file: put the tl;dr version at the top not  
the bottom, and bring its explanation of how to run a cross-version  
test up to speed, since the installcheck target isn't there and won't  
be resurrected.  Improve the comment in the Makefile about why not.  
  
In passing, teach .gitignore and "make clean" about a couple more  
junk output files.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/.gitignore
M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/TESTING
M src/bin/pg_upgrade/test.sh

Improve authentication error messages.

commit   : e3df8f8b93e77c33fa7abb6aca64e07531592130    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 8 Jun 2017 19:54:22 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 8 Jun 2017 19:54:22 +0300    

Click here for diff

Most of the improvements were in the new SCRAM code:  
  
* In SCRAM protocol violation messages, use errdetail to provide the  
  details.  
  
* If pg_backend_random() fails, throw an ERROR rather than just LOG. We  
  shouldn't continue authentication if we can't generate a random nonce.  
  
* Use ereport() rather than elog() for the "invalid SCRAM verifier"  
  messages. They shouldn't happen, if everything works, but it's not  
  inconceivable that someone would have invalid scram verifiers in  
  pg_authid, e.g. if a broken client application was used to generate the  
  verifier.  
  
But this change applied to old code:  
  
* Use ERROR rather than COMMERROR for protocol violation errors. There's  
  no reason to not tell the client what they did wrong. The client might be  
  confused already, so that it cannot read and display the error correctly,  
  but let's at least try. In the "invalid password packet size" case, we  
  used to actually continue with authentication anyway, but that is now a  
  hard error.  
  
Patch by Michael Paquier and me. Thanks to Daniel Varrazzo for spotting  
the typo in one of the messages that spurred the discussion and these  
larger changes.  
  
Discussion: https://www.postgresql.org/message-id/CA%2Bmi_8aZYLhuyQi1Jo0hO19opNZ2OEATEOM5fKApH7P6zTOZGg%40mail.gmail.com  

M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c

Put new command-line options in alphabetical order

commit   : 7ff9812f9aef584b6ee076378d77a09a68f12d97    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Jun 2017 12:12:31 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Jun 2017 12:12:31 -0400    

Click here for diff

M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M doc/src/sgml/ref/pgbench.sgml
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pgbench/pgbench.c

Add statistics subdirectory to Makefile.

commit   : 0eac8e7ff7ebb807f479dd10aa7c88b799a7e319    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 8 Jun 2017 11:28:45 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 8 Jun 2017 11:28:45 -0400    

Click here for diff

Commit 7b504eb282ca2f5104b5c00b4f05a3ef6bb1385b overlooked this.  
  
Report and patch by Kyotaro Horiguchi  
  
Discussion: http://postgr.es/m/[email protected]  

M src/include/Makefile

Fix contrib/sepgsql regr tests for tup-routing constraint check change.

commit   : 06c0afe56e7aa6e8ab9ea2dd92bac2220201affe    
  
author   : Joe Conway <[email protected]>    
date     : Wed, 7 Jun 2017 17:54:33 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Wed, 7 Jun 2017 17:54:33 -0700    

Click here for diff

Commit 15ce775 changed tuple-routing constraint checking logic.  
This affects the expected output for contrib/sepgsql, because  
there's no longer LOG entries reporting allowance of int4eq()  
execution. Per buildfarm.  

M contrib/sepgsql/expected/misc.out

Docs: improve CREATE TABLE ref page's discussion of partition bounds.

commit   : 0198c277a29a035aa8a4e6767967201135f6caa9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Jun 2017 17:23:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Jun 2017 17:23:38 -0400    

Click here for diff

Clarify in the syntax synopsis that partition bound values must be  
exactly numeric literals or string literals; previously it  
said "bound_literal" which was defined nowhere.  
  
Replace confusing --- and, I think, incorrect in detail --- definition  
of how range bounds work with a reference to row-wise comparison plus  
a concrete example (which I stole from Robert Haas).  
  
Minor copy-editing in the same area.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

postgres_fdw: Allow cancellation of transaction control commands.

commit   : ae9bfc5d65123aaa0d1cca9988037489760bdeae    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 7 Jun 2017 15:14:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 7 Jun 2017 15:14:55 -0400    

Click here for diff

Commit f039eaac7131ef2a4cf63a10cf98486f8bcd09d2, later back-patched  
with commit 1b812afb0eafe125b820cc3b95e7ca03821aa675, allowed many of  
the queries issued by postgres_fdw to fetch remote data to respond to  
cancel interrupts in a timely fashion.  However, it didn't do anything  
about the transaction control commands, which remained  
noninterruptible.  
  
Improve the situation by changing do_sql_command() to retrieve query  
results using pgfdw_get_result(), which uses the asynchronous  
interface to libpq so that it can check for interrupts every time  
libpq returns control.  Since this might result in a situation  
where we can no longer be sure that the remote transaction state  
matches the local transaction state, add a facility to force all  
levels of the local transaction to abort if we've lost track of  
the remote state; without this, an apparently-successful commit of  
the local transaction might fail to commit changes made on the  
remote side.  Also, add a 60-second timeout for queries issue during  
transaction abort; if that expires, give up and mark the state of  
the connection as unknown.  Drop all such connections when we exit  
the local transaction.  Together, these changes mean that if we're  
aborting the local toplevel transaction anyway, we can just drop the  
remote connection in lieu of waiting (possibly for a very long time)  
for it to complete an abort.  
  
This still leaves quite a bit of room for improvement.  PQcancel()  
has no asynchronous interface, so if we get stuck sending the cancel  
request we'll still hang.  Also, PQsetnonblocking() is not used, which  
means we could block uninterruptibly when sending a query.  There  
might be some other optimizations possible as well.  Nonetheless,  
this allows us to escape a wait for an unresponsive remote server  
quickly in many more cases than previously.  
  
Report by Suraj Kharage.  Patch by me and Rafia Sabih.  Review  
and testing by Amit Kapila and Tushar Ahuja.  
  
Discussion: http://postgr.es/m/CAF1DzPU8Kx+fMXEbFoP289xtm3bz3t+ZfxhmKavr98Bh-C0TqQ@mail.gmail.com  

M contrib/postgres_fdw/connection.c

Fix updating of pg_subscription_rel from workers

commit   : 644ea35fc1352d845299563c7ddfb8b524ed27d9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 7 Jun 2017 13:49:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 7 Jun 2017 13:49:14 -0400    

Click here for diff

A logical replication worker should not insert new rows into  
pg_subscription_rel, only update existing rows, so that there are no  
races if a concurrent refresh removes rows.  Adjust the API to be able  
to choose that behavior.  
  
Author: Masahiko Sawada <[email protected]>  
Reported-by: tushar <[email protected]>  

M src/backend/catalog/pg_subscription.c
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/tablesync.c
M src/include/catalog/pg_subscription_rel.h

Prevent BEFORE triggers from violating partitioning constraints.

commit   : 15ce775faa428dc91027e4e2d6b7a167a27118b5    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 7 Jun 2017 12:45:32 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 7 Jun 2017 12:45:32 -0400    

Click here for diff

Since tuple-routing implicitly checks the partitioning constraints  
at least for the levels of the partitioning hierarchy it traverses,  
there's normally no need to revalidate the partitioning constraint  
after performing tuple routing.  However, if there's a BEFORE trigger  
on the target partition, it could modify the tuple, causing the  
partitioning constraint to be violated.  Catch that case.  
  
Also, instead of checking the root table's partition constraint after  
tuple-routing, check it beforehand.  Otherwise, the rules for when  
the partitioning constraint gets checked get too complicated, because  
you sometimes have to check part of the constraint but not all of it.  
This effectively reverts commit 39162b2030fb0a35a6bb28dc636b5a71b8df8d1c  
in favor of a different approach altogether.  
  
Report by me.  Initial debugging by Jeevan Ladhe.  Patch by Amit  
Langote, reviewed by me.  
  
Discussion: http://postgr.es/m/CA+Tgmoa9DTgeVOqopieV8d1QRpddmP65aCdxyjdYDoEO5pS5KA@mail.gmail.com  

M src/backend/commands/copy.c
M src/backend/executor/execMain.c
M src/backend/executor/nodeModifyTable.c
M src/test/regress/expected/insert.out
M src/test/regress/sql/insert.sql

Clear auth context correctly when re-connecting after failed auth attempt.

commit   : e6c33d594a004a2c831cdff1a16276347d30f703    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 7 Jun 2017 14:01:46 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 7 Jun 2017 14:01:46 +0300    

Click here for diff

If authentication over an SSL connection fails, with sslmode=prefer,  
libpq will reconnect without SSL and retry. However, we did not clear  
the variables related to GSS, SSPI, and SASL authentication state, when  
reconnecting. Because of that, the second authentication attempt would  
always fail with a "duplicate GSS/SASL authentication request" error.  
pg_SSPI_startup did not check for duplicate authentication requests like  
the corresponding GSS and SASL functions, so with SSPI, you would leak  
some memory instead.  
  
Another way this could manifest itself, on version 10, is if you list  
multiple hostnames in the "host" parameter. If the first server requests  
Kerberos or SCRAM authentication, but it fails, the attempts to connect to  
the other servers will also fail with "duplicate authentication request"  
errors.  
  
To fix, move the clearing of authentication state from closePGconn to  
pgDropConnection, so that it is cleared also when re-connecting.  
  
Patch by Michael Paquier, with some kibitzing by me.  
  
Backpatch down to 9.3. 9.2 has the same bug, but the code around closing  
the connection is somewhat different, so that this patch doesn't apply.  
To fix this in 9.2, I think we would need to back-port commit 210eb9b743  
first, and then apply this patch. However, given that we only bumped into  
this in our own testing, we haven't heard any reports from users about  
this, and that 9.2 will be end-of-lifed in a couple of months anyway, it  
doesn't seem worth the risk and trouble.  
  
Discussion: https://www.postgresql.org/message-id/CAB7nPqRuOUm0MyJaUy9L3eXYJU3AKCZ-0-03=-aDTZJGV4GyWw@mail.gmail.com  

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

Fix double-free bug in GSS authentication.

commit   : 3344582e6f1605d69bef008c4e489cafd9610cfe    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 7 Jun 2017 09:42:29 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 7 Jun 2017 09:42:29 +0300    

Click here for diff

The logic to free the buffer after the gss_init_sec_context() call was  
always a bit wonky. Because gss_init_sec_context() sets the GSS context  
variable, conn->gctx, we would in fact always attempt to free the buffer.  
That only works, because previously conn->ginbuf.value was initialized to  
NULL, and free(NULL) is a no-op. Commit 61bf96cab0 refactored things so  
that the GSS input token buffer is allocated locally in pg_GSS_continue,  
and not held in the PGconn object. After that, the now-local ginbuf.value  
variable isn't initialized when it's not used, so we pass a bogus pointer  
to free().  
  
To fix, only try to free the input buffer if we allocated it. That was the  
intention, certainly after the refactoring, and probably even before that.  
But because there's no live bug before the refactoring, I refrained from  
backpatching this.  
  
The bug was also independently reported by Graham Dutton, as bug #14690.  
Patch reviewed by Michael Paquier.  
  
Discussion: https://www.postgresql.org/message-id/6288d80e-a0bf-d4d3-4e12-7b79c77f1771%40iki.fi  
Discussion: https://www.postgresql.org/message-id/20170605130954.1438.90535%40wrigleys.postgresql.org  

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

Consistently use subscription name as application name

commit   : d4bfc06e292ee2f537f42d4ed216209c4537ee92    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 6 Jun 2017 21:51:31 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 6 Jun 2017 21:51:31 -0400    

Click here for diff

The logical replication apply worker uses the subscription name as  
application name, except for table sync.  This was incorrectly set to  
use the replication slot name, which might be different, in one case.  
Also add a comment why the other case is different.  

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

commit   : 9206ced1dc05d3a9cc99faafa22d5d8b16d998d1    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 6 Jun 2017 16:13:00 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 6 Jun 2017 16:13:00 -0700    

Click here for diff

The larger part of this patch replaces usages of MyProc->procLatch  
with MyLatch.  The latter works even early during backend startup,  
where MyProc->procLatch doesn't yet.  While the affected code  
shouldn't run in cases where it's not initialized, it might get copied  
into places where it might.  Using MyLatch is simpler and a bit faster  
to boot, so there's little point to stick with the previous coding.  
  
While doing so I noticed some weaknesses around newly introduced uses  
of latches that could lead to missed events, and an omitted  
CHECK_FOR_INTERRUPTS() call in worker_spi.  
  
As all the actual bugs are in v10 code, there doesn't seem to be  
sufficient reason to backpatch this.  
  
Author: Andres Freund  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  
Backpatch: -  

M src/backend/access/transam/parallel.c
M src/backend/libpq/pqmq.c
M src/backend/postmaster/bgworker.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/storage/lmgr/condition_variable.c
M src/test/modules/worker_spi/worker_spi.c

Improve handover logic between sync and apply workers

commit   : e3a815d2faa5be28551e71d5db44fb2c78133433    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 6 Jun 2017 14:38:44 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 6 Jun 2017 14:38:44 -0400    

Click here for diff

Make apply busy wait check the catalog instead of shmem state to ensure  
that next transaction will see the expected table synchronization state.  
  
Also make the handover always go through same set of steps to make the  
overall process easier to understand and debug.  
  
Author: Petr Jelinek <[email protected]>  
Tested-by: Mark Kirkwood <[email protected]>  
Tested-by: Erik Rijkers <[email protected]>  

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

Fix some cases of "the the" split across two lines.

commit   : 79c4fa0f62291fd30d126a12f35b9ce71f06b3c0    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 6 Jun 2017 12:24:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 6 Jun 2017 12:24:44 -0400    

Click here for diff

Kevin Grittner observed that 2186b608b3cb859fe0ec04015a5c4e4cbf69caed  
introduced a new occurence of this by copying existing text, and I  
found a few more cases using grep.  
  
Discussion: http://postgr.es/m/CADAecHWfG-K+YvocHCkrXV-ycm+eUOaaUVfYZNOnwf0pSmuQCw@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ddl.sgml
M src/bin/pg_basebackup/receivelog.c

Use NIL rather than NULL to represent an empty list.

commit   : 3106829513ab7c8e46e94db103f1ef8d8dfd379b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 6 Jun 2017 11:21:22 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 6 Jun 2017 11:21:22 -0400    

Click here for diff

Just to be tidy.  
  
Amit Langote  
  
Discussion: http://postgr.es/m/[email protected]  

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

Clean up partcollation handling for OID 0.

commit   : 2186b608b3cb859fe0ec04015a5c4e4cbf69caed    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 6 Jun 2017 11:07:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 6 Jun 2017 11:07:20 -0400    

Click here for diff

Consistent with what we do for indexes, we shouldn't try to record  
dependencies on collation OID 0 or the default collation OID (which  
is pinned).  Also, the fact that indcollation and partcollation can  
contain zero OIDs when the data type is not collatable should be  
documented.  
  
Amit Langote, per a complaint from me.  
  
Discussion: http://postgr.es/m/CA+Tgmoba5mtPgM3NKfG06vv8na5gGbVOj0h4zvivXQwLw8wXXQ@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/heap.c

Fix docs to not claim ECPG's SET CONNECTION is not thread-aware.

commit   : 0f33ee0e3b7527fb0c88abf0ae8a49a9c38d9c0e    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 6 Jun 2017 12:19:28 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 6 Jun 2017 12:19:28 +0200    

Click here for diff

Changed by: Tsunakawa, Takayuki <[email protected]>  

M doc/src/sgml/ecpg.sgml

Wire up query cancel interrupt for walsender backends.

commit   : c1abe6c786d8f00643de8519140d77644b474163    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Jun 2017 18:53:41 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Jun 2017 18:53:41 -0700    

Click here for diff

This allows to cancel commands run over replication connections. While  
it might have some use before v10, it has become important now that  
normal SQL commands are allowed in database connected walsender  
connections.  
  
Author: Petr Jelinek  
Reviewed-By: Andres Freund, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walsender.c

Unify SIGHUP handling between normal and walsender backends.

commit   : 6e1dd2773eb60a6ab87b27b8d9391b756e904ac3    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Jun 2017 18:53:41 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Jun 2017 18:53:41 -0700    

Click here for diff

Because walsender and normal backends share the same main loop it's  
problematic to have two different flag variables, set in signal  
handlers, indicating a pending configuration reload.  Only certain  
walsender commands reach code paths checking for the  
variable (START_[LOGICAL_]REPLICATION, CREATE_REPLICATION_SLOT  
... LOGICAL, notably not base backups).  
  
This is a bug present since the introduction of walsender, but has  
gotten worse in releases since then which allow walsender to do more.  
  
A later patch, not slated for v10, will similarly unify SIGHUP  
handling in other types of processes as well.  
  
Author: Petr Jelinek, Andres Freund  
Reviewed-By: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.2-, bug is present since 9.0  

M src/backend/replication/walsender.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/globals.c
M src/include/miscadmin.h

Prevent possibility of panics during shutdown checkpoint.

commit   : c6c333436491a292d56044ed6e167e2bdee015a2    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Jun 2017 18:53:41 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Jun 2017 18:53:41 -0700    

Click here for diff

When the checkpointer writes the shutdown checkpoint, it checks  
afterwards whether any WAL has been written since it started and  
throws a PANIC if so.  At that point, only walsenders are still  
active, so one might think this could not happen, but walsenders can  
also generate WAL, for instance in BASE_BACKUP and logical decoding  
related commands (e.g. via hint bits).  So they can trigger this panic  
if such a command is run while the shutdown checkpoint is being  
written.  
  
To fix this, divide the walsender shutdown into two phases.  First,  
checkpointer, itself triggered by postmaster, sends a  
PROCSIG_WALSND_INIT_STOPPING signal to all walsenders.  If the backend  
is idle or runs an SQL query this causes the backend to shutdown, if  
logical replication is in progress all existing WAL records are  
processed followed by a shutdown.  Otherwise this causes the walsender  
to switch to the "stopping" state. In this state, the walsender will  
reject any further replication commands. The checkpointer begins the  
shutdown checkpoint once all walsenders are confirmed as  
stopping. When the shutdown checkpoint finishes, the postmaster sends  
us SIGUSR2. This instructs walsender to send any outstanding WAL,  
including the shutdown checkpoint record, wait for it to be replicated  
to the standby, and then exit.  
  
Author: Andres Freund, based on an earlier patch by Michael Paquier  
Reported-By: Fujii Masao, Andres Freund  
Reviewed-By: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4, where logical decoding was introduced  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xlog.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/procsignal.c
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/storage/procsignal.h

Have walsenders participate in procsignal infrastructure.

commit   : 47fd420fb4d3e77dde960312f8672c82b14ecbad    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Jun 2017 18:53:41 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Jun 2017 18:53:41 -0700    

Click here for diff

The non-participation in procsignal was a problem for both changes in  
master, e.g. parallelism not working for normal statements run in  
walsender backends, and older branches, e.g. recovery conflicts and  
catchup interrupts not working for logical decoding walsenders.  
  
This commit thus replaces the previous WalSndXLogSendHandler with  
procsignal_sigusr1_handler.  In branches since db0f6cad48 that can  
lead to additional SetLatch calls, but that only rarely seems to make  
a difference.  
  
Author: Andres Freund  
Reviewed-By: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4, earlier commits don't seem to benefit sufficiently  

M src/backend/replication/walsender.c

Revert "Prevent panic during shutdown checkpoint"

commit   : 703f148e98ecb4b299fdad403fc5a1de51220714    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Jun 2017 18:53:41 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Jun 2017 18:53:41 -0700    

Click here for diff

This reverts commit 086221cf6b1727c2baed4703c582f657b7c5350e, which  
was made to master only.  
  
The approach implemented in the above commit has some issues.  While  
those could easily be fixed incrementally, doing so would make  
backpatching considerably harder, so instead first revert this patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xlog.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/walsender.c
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h

Don't set application_name in logical replication workers

commit   : 41a21bf9b4a2449eddc8ea2b29597e835eea9bfd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 5 Jun 2017 22:16:02 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 5 Jun 2017 22:16:02 -0400    

Click here for diff

This was bothering some people because it's not the intended use of  
application_name and it makes the default view of pg_stat_activity  
bulky.  

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

Fix ALTER SUBSCRIPTION grammar ambiguity

commit   : 9907b55ceb17f55bb508a1f24027a57530d84442    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 5 Jun 2017 21:37:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 5 Jun 2017 21:37:00 -0400    

Click here for diff

There was a grammar ambiguity between SET PUBLICATION name REFRESH and  
SET PUBLICATION SKIP REFRESH, because SKIP is not a reserved word.  To  
resolve that, fold the refresh choice into the WITH options.  Refreshing  
is the default now.  
  
Reported-by: tushar <[email protected]>  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M src/backend/commands/subscriptioncmds.c
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql
M src/test/subscription/t/001_rep_changes.pl

Ignore WL_POSTMASTER_DEATH latch event in single user mode

commit   : 06bfb801c73c89e66f44c1cf693386793e98b637    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 2 Jun 2017 23:02:13 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 2 Jun 2017 23:02:13 -0400    

Click here for diff

Otherwise code that uses this will abort with an assertion failure,  
because postmaster_alive_fds are not initialized.  
  
Reported-by: tushar <[email protected]>  

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

Fix thinko in previous openssl change

commit   : 2e02136fe688046cd3b3c0bbcdd6ba970932ec8e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 5 Jun 2017 20:38:46 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 5 Jun 2017 20:38:46 -0400    

Click here for diff

M src/tools/msvc/Solution.pm

Fix record length computation in pg_waldump/xlogdump.

commit   : c25ed20067d21a97242a023031fcdcc232d6945c    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Jun 2017 15:56:58 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Jun 2017 15:56:58 -0700    

Click here for diff

The current method of computing the record length (excluding the  
lenght of full-page images) has been wrong since the WAL format has  
been revamped in 2c03216d831160bedd72d45f712601b6f7d03f1c.  Only the  
main record's length was counted, but that can be significantly too  
little if there's data associated with further blocks.  
  
Fix by computing the record length as total_lenght - fpi_length.  
  
Reported-By: Chen Huajun  
Bug: #14687  
Reviewed-By: Heikki Linnakangas  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.5-  

M src/bin/pg_waldump/pg_waldump.c

Code review for shm_toc.h/.c.

commit   : 3e60c6f72328a9ad14d8a087411cd394752c5b23    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Jun 2017 14:50:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Jun 2017 14:50:52 -0400    

Click here for diff

Declare the toc_nentry field as uint32 not Size.  Since shm_toc_lookup()  
reads the field without any lock, it has to be atomically readable, and  
we do not assume that for fields wider than 32 bits.  Performance would  
be impossibly bad for entry counts approaching 2^32 anyway, so there is  
no need to try to preserve maximum width here.  
  
This is probably an academic issue, because even if reading int64 isn't  
atomic, the high order half would never change in practice.  Still, it's  
a coding rule violation, so let's fix it.  
  
Adjust some other not-terribly-well-chosen data types too, and copy-edit  
some comments.  Make shm_toc_attach's Asserts consistent with  
shm_toc_create's.  
  
None of this looks to be a live bug, so no need for back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Find openssl lib files in right directory for MSVC

commit   : 614350a3ab73992f48c86e26552a2cbf030180e2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 5 Jun 2017 14:24:42 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 5 Jun 2017 14:24:42 -0400    

Click here for diff

Some openssl builds put their lib files in a VC subdirectory, others do  
not. Cater for both cases.  
  
Backpatch to all live branches.  
  
From an offline discussion with Leonardo Cecchi.  

M src/tools/msvc/Solution.pm

Don't be so trusting that shm_toc_lookup() will always succeed.

commit   : d4663350646ca0c069a36d906155a0f7e3372eb7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Jun 2017 12:05:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Jun 2017 12:05:42 -0400    

Click here for diff

Given the possibility of race conditions and so on, it seems entirely  
unsafe to just assume that shm_toc_lookup() always finds the key it's  
looking for --- but that was exactly what all but one call site were  
doing.  To fix, add a "bool noError" argument, similarly to what we  
have in many other functions, and throw an error on an unexpected  
lookup failure.  Remove now-redundant Asserts that a rather random  
subset of call sites had.  
  
I doubt this will throw any light on buildfarm member lorikeet's  
recent failures, because if an unnoticed lookup failure were involved,  
you'd kind of expect a null-pointer-dereference crash rather than the  
observed symptom.  But you never know ... and this is better coding  
practice even if it never catches anything.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/parallel.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/storage/ipc/shm_toc.c
M src/include/storage/shm_toc.h
M src/test/modules/test_shm_mq/worker.c

Fix typo in error message.

commit   : af51fea039bb8e00066d68d919312df1701dc03e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Jun 2017 11:38:26 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Jun 2017 11:38:26 +0300    

Click here for diff

Daniele Varrazzo  
  
Discussion: https://www.postgresql.org/message-id/CA+mi_8bqY5THP8hLKKSdMEr5GCz6M=hD6_uLbvFeyEBfwqUxeA@mail.gmail.com  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Fix comments in simplehash.h.

commit   : 553e16951c0db4e3d2d0f804ff7f9d2ac0a96fe5    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Jun 2017 10:46:08 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Jun 2017 10:46:08 +0300    

Click here for diff

Jeff Janes and me.  
  
Discussion: https://www.postgresql.org/message-id/CAMkU=1zYnniLYg+W9itL93DXebCjx6Uk6m_=Xa8p_zM65X3S0Q@mail.gmail.com  

M src/include/lib/simplehash.h

Replace over-optimistic Assert in partitioning code with a runtime test.

commit   : e7941a976688f0f5d13a5227ed4f3efe0718db9d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Jun 2017 16:20:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Jun 2017 16:20:03 -0400    

Click here for diff

get_partition_parent felt that it could simply Assert that systable_getnext  
found a tuple.  This is unlike any other caller of that function, and it's  
unsafe IMO --- in fact, the reason I noticed it was that the Assert failed.  
(OK, I was working with known-inconsistent catalog contents, but I wasn't  
expecting the DB to fall over quite that violently.  The behavior in a  
non-assert-enabled build wouldn't be very nice, either.)  Fix it to do what  
other callers do, namely an actual runtime-test-and-elog.  
  
Also, standardize the wording of elog messages that are complaining about  
unexpected failure of systable_getnext.  90% of them say "could not find  
tuple for <object>", so make the remainder do likewise.  Many of the  
holdouts were using the phrasing "cache lookup failed", which is outright  
misleading since no catcache search is involved.  

M contrib/sepgsql/database.c
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/commands/extension.c
M src/backend/utils/adt/ruleutils.c

#ifdef out assorted unused GEQO code.

commit   : 9db7d47f909482ac2b76c28f5e9a2ef48fb19b9d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Jun 2017 13:34:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Jun 2017 13:34:05 -0400    

Click here for diff

I'd always assumed that backend/optimizer/geqo/'s remarkably poor  
showing on code coverage metrics was because we weren't exercising  
it much in the regression tests.  But it turns out that a good chunk  
of the problem is that there's a bunch of code that is physically  
unreachable (because the calls to it are #ifdef'd out in geqo_main.c)  
but is being built anyway.  Making the called code have #if guards  
similar to the calling code saves a couple of kilobytes of executable  
size and should make the coverage numbers more reflective of reality.  
  
It's arguable that we should just delete all the unused recombination  
mechanisms altogether, but I didn't feel a need to go that far today.  

M src/backend/optimizer/geqo/geqo_cx.c
M src/backend/optimizer/geqo/geqo_erx.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_mutation.c
M src/backend/optimizer/geqo/geqo_ox1.c
M src/backend/optimizer/geqo/geqo_ox2.c
M src/backend/optimizer/geqo/geqo_pmx.c
M src/backend/optimizer/geqo/geqo_px.c
M src/backend/optimizer/geqo/geqo_recombination.c
M src/include/optimizer/geqo.h

Disallow CREATE INDEX if table is already in use in current session.

commit   : 0d1885266630eee1de5c43af463fe2b921451932    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Jun 2017 12:02:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Jun 2017 12:02:31 -0400    

Click here for diff

If we allow this, whatever outer command has the table open will not know  
about the new index and may fail to update it as needed, as shown in a  
report from Laurenz Albe.  We already had such a prohibition in place for  
ALTER TABLE, but the CREATE INDEX syntax missed the check.  
  
Fixing it requires an API change for DefineIndex(), which conceivably  
would break third-party extensions if we were to back-patch it.  Given  
how long this problem has existed without being noticed, fixing it in  
the back branches doesn't seem worth that risk.  
  
Discussion: https://postgr.es/m/A737B7A37273E048B164557ADEF4A58B53A4DC9A@ntex2010i.host.magwien.gv.at  

M src/backend/bootstrap/bootparse.y
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/tcop/utility.c
M src/include/commands/defrem.h
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Assorted translatable string fixes

commit   : 55a70a023c3daefca9bbd68bfbe6862af10ab479    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 4 Jun 2017 11:41:16 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 4 Jun 2017 11:41:16 -0400    

Click here for diff

Mark our rusage reportage string translatable; remove quotes from type  
names; unify formatting of very similar messages.  

M src/backend/access/brin/brin_pageops.c
M src/backend/catalog/index.c
M src/backend/catalog/namespace.c
M src/backend/commands/vacuumlazy.c
M src/backend/commands/variable.c
M src/backend/storage/page/bufpage.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/misc/pg_rusage.c

Remove dead variables.

commit   : 5936d25f8101f2433e8242794d2275c7a05273bf    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Jun 2017 20:35:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Jun 2017 20:35:52 -0400    

Click here for diff

Commit 512c7356b left a couple of variables unused except for being set.  
My compiler didn't whine about this, but some buildfarm members did.  

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

Add some missing backslash commands to psql's tab-completion knowledge.

commit   : f1175556a17a193395326f45a3e595b4aa3a9eff    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Jun 2017 17:10:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Jun 2017 17:10:25 -0400    

Click here for diff

\if and related commands were overlooked here, as were \dRp and \dRs  
from the logical-replication patch, as was \?.  
  
While here, reformat the list to put each new first command letter on  
a separate line; perhaps that will limit the need to reflow the whole  
list when we add more commands in future.  
  
Masahiko Sawada (reformatting by me)  
  
Discussion: https://postgr.es/m/CAD21AoDW1QHtBsM33hV+Fg2mYEs+FWj4qtoCU72AwHAXQ3U6ZQ@mail.gmail.com  

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

Fix <> and pattern-NOT-match estimators to handle nulls correctly.

commit   : 512c7356b6574e7622fddb713f96dc8407960680    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Jun 2017 14:36:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Jun 2017 14:36:25 -0400    

Click here for diff

These estimators returned 1 minus the corresponding equality/match  
estimate, which is incorrect: we need to subtract off the fraction  
of nulls in the column, since those are neither equal nor not equal  
to the comparison value.  The error only becomes obvious if the  
nullfrac is large, but it could be very bad in a mostly-nulls  
column, as reported in bug #14676 from Marko Tiikkaja.  
  
To fix the <> case, refactor eqsel() and neqsel() to call a common  
support routine, which can be made to account for nullfrac correctly.  
The pattern-match cases were already factored that way, and it was  
simply an oversight that patternsel() wasn't subtracting off nullfrac.  
  
neqjoinsel() has a similar problem, but since we're elsewhere discussing  
changing its behavior entirely, I left it alone for now.  
  
This is a very longstanding bug, but I'm hesitant to back-patch a fix for  
it.  Given the lack of prior complaints, such cases must not come up often,  
so it's probably not worth the risk of destabilizing plans in stable  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix old corner-case logic error in final_cost_nestloop().

commit   : 23886581b58c7e5d005d6346c0024a45801cc5a9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Jun 2017 13:48:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Jun 2017 13:48:15 -0400    

Click here for diff

When costing a nestloop with stop-at-first-inner-match semantics, and a  
non-indexscan inner path, final_cost_nestloop() wants to charge the full  
scan cost of the inner rel at least once, with additional scans charged  
at inner_rescan_run_cost which might be less.  However the logic for  
doing this effectively assumed that outer_matched_rows is at least 1.  
If it's zero, which is not unlikely for a small outer rel, we ended up  
charging inner_run_cost plus N times inner_rescan_run_cost, as much as  
double the correct charge for an outer rel with only one row that  
we're betting won't be matched.  (Unless the inner rel is materialized,  
in which case it has very small inner_rescan_run_cost and the cost  
is not so far off what it should have been.)  
  
The upshot of this was that the planner had a tendency to select plans  
that failed to make effective use of the stop-at-first-inner-match  
semantics, and that might have Materialize nodes in them even when the  
predicted number of executions of the Materialize subplan was only 1.  
This was not so obvious before commit 9c7f5229a, because the case only  
arose in connection with semi/anti joins where there's not freedom to  
reverse the join order.  But with the addition of unique-inner joins,  
it could result in some fairly bad planning choices, as reported by  
Teodor Sigaev.  Indeed, some of the test cases added by that commit  
have plans that look dubious on closer inspection, and are changed  
by this patch.  
  
Fix the logic to ensure that we don't charge for too many inner scans.  
I chose to adjust it so that the full-freight scan cost is associated  
with an unmatched outer row if possible, not a matched one, since that  
seems like a better model of what would happen at runtime.  
  
This is a longstanding bug, but given the lesser impact in back branches,  
and the lack of field complaints, I won't risk a back-patch.  
  
Discussion: https://postgr.es/m/CAKJS1f-LzkUsFxdJ_-Luy38orQ+AdEXM5o+vANR+-pHAWPSecg@mail.gmail.com  

M src/backend/optimizer/path/costsize.c
M src/test/regress/expected/join.out

Receive invalidation messages correctly in tablesync worker

commit   : 66b84fa82f7318d8da75dbf754df16eb7b1f1037    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 3 Jun 2017 11:37:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 3 Jun 2017 11:37:47 -0400    

Click here for diff

We didn't accept any invalidation messages until the whole sync process  
had finished (because it flattens all the remote transactions in the  
single one).  So the sync worker didn't learn about subscription  
changes/drop until it has finished.  This could lead to "orphaned" sync  
workers.  
  
Author: Petr Jelinek <[email protected]>  
Reported-by: Masahiko Sawada <[email protected]>  

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

Make tablesync worker exit when apply dies while it was waiting for it

commit   : 3c9bc2157a4f465b3c070d1250597568d2dc285f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 3 Jun 2017 09:18:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 3 Jun 2017 09:18:52 -0400    

Click here for diff

This avoids "orphaned" sync workers.  
  
This was caused by a thinko in wait_for_sync_status_change.  
  
Author: Petr Jelinek <[email protected]>  
Reported-by: Masahiko Sawada <[email protected]>  

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

Allow parallelism in COPY (query) TO ...;

commit   : 34aebcf42a70089b76ff8e9ccda331f111153eeb    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 2 Jun 2017 19:05:57 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 2 Jun 2017 19:05:57 -0700    

Click here for diff

Previously this was not allowed, as copy.c didn't set the  
CURSOR_OPT_PARALLEL_OK flag when planning the query. Set it.  
  
While the lack of parallel query for COPY isn't strictly speaking a  
bug, it does prevent parallelism from being used in a facility  
commonly used to run long running queries. Thus backpatch to 9.6.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.6, where parallelism was introduced.  

M src/backend/commands/copy.c

doc: Add note that DROP SUBSCRIPTION drops replication slot

commit   : de492c17f064ea3ddcb73d9529f3e30a1483ffa5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 31 May 2017 22:35:33 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 31 May 2017 22:35:33 -0400    

Click here for diff

Add some information about what to do when this fails.  

M doc/src/sgml/ref/drop_subscription.sgml

Remove replication slot name check from ReplicationSlotAcquire()

commit   : 420a0392ef8fdac3eb6f0a616c136215f7454674    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 30 May 2017 14:57:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 30 May 2017 14:57:01 -0400    

Click here for diff

When trying to access a replication slot that is supposed to already  
exist, we don't need to check the naming rules again.  If the slot  
does not exist, we will then get a "does not exist" error message, which  
is generally more useful from the perspective of an end user.  

M src/backend/replication/slot.c

Fix signal handling in logical replication workers

commit   : 9fcf670c2efdf31233d429f557ab77937f0f1e6a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 2 Jun 2017 14:46:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 2 Jun 2017 14:46:00 -0400    

Click here for diff

The logical replication worker processes now use the normal die()  
handler for SIGTERM and CHECK_FOR_INTERRUPTS() instead of custom code.  
One problem before was that the apply worker would not exit promptly  
when a subscription was dropped, which could lead to deadlocks.  
  
Author: Petr Jelinek <[email protected]>  
Reported-by: Masahiko Sawada <[email protected]>  

M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/tcop/postgres.c
M src/include/replication/logicalworker.h
M src/include/replication/worker_internal.h

Fix copy/paste mistake in comment

commit   : acbd8375e954774181b673a31b814e9d46f436a5    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 2 Jun 2017 11:18:24 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 2 Jun 2017 11:18:24 +0200    

Click here for diff

Amit Langote  

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

Fix typo in comment

commit   : 483373979b17f10b2dfa4b12e68c3b961a9f8454    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 2 Jun 2017 09:40:54 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 2 Jun 2017 09:40:54 +0200    

Click here for diff

Masahiko Sawada  

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

Reorganize logical replication worker disconnect code

commit   : 6812330f1cc95f258ffe4ce7d56bdd56efbd9fde    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Jun 2017 23:05:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Jun 2017 23:05:47 -0400    

Click here for diff

Move the walrcv_disconnect() calls into the before_shmem_exit handler.  
This makes sure the call is always made even during exit by signal, it  
saves some duplicate code, and it makes the logic more similar to  
walreceiver.c.  
  
Author: Petr Jelinek <[email protected]>  

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

psql: Fix display of whether table is part of publication

commit   : 2d460179baa8744e9e2a183a5121306596c53fba    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Jun 2017 21:13:40 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Jun 2017 21:13:40 -0400    

Click here for diff

If a FOR ALL TABLES publication was present, \d of a table would claim  
for each table that it was part of the publication, even for tables that  
are ignored for this purpose, such as system tables and unlogged tables.  
Fix the query by using the function pg_get_publication_tables(), which  
was intended for this purpose.  
  
Reported-by: tushar <[email protected]>  
Reviewed-by: Amit Langote <[email protected]>  
Reviewed-by: Kuntal Ghosh <[email protected]>  

M src/bin/psql/describe.c

Fix typo

commit   : f112f175a464697dd7ff5280de40dcc08d75f995    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 1 Jun 2017 17:45:53 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 1 Jun 2017 17:45:53 -0400    

Click here for diff

Reported by: Tim Goodaire  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml

Modify sequence catalog tuple before invoking post alter hook.

commit   : 665104557fdc25788a6d54ab271ed818bec18598    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 31 May 2017 17:03:10 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 31 May 2017 17:03:10 -0700    

Click here for diff

This seems to have been broken in the commit (1753b1b027035029) that  
moved the sequence definition into pg_sequence.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: Bug is in master/v10 only  

M src/backend/commands/sequence.c

Make ALTER SEQUENCE, including RESTART, fully transactional.

commit   : 3d79013b970d4cc336c06eb77ed526b44308c03e    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 31 May 2017 16:39:27 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 31 May 2017 16:39:27 -0700    

Click here for diff

Previously the changes to the "data" part of the sequence, i.e. the  
one containing the current value, were not transactional, whereas the  
definition, including minimum and maximum value were.  That leads to  
odd behaviour if a schema change is rolled back, with the potential  
that out-of-bound sequence values can be returned.  
  
To avoid the issue create a new relfilenode fork whenever ALTER  
SEQUENCE is executed, similar to how TRUNCATE ... RESTART IDENTITY  
already is already handled.  
  
This commit also makes ALTER SEQUENCE RESTART transactional, as it  
seems to be too confusing to have some forms of ALTER SEQUENCE behave  
transactionally, some forms not.  This way setval() and nextval() are  
not transactional, but DDL is, which seems to make sense.  
  
This commit also rolls back parts of the changes made in 3d092fe540  
and f8dc1985f as they're now not needed anymore.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: Bug is in master/v10 only  

M doc/src/sgml/ref/alter_sequence.sgml
M src/backend/commands/sequence.c
M src/test/isolation/expected/sequence-ddl.out
M src/test/isolation/specs/sequence-ddl.spec

Always use -fPIC, not -fpic, when building shared libraries with gcc.

commit   : e9a3c047a5fc701d2efb776be2b351645ea001c8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Jun 2017 13:32:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Jun 2017 13:32:55 -0400    

Click here for diff

On some platforms, -fpic fails for sufficiently large shared libraries.  
We've mostly not hit that boundary yet, but there are some extensions  
such as Citus and pglogical where it's becoming a problem.  A bit of  
research suggests that the penalty for -fPIC is small, in the  
single-digit-percentage range --- and there's none at all on popular  
platforms such as x86_64.  So let's just default to -fPIC everywhere  
and provide one less thing for extension developers to worry about.  
  
Per complaint from Christoph Berg.  Back-patch to all supported branches.  
(I did not bother to touch the recently-removed Makefiles for sco and  
unixware in the back branches, though.  We'd have no way to test that  
it doesn't break anything on those platforms.)  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/dfunc.sgml
M src/makefiles/Makefile.linux
M src/makefiles/Makefile.netbsd
M src/makefiles/Makefile.openbsd

Generate pg_basebackup temporary slot name using backend pid

commit   : 2712da8b64b4e399a2666cce2c25329f4f834f2d    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 31 May 2017 20:57:25 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 31 May 2017 20:57:25 +0200    

Click here for diff

Using the client pid can easily be non-unique when used on different  
hosts. Using the backend pid should be guaranteed unique, since the  
temporary slot gets removed when the client disconnects so it will be  
gone even if the pid is renewed.  
  
Reported by Ludovic Vaugeois-Pepin  

M src/bin/pg_basebackup/pg_basebackup.c

Restore accidentally-removed line.

commit   : 814573e6c4889f901ba72c0c0d2c948846744c73    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 31 May 2017 13:34:41 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 31 May 2017 13:34:41 -0400    

Click here for diff

Commit 88e66d193fbaf756b3cc9bf94cad116aacbb355b is to blame.  
  
Masahiko Sawada  
  
Discussion: http://postgr.es/m/CAD21AoAXeb7O4hgg+efs8JT_SxpR4doAH5c5s-Z5WoRLstBZJA@mail.gmail.com  

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

doc: Add another migration item to release notes

commit   : 3e6d2fabccef5ed602cd248bfbedf4dc9a57eb09    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 31 May 2017 13:39:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 31 May 2017 13:39:28 -0400    

Click here for diff

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

Avoid -Wconversion warnings from direct use of GET_n_BYTES macros.

commit   : b5b322914100f7526c29c92f88c294a0ae5e7dfd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 May 2017 11:27:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 May 2017 11:27:21 -0400    

Click here for diff

The GET/SET_n_BYTES macros are meant to be infrastructure for the  
DatumGetFoo/FooGetDatum macros, which include a cast to the intended  
target type.  Using them directly without a cast, as DatumGetFloat4  
and friends previously did, can yield warnings when -Wconversion is on.  
This is of little significance when building Postgres proper, because  
there are such a huge number of such warnings in the server that nobody  
would think -Wconversion is of any use.  But some extensions build with  
-Wconversion due to outside constraints.  Commit 14cca1bf8 did a disservice  
to those extensions by moving DatumGetFloat4 et al into postgres.h,  
where they can now cause warnings in extension builds.  
  
To fix, use DatumGetInt32 and friends in place of the low-level macros.  
This is arguably a bit cleaner anyway.  
  
Chapman Flack  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/postgres.h

Sort syscache identifiers into alphabetical order.

commit   : 54e839fe29c1d071f5129eb4a112546197ea0522    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 30 May 2017 18:47:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 30 May 2017 18:47:10 -0400    

Click here for diff

Not much point in having a convention about this if we don't enforce it.  
  
Mark Dilger  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/cache/syscache.c
M src/include/utils/syscache.h

brin: Don't crash on auto-summarization

commit   : b4da9d0e1ee45a1d157dc7fd24b24745b16ebe9f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 30 May 2017 17:32:53 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 30 May 2017 17:32:53 -0400    

Click here for diff

We were trying to free a pointer into a shared buffer, which never  
works; and we were failing to release the buffer lock appropriately.  
Fix those omissions.  
  
While at it, improve documentation for brinGetTupleForHeapBlock, the  
inadequacy of which evidently caused these bugs in the first place.  
  
Reported independently by Zhou Digoal (bug #14668) and Alexander Sosna.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Fix wording in amvalidate error messages

commit   : e6785a5ca16bfe67b9c74d168ae6e88c6e55c8ac    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 30 May 2017 15:45:42 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 30 May 2017 15:45:42 -0400    

Click here for diff

Remove some gratuituous message differences by making the AM name  
previously embedded in each message be a %s instead.  While at it, get  
rid of terminology that's unclear and unnecessary in one message.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/isn/expected/isn.out
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

doc: Fix ALTER PUBLICATION details

commit   : 185364b161512806d23ca390f5b615666079699b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 30 May 2017 11:47:19 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 30 May 2017 11:47:19 -0400    

Click here for diff

Some of the text was made nonsensical by commit  
e9500240661c03750923e6f539bfa2d75cfaa32a.  Fix that and make some other  
minor changes.  
  
Reported-by: Jeff Janes <[email protected]>  

M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_subscription.sgml

Fix omission of locations in outfuncs/readfuncs partitioning node support.

commit   : 80f583ffe930b21d6e5c47be4342356e57851a9a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 30 May 2017 11:32:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 30 May 2017 11:32:41 -0400    

Click here for diff

We could have limped along without this for v10, which was my intention  
when I annotated the bug in commit 76a3df6e5.  But consensus is that it's  
better to fix it now and take the cost of a post-beta1 initdb (which is  
needed because these node types are stored in pg_class.relpartbound).  
  
Since we're forcing initdb anyway, take the opportunity to make the node  
type identification strings match the node struct names, instead of being  
randomly different from them.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/catalog/catversion.h

Fix improper quoting of format_type_be() output.

commit   : d5cb3bab564e0927ffac7c8729eacf181a12dd40    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 May 2017 21:48:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 May 2017 21:48:26 -0400    

Click here for diff

Per our message style guidelines, error messages incorporating the  
results of format_type_be() and its siblings should not add quotes  
around those results, because those functions already add quotes  
at need.  Fix a few places that hadn't gotten that memo.  

M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/typecmds.c
M src/test/regress/output/constraints.source

Make edge-case behavior of jsonb_populate_record match json_populate_record

commit   : 68cff231e3a3d0ca9988cf1fde5a3be53235b3bb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 May 2017 19:29:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 May 2017 19:29:42 -0400    

Click here for diff

json_populate_record throws an error if asked to convert a JSON scalar  
or array into a composite type.  jsonb_populate_record was returning  
a record full of NULL fields instead.  It seems better to make it  
throw an error for this case as well.  
  
Nikita Glukhov  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix thinko in JsObjectSize() macro.

commit   : e45c5be99d08d7bb6708d7bb1dd0f5d99798c6aa    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 May 2017 18:51:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 May 2017 18:51:56 -0400    

Click here for diff

The macro gave the wrong answers for a JsObject with is_json == 0:  
it would return 1 if jsonb_cont == NULL, or if that wasn't NULL,  
it would return 1 for any non-zero size.  
  
We could fix that, but the only use of this macro at present is in the  
JsObjectIsEmpty() macro, so it seems simpler and clearer to get rid of  
JsObjectSize() and put corrected logic into JsObjectIsEmpty().  
  
Thinko in commit cf35346e8, so no need for back-patch.  
  
Nikita Glukhov  
  
Discussion: https://postgr.es/m/[email protected]  

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

Prevent running pg_resetwal/pg_resetxlog against wrong-version data dirs.

commit   : f3db7f164a29c5cbdc1d6d5d0d23854df58783c1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 May 2017 17:08:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 May 2017 17:08:16 -0400    

Click here for diff

pg_resetwal (formerly pg_resetxlog) doesn't insist on finding a matching  
version number in pg_control, and that seems like an important thing to  
preserve since recovering from corrupt pg_control is a prime reason to  
need to run it.  However, that means you can try to run it against a  
data directory of a different major version, which is at best useless  
and at worst disastrous.  So as to provide some protection against that  
type of pilot error, inspect PG_VERSION at startup and refuse to do  
anything if it doesn't match.  PG_VERSION is read-only after initdb,  
so it's unlikely to get corrupted, and even if it were corrupted it would  
be easy to fix by hand.  
  
This hazard has been there all along, so back-patch to all supported  
branches.  
  
Michael Paquier, with some kibitzing by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Allow NumericOnly to be "+ FCONST".

commit   : ce509452955487c9e11d042b6a564c76600334db    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 May 2017 15:19:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 May 2017 15:19:07 -0400    

Click here for diff

The NumericOnly grammar production accepted ICONST, + ICONST, - ICONST,  
FCONST, and - FCONST, but for some reason not + FCONST.  This led to  
strange inconsistencies like  
  
regression=# set random_page_cost = +4;  
SET  
regression=# set random_page_cost = 4000000000;  
SET  
regression=# set random_page_cost = +4000000000;  
ERROR:  syntax error at or near "4000000000"  
  
(because 4000000000 is too large to be an ICONST).  While there's  
no actual functional reason to need to write a "+", if we allow  
it for integers it seems like we should allow it for numerics too.  
  
It's been like that forever, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/gram.y

More code review for get_qual_for_list().

commit   : dced55dafead62cfff81a3fedb35acd8e32c9b02    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 May 2017 14:24:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 May 2017 14:24:28 -0400    

Click here for diff

Avoid trashing the input PartitionBoundSpec; while that might be safe for  
current callers, it's certainly trouble waiting to happen.  In the same  
vein, make sure that all of the result data structure is freshly palloc'd,  
rather than some of it being pointers into the input data structures  
(which we don't know the lifespans of).  
  
Simplify the logic for tacking on IS NULL or IS NOT NULL conditions some  
more; commit 85c2b9a15 left a lot on the table there.  And rearrange the  
construction of the nodes into (what seems to me) a more logical order.  
  
In passing, make sure that get_qual_for_range() also returns a freshly  
palloc'd structure, since there's no value in having that guarantee for  
only one kind of partitioning.  And improve some comments there.  
  
Jeevan Ladhe, with further tweaking by me  
  
Discussion: https://postgr.es/m/CAOgcT0MAcYoMs93W80iTUf_dP36=1mZQzeUk+nnwY_-qWDrCfw@mail.gmail.com  

M src/backend/catalog/partition.c

Fix typo in comment

commit   : 917d91285f187e599039a962d9b869a782390304    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 29 May 2017 16:29:19 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 29 May 2017 16:29:19 +0200    

Click here for diff

Masahiko Sawada  

M src/backend/executor/execExpr.c

Fix reference to RFC specifying SCRAM.

commit   : 6fd65f6b877512eb1c35897d4c4c6779d100e459    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 29 May 2017 09:31:33 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 29 May 2017 09:31:33 +0300    

Click here for diff

Noted by Peter Eisentraut  

M doc/src/sgml/protocol.sgml

Code review focused on new node types added by partitioning support.

commit   : 76a3df6e5e621928fbf0cddf347e16a62e9433ec    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 May 2017 23:20:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 May 2017 23:20:28 -0400    

Click here for diff

Fix failure to check that we got a plain Const from const-simplification of  
a coercion request.  This is the cause of bug #14666 from Tian Bing: there  
is an int4 to money cast, but it's only stable not immutable (because of  
dependence on lc_monetary), resulting in a FuncExpr that the code was  
miserably unequipped to deal with, or indeed even to notice that it was  
failing to deal with.  Add test cases around this coercion behavior.  
  
In view of the above, sprinkle the code liberally with castNode() macros,  
in hope of catching the next such bug a bit sooner.  Also, change some  
functions that were randomly declared to take Node* to take more specific  
pointer types.  And change some struct fields that were declared Node*  
but could be given more specific types, allowing removal of assorted  
explicit casts.  
  
Place PARTITION_MAX_KEYS check a bit closer to the code it's protecting.  
Likewise check only-one-key-for-list-partitioning restriction in a less  
random place.  
  
Avoid not-per-project-style usages like !strcmp(...).  
  
Fix assorted failures to avoid scribbling on the input of parse  
transformation.  I'm not sure how necessary this is, but it's entirely  
silly for these functions to be expending cycles to avoid that and not  
getting it right.  
  
Add guards against partitioning on system columns.  
  
Put backend/nodes/ support code into an order that matches handling  
of these node types elsewhere.  
  
Annotate the fact that somebody added location fields to PartitionBoundSpec  
and PartitionRangeDatum but forgot to handle them in  
outfuncs.c/readfuncs.c.  This is fairly harmless for production purposes  
(since readfuncs.c would just substitute -1 anyway) but it's still bogus.  
It's not worth forcing a post-beta1 initdb just to fix this, but if we  
have another reason to force initdb before 10.0, we should go back and  
clean this up.  
  
Contrariwise, somebody added location fields to PartitionElem and  
PartitionSpec but forgot to teach exprLocation() about them.  
  
Consolidate duplicative code in transformPartitionBound().  
  
Improve a couple of error messages.  
  
Improve assorted commentary.  
  
Re-pgindent the files touched by this patch; this affects a few comment  
blocks that must have been added quite recently.  
  
Report: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/catalog/partition.c
M src/backend/commands/tablecmds.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/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/heap.h
M src/include/catalog/partition.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/parser/parse_utilcmd.h
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Format v10 release notes' commit references more like previous releases.

commit   : 54bb322ec7e1f7c3a674b4ea02f7010a51d51f99    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 May 2017 16:42:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 May 2017 16:42:22 -0400    

Click here for diff

Left-justify these comments, remove committer names, remove SGML markup  
that was randomly added to some of them.  Aside from being more consistent  
with previous practice, this keeps the lines shorter than 80 characters,  
improving readability in standard terminal windows.  

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

Improve v10 release notes' discussion of money operator changes.

commit   : 1c8b88ab9b72fe4c7c4193170d0810aa42b889cf    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 May 2017 15:49:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 May 2017 15:49:44 -0400    

Click here for diff

Mention the rounding behavioral change for money/int8.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid locale-dependent output in select_views regression test.

commit   : eac0a6c7d35dee6d4329b3c7d8bf82fac4c1eff1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 May 2017 14:52:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 May 2017 14:52:18 -0400    

Click here for diff

Use 'COLLATE "C"' to force locale-independent sorting of the iexit  
view results in select_views.sql.  We aren't particularly interested  
in the exact sorting behavior here, and this doesn't change the shape  
of the generated plan, so it seems like a wash as far as the goals  
of this test go.  
  
This is in response to bug #14637 from Tomasz Kontusz.  It doesn't  
fully resolve his problem, because he also saw some diffs in the  
create_index test.  But other people have had issues with select_views  
too, and this fix lets us drop the select_views_1.out variant expected  
file altogether, which is a nice win from a maintenance standpoint.  
  
Emre Hasegeli  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/select_views.out
D src/test/regress/expected/select_views_1.out
M src/test/regress/sql/select_views.sql

Fix typo in pg_dump's support for dumping collations from pre-v10 servers.

commit   : 764cb2b596ced6aea4d83fd52ff628bdedb63316    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 May 2017 15:37:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 May 2017 15:37:06 -0400    

Click here for diff

Dunno what 'p' was supposed to mean, but since neither the code below  
here nor pg_collation.h think it's valid, it must be a mistake.  
  
Per report from Thomas Kellerer.  
  
Discussion: https://postgr.es/m/og9q8f%24oes%241%40blaine.gmane.org  

M src/bin/pg_dump/pg_dump.c

Move autogenerated array types out of the way during ALTER ... RENAME.

commit   : 94aced8cd0e229670877fe5c406a98d9a4f1b92a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 May 2017 15:16:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 May 2017 15:16:59 -0400    

Click here for diff

Commit 9aa3c782c added code to allow CREATE TABLE/CREATE TYPE to not fail  
when the desired type name conflicts with an autogenerated array type, by  
dint of renaming the array type out of the way.  But I (tgl) overlooked  
that the same case arises in ALTER TABLE/TYPE RENAME.  Fix that too.  
Back-patch to all supported branches.  
  
Report and patch by Vik Fearing, modified a bit by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_type.c
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Fix pg_dump to not emit invalid SQL for an empty operator class.

commit   : 0461b66e361f56560aaa50e1bd006e36e8bedc6e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 May 2017 12:51:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 May 2017 12:51:05 -0400    

Click here for diff

If an operator class has no operators or functions, and doesn't need  
a STORAGE clause, we emitted "CREATE OPERATOR CLASS ... AS ;" which  
is syntactically invalid.  Fix by forcing a STORAGE clause to be  
emitted anyway in this case.  
  
(At some point we might consider changing the grammar to allow CREATE  
OPERATOR CLASS without an opclass_item_list.  But probably we'd want to  
omit the AS in that case, so that wouldn't fix this pg_dump issue anyway.)  
  
It's been like this all along, so back-patch to all supported branches.  
  
Daniel Gustafsson, tweaked by me to avoid a dangling-pointer bug  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Remove docs mention of PGREALM variable

commit   : 9c34a05b7d2304eac3fdc5e9db9fcd0d7c72883f    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 26 May 2017 10:58:15 -0400    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 26 May 2017 10:58:15 -0400    

Click here for diff

This variable was only used with Kerberos v4. That support was removed  
in 2005, but we forgot to remove the documentation.  
  
Noted by Shinichi Matsuda  

M doc/src/sgml/libpq.sgml

Update expected file

commit   : 08aa5506948e010dacaa344074063ccd0ecc3b21    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 25 May 2017 14:41:43 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 25 May 2017 14:41:43 -0400    

Click here for diff

Missed in ea3e310e712a.  

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

extended stats: Clarify behavior of omitting stat type clause

commit   : eb67e2e35a046f700172fbce52ad2331fe6c57ac    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 25 May 2017 13:17:57 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 25 May 2017 13:17:57 -0400    

Click here for diff

Pointed out by Jeff Janes  
Discussion: https://postgr.es/m/CAMkU=1zGhK-nW10RAXhokcT3MM=YBg=j5LkG9RMDwmu3i0H0Og@mail.gmail.com  

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

Fix message case

commit   : ea3e310e712ac53653d4100ea2a7c516c30d4971    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 25 May 2017 13:16:00 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 25 May 2017 13:16:00 -0400    

Click here for diff

M src/pl/plpython/plpy_plpymodule.c

Fix whitespace

commit   : 04f1798eaa0aeff81f90e2d28679b0a2cd267b8e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 May 2017 11:17:09 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 May 2017 11:17:09 -0400    

Click here for diff

M src/interfaces/ecpg/ecpglib/pg_type.h

Abort authentication if the client selected an invalid SASL mechanism.

commit   : 505b5d2f8672f13c98dd744a6d421da14f59cd39    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 25 May 2017 08:50:47 -0400    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 25 May 2017 08:50:47 -0400    

Click here for diff

Previously, the server would log an error, but then try to continue with  
SCRAM-SHA-256 anyway.  
  
Michael Paquier  
  
Discussion: https://www.postgresql.org/message-id/CAB7nPqR0G5aF2_kc_LH29knVqwvmBc66TF5DicvpGVdke68nKw@mail.gmail.com  

M src/backend/libpq/auth.c

Fix table syncing with different column order

commit   : 073ce405d68355eed36a11b41e558232ecf18201    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 May 2017 14:16:16 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 May 2017 14:16:16 -0400    

Click here for diff

Logical replication supports replicating between tables with different  
column order.  But this failed for the initial table sync because of a  
logic error in how the column list for the internal COPY command was  
composed.  Fix that and also add a test.  
  
Also fix a minor omission in the column name mapping cache.  When  
creating the mapping list, it would not skip locally dropped columns.  
So if a remote column had the same name as a locally dropped  
column (...pg.dropped...), then the expected error would not occur.  

M src/backend/replication/logical/relation.c
M src/backend/replication/logical/tablesync.c
M src/test/subscription/t/001_rep_changes.pl

Improve logical replication worker log messages

commit   : 92ecb148e517704ec945dce513db71fee7790cfd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 May 2017 18:56:21 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 May 2017 18:56:21 -0400    

Click here for diff

Reduce some redundant messages to DEBUG1.  Be clearer about the  
distinction between apply workers and table synchronization workers.  
Add subscription and table name where possible.  
  
Reviewed-by: Masahiko Sawada <[email protected]>  

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

Code review of get_qual_for_list.

commit   : 85c2b9a15a1d667b1e2cd580da8c1d9fef0af1e8    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 24 May 2017 16:30:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 24 May 2017 16:30:47 -0400    

Click here for diff

We need not consider the case where both nulltest1 and nulltest2 are  
NULL; the partition either accepts nulls or it does not.  
  
Jeevan Ladhe.  I added an assertion.  

M src/backend/catalog/partition.c

Tighten checks for whitespace in functions that parse identifiers etc.

commit   : 9ae2661fe1fef6b3242ecb39a2f7ffcffb2a4f70    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 24 May 2017 15:28:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 24 May 2017 15:28:34 -0400    

Click here for diff

This patch replaces isspace() calls with scanner_isspace() in functions  
that are likely to be presented with non-ASCII input.  isspace() has  
the small advantage that it will correctly recognize no-break space  
in single-byte encodings (such as LATIN1); but it cannot work successfully  
for any multibyte character, and depending on platform it might return  
false positive results for some fragments of multibyte characters.  That's  
disastrous for functions that are trying to discard whitespace between  
valid strings, as noted in bug #14662 from Justin Muise.  Even treating  
no-break space as whitespace is pretty questionable for the usages touched  
here, because the core scanner would think it is an identifier character.  
  
Affected functions are parse_ident(), parseNameAndArgTypes (underlying  
regprocedurein() and siblings), SplitIdentifierString (used for parsing  
GUCs and options that are qualified names or lists of names), and  
SplitDirectoriesString (used for parsing GUCs that are lists of  
directories).  
  
All the functions adjusted here are parsing SQL identifiers and similar  
constructs, so it's reasonable to insist that their definition of  
whitespace match the core scanner.  So we can hope that this won't cause  
many backwards-compatibility problems.  I've left alone isspace() calls  
in places that aren't really expecting any non-ASCII input characters,  
such as float8in().  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/misc.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/varlena.c

Update URLs in pgindent source and README

commit   : f61bd73993bd616ebdc0f34c204291461e3cb52e    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 23 May 2017 13:58:11 -0400    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 23 May 2017 13:58:11 -0400    

Click here for diff

Website and buildfarm is https, not http, and the ftp protocol will be  
shut down shortly.  

M src/tools/pgindent/README
M src/tools/pgindent/pgindent

Verify that the server constructed the SCRAM nonce correctly.

commit   : 1c9b6e818f047e07f1de62b4d11e0c5db2d55ab7    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 23 May 2017 05:55:19 -0400    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 23 May 2017 05:55:19 -0400    

Click here for diff

The nonce consists of client and server nonces concatenated together. The  
client checks the nonce contained the client nonce, but it would get fooled  
if the server sent a truncated or even empty nonce.  
  
Reported by Steven Fackler to [email protected]. Neither me or Steven  
are sure what harm a malicious server could do with this, but let's fix it.  

M src/interfaces/libpq/fe-auth-scram.c

Synced ecpg's pg_type.h with the one used in the backend.

commit   : d951db2eff9e31637669a1452a0260616fdb5f50    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 23 May 2017 09:48:51 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 23 May 2017 09:48:51 +0200    

Click here for diff

Patch by Vinayak Pokale.  

M src/interfaces/ecpg/ecpglib/pg_type.h

Fix typo in comment

commit   : 312bac54cc9cc26e9cee23033c5c4f029976753a    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 22 May 2017 09:10:02 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 22 May 2017 09:10:02 +0200    

Click here for diff

Author: Masahiko Sawada  

M src/backend/access/hash/hash.c

Fix precision and rounding issues in money multiplication and division.

commit   : d761fe2182d9e26f9483e4b7ac303e38bfbd7a24    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 21 May 2017 13:05:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 21 May 2017 13:05:16 -0400    

Click here for diff

The cash_div_intX functions applied rint() to the result of the division.  
That's not merely useless (because the result is already an integer) but  
it causes precision loss for values larger than 2^52 or so, because of  
the forced conversion to float8.  
  
On the other hand, the cash_mul_fltX functions neglected to apply rint() to  
their multiplication results, thus possibly causing off-by-one outputs.  
  
Per C standard, arithmetic between any integral value and a float value is  
performed in float format.  Thus, cash_mul_flt4 and cash_div_flt4 produced  
answers good to only about six digits, even when the float value is exact.  
We can improve matters noticeably by widening the float inputs to double.  
(It's tempting to consider using "long double" arithmetic if available,  
but that's probably too much of a stretch for a back-patched fix.)  
  
Also, document that cash_div_intX operators truncate rather than round.  
  
Per bug #14663 from Richard Pistole.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix contrib/sepgsql regression tests for partition NOT NULL change.

commit   : 2dd510e630cdd692bb7b2c9c092b1b352e0f6451    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 21 May 2017 11:46:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 21 May 2017 11:46:04 -0400    

Click here for diff

Commit 3ec76ff1f changed the partitioning logic to not install a forced  
NOT NULL constraint on range partitioning columns.  This affects the  
expected output for contrib/sepgsql, because there's no longer LOG  
entries reporting allowance of such a constraint.  Per buildfarm.  

M contrib/sepgsql/expected/ddl.out

Change documentation references to PG website to use https: not http:

commit   : 7f77cbd996855a06fb742ea11adbe55c42b48fe2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 20 May 2017 21:50:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 20 May 2017 21:50:47 -0400    

Click here for diff

This is more secure, and saves a redirect since we no longer accept  
plain HTTP connections on the website.  
  
References in code comments should probably be updated too, but  
that doesn't seem to need back-patching, whereas this does.  
  
Also, in the 9.2 branch, remove suggestion that you can get the  
source code via FTP, since that service will be shut down soon.  
  
Daniel Gustafsson, with a few additional changes by me  
  
Discussion: https://postgr.es/m/[email protected]  

M HISTORY
M README
M README.git
M doc/TODO
M doc/bug.template
M doc/src/sgml/acronyms.sgml
M doc/src/sgml/advanced.sgml
M doc/src/sgml/contacts.sgml
M doc/src/sgml/docguide.sgml
M doc/src/sgml/external-projects.sgml
M doc/src/sgml/info.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/problems.sgml
M doc/src/sgml/release.sgml
M doc/src/sgml/sepgsql.sgml
M doc/src/sgml/sourcerepo.sgml
M doc/src/sgml/stylesheet.xsl

Rethink flex flags for syncrep_scanner.l.

commit   : 5c837ddd7092ce9243225d12ca03fdbae136227f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 May 2017 18:05:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 May 2017 18:05:20 -0400    

Click here for diff

Using flex's -i switch to achieve case-insensitivity is not a very safe  
practice, because the scanner's behavior may then depend on the locale  
that flex was invoked in.  In the particular example at hand, that's  
not academic: the possible matches for "FIRST" will be different in a  
Turkish locale than elsewhere.  Do it the hard way instead, as our  
other scanners do.  
  
Also, drop use of -b -CF -p, because this scanner is only used when  
parsing the contents of a GUC variable.  That's not done often, and  
the amount of text to be parsed can be expected to be trivial, so  
prioritizing scanner speed over code size seems like quite the wrong  
tradeoff.  Using flex's default optimization options reduces the  
size of syncrep_gram.o by more than 50%.  
  
The case-insensitivity problem is new in HEAD (cf commit 3901fd70c).  
The poor choice of optimization flags exists also in 9.6, but it doesn't  
seem important enough to back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/Makefile
M src/backend/replication/syncrep_scanner.l

pg_upgrade: Handle hash index upgrades more smoothly.

commit   : a95410e2ec39b6776381fd01198dc57a063e8185    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 19 May 2017 16:49:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 19 May 2017 16:49:38 -0400    

Click here for diff

Mark any old hash indexes as invalid so that they don't get used, and  
create a script to run REINDEX on all of them.  Without this, we'd  
still try to use any upgraded hash indexes, but it would fail.  
  
Amit Kapila, reviewed by me.  Per a suggestion from Tom Lane.  
  
Discussion: http://postgr.es/m/CAA4eK1Jidtagm7Q81q-WoegOVgkotv0OxvHOjFxcvFRP4X=mSw@mail.gmail.com  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/version.c

Fix mistake in error message

commit   : e807d8b16338c97e60e41344d0fc13bd9cf540be    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 19 May 2017 16:30:02 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 19 May 2017 16:30:02 -0400    

Click here for diff

Reported-by: tushar <[email protected]>  
Author: Dilip Kumar <[email protected]>  

M src/backend/commands/subscriptioncmds.c

libpq: Try next host if one of them times out.

commit   : 5f374fe7a83304fd339789da22599bd102dac9e5    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 19 May 2017 16:19:51 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 19 May 2017 16:19:51 -0400    

Click here for diff

If one host in a multi-host connection string times out, move on to  
the next specified host instead of giving up entirely.  
  
Takayuki Tsunakawa, reviewed by Michael Paquier.  I added  
a minor adjustment to the documentation.  
  
Discussion: http://postgr.es/m/0A3221C70F24FB45833433255569204D1F6F42F5@G01JPEXMBYT05  

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

Capitalize SHOW when testing whether target_session_attrs=read-write.

commit   : aa41bc794c51a4d5c364cca014c199b1a00d26aa    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 19 May 2017 15:48:10 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 19 May 2017 15:48:10 -0400    

Click here for diff

This makes it also work for replication connections.  
  
Report and patch by Daisuke Higuchi.  
  
Discussion: http://postgr.es/m/1803D792815FC24D871C00D17AE95905B1A34A@g01jpexmbkw24  

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

Copy partitioned_rels lists to avoid shared substructure.

commit   : b522759508dae17535f8cd20598a50a409a97f4d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 19 May 2017 15:23:42 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 19 May 2017 15:23:42 -0400    

Click here for diff

Otherwise, set_plan_refs() can get applied to the same list  
multiple times through different references, leading to chaos.  
  
Amit Langote, Dilip Kumar, and Robert Haas, reviewed by Ashutosh  
Bapat.  Original report by Sveinn Sveinsson.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/optimizer/util/pathnode.c
M src/test/regress/expected/inherit.out
M src/test/regress/sql/inherit.sql

Fix misspelled struct tag.

commit   : cf5389f5b57af714d002d532add291f87ddb0062    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 May 2017 15:05:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 May 2017 15:05:54 -0400    

Click here for diff

This was evidently intended to match the struct's typedef name,  
but it didn't quite.  Noted while testing find_typedefs.  

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

Fix corruption of tableElts list by MergeAttributes().

commit   : ac8d7e1b834e252c9aa8d5750f70a86ca74228b8    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 19 May 2017 15:02:16 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 19 May 2017 15:02:16 -0400    

Click here for diff

Since commit e7b3349a8ad7afaad565c573fbd65fb46af6abbe, MergeAttributes  
destructively modifies the input List, to which the caller's  
CreateStmt still points.  One may wonder whether this was already a  
bug, but commit f0e44751d7175fa3394da2c8f85e3ceb3cdbfe63 made things  
noticeably worse by adding additional destructive modifications so  
that the caller's List might, in the case of creation a partitioned  
table, no longer even be structurally valid.  Restore the status quo  
ante by assigning the return value of MergeAttributes back to  
stmt->tableElts in the caller.  
  
In most of the places where DefineRelation is called, it doesn't  
matter what stmt->tableElts points to here or whether it's valid or  
not, because the caller doesn't use the statement for anything after  
DefineRelation returns anyway.  However, ProcessUtilitySlow passes it  
to EventTriggerCollectSimpleCommand, and that function tries to invoke  
copyObject on it.  If any of the CreateStmt's substructure is invalid  
at that point, undefined behavior will result.  
  
One might wonder whether this whole area needs further revision -  
perhaps DefineRelation() ought not to be destructively modifying the  
caller-provided CreateStmt at all.  However, that would be a behavior  
change for any event triggers using C code to inspect the CreateStmt,  
so for now, just fix the crash.  
  
Report by Amit Langote, who provided a somewhat different patch for it.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

Fix argument name differences

commit   : 7f17ae0ad07a76eeb1b26e7aa8c4539ce14b253b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 19 May 2017 14:47:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 19 May 2017 14:47:56 -0400    

Click here for diff

Different names were used between function declaration and definition.  

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

doc: remove duplicate PG 10 release notes entry

commit   : f6d5d22ea9497aecdfdfa92717a11f0bcdf17223    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 19 May 2017 12:16:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 19 May 2017 12:16:53 -0400    

Click here for diff

Reported-by: Daniel Gustafsson  

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

doc: fix PG 10 release notes with proper attribution and commit

commit   : f45d86d762b8bcdac42d5448734016242a1d738b    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 19 May 2017 12:10:10 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 19 May 2017 12:10:10 -0400    

Click here for diff

Fix for hot_standby=on change.  
  
Reported-by: Huong Dangminh  
  
Author: Huong Dangminh  

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

Fix compilation with --with-bsd-auth.

commit   : 866490a6b72c625c29ced23065d367a1b0484760    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 19 May 2017 12:21:55 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 19 May 2017 12:21:55 +0300    

Click here for diff

Commit 8d3b9cce81 added extra arguments to the sendAuthRequest function,  
but neglected this caller inside #ifdef USE_BSD_AUTH.  
  
Per report from Pierre-Emmanuel AndrƩ.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/libpq/auth.c

doc: Fix ALTER SUBSCRIPTION option syntax synopsis

commit   : f4205c4c1fcfc88d0c3885c160f24873bcbcc04d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 May 2017 21:37:57 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 May 2017 21:37:57 -0400    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

M doc/src/sgml/ref/alter_subscription.sgml

Make slab allocator work on platforms with MAXIMUM_ALIGNOF < sizeof(int).

commit   : 94884e1c27ccd38bf494fc7f5aa46b269bbb6c9c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 18 May 2017 22:22:13 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 18 May 2017 22:22:13 +0300    

Click here for diff

Notably, m68k only needs 2-byte alignment. Per report from Christoph Berg.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/utils/mmgr/slab.c

Don't explicitly mark range partitioning columns NOT NULL.

commit   : 3ec76ff1f2cf52e9b900349957b42d28128b7bc7    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 May 2017 13:48:10 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 May 2017 13:48:10 -0400    

Click here for diff

This seemed like a good idea originally because there's no way to mark  
a range partition as accepting NULL, but that now seems more like a  
current limitation than something we want to lock down for all time.  
For example, there's a proposal to add the notion of a default  
partition which accepts all rows not otherwise routed, which directly  
conflicts with the idea that a range-partitioned table should never  
allow nulls anywhere.  So let's change this while we still can, by  
putting the NOT NULL test into the partition constraint instead of  
changing the column properties.  
  
Amit Langote and Robert Haas, reviewed by Amit Kapila  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/partition.c
M src/backend/commands/tablecmds.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/insert.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql

Fix typo in comment.

commit   : 2df537e43fdc432cccbe64de166ac97363cbca3c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 18 May 2017 10:33:16 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 18 May 2017 10:33:16 +0300    

Click here for diff

Daniel Gustafsson  

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

pg_dump: Fix dumping of slot_name = NONE

commit   : 157239d2cdad8fdc19afc13269c852dbddbe290b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 17 May 2017 21:19:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 17 May 2017 21:19:14 -0400    

Click here for diff

It previously wrote out slot_name = '', which was incorrect.  
  
Reported-by: Masahiko Sawada <[email protected]>  

M src/bin/pg_dump/pg_dump.c

Improve CREATE SUBSCRIPTION option parsing

commit   : 62345698513cbcb3c48a6dae414abf0f24fd163a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 17 May 2017 20:47:37 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 17 May 2017 20:47:37 -0400    

Click here for diff

When creating a subscription with slot_name = NONE, we failed to check  
that also create_slot = false and enabled = false were set.  This  
created an invalid subscription and could later lead to a crash if a  
NULL slot name was accessed.  Add more checks around that for  
robustness.  
  
Reported-by: tushar <[email protected]>  

M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/worker.c
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql

Post-PG 10 beta1 pgperltidy run

commit   : ce554810329b9b8e862eade08b598148931eb456    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 17 May 2017 19:01:23 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 17 May 2017 19:01:23 -0400    

Click here for diff

M contrib/intarray/bench/bench.pl
M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/backend/parser/check_keywords.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/003_promote.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/t/200_connstr.pl
M src/common/unicode/generate-unicode_norm_table.pl
M src/interfaces/libpq/test/regress.pl
M src/pl/plperl/plc_perlboot.pl
M src/pl/plperl/plc_trusted.pl
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/modules/commit_ts/t/002_standby.pl
M src/test/modules/commit_ts/t/004_restart.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/007_sync_rep.pl
M src/test/recovery/t/008_fsm_truncation.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/011_crash_recovery.pl
M src/test/recovery/t/012_subtransactions.pl
M src/test/ssl/ServerSetup.pm
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/tools/fix-old-flex-code.pl
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/gendef.pl
M src/tools/msvc/pgflex.pl
M src/tools/msvc/vcregress.pl
M src/tools/pgindent/pgindent

Post-PG 10 beta1 pgindent run

commit   : a6fd7b7a5f7bf3a8aa3f3d076cf09d922c1c6dd2    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 17 May 2017 16:31:56 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 17 May 2017 16:31:56 -0400    

Click here for diff

perltidy run not included.  

M contrib/bloom/blinsert.c
M contrib/bloom/blutils.c
M contrib/btree_gin/btree_gin.c
M contrib/btree_gist/btree_cash.c
M contrib/btree_gist/btree_date.c
M contrib/btree_gist/btree_enum.c
M contrib/btree_gist/btree_float4.c
M contrib/btree_gist/btree_float8.c
M contrib/btree_gist/btree_inet.c
M contrib/btree_gist/btree_int2.c
M contrib/btree_gist/btree_int4.c
M contrib/btree_gist/btree_int8.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_oid.c
M contrib/btree_gist/btree_time.c
M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_utils_num.h
M contrib/btree_gist/btree_utils_var.c
M contrib/btree_gist/btree_utils_var.h
M contrib/btree_gist/btree_uuid.c
M contrib/dblink/dblink.c
M contrib/oid2name/oid2name.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/rawpage.c
M contrib/pg_standby/pg_standby.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pgcrypto/openssl.c
M contrib/pgcrypto/pgcrypto.c
M contrib/pgrowlocks/pgrowlocks.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/pgstattuple/pgstatindex.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/common/printsimple.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashutil.c
M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/rmgrdesc/brindesc.c
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/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/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_subscription.c
M src/backend/commands/alter.c
M src/backend/commands/analyze.c
M src/backend/commands/collationcmds.c
M src/backend/commands/copy.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuumlazy.c
M src/backend/commands/view.c
M src/backend/executor/execAmi.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execReplication.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/spi.c
M src/backend/lib/rbtree.c
M src/backend/libpq/auth.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/backend/libpq/pqcomm.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/tidbitmap.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/planner.c
M src/backend/optimizer/plan/setrefs.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/parser/analyze.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_utilcmd.c
M src/backend/port/posix_sema.c
M src/backend/postmaster/bgworker.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/syslogger.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/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/rewriteHandler.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mvdistinct.c
M src/backend/storage/file/fd.c
M src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/smgr/md.c
M src/backend/tcop/utility.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/wparser.c
M src/backend/utils/adt/cash.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/txid.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/xml.c
M src/backend/utils/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/syscache.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/backend/utils/mb/encnames.c
M src/backend/utils/misc/backend_random.c
M src/backend/utils/misc/guc.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/time/snapmgr.c
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_test_timing/pg_test_timing.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/psql/conditional.h
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/tab-complete.c
M src/common/file_utils.c
M src/common/saslprep.c
M src/common/scram-common.c
M src/common/sha2_openssl.c
M src/common/unicode_norm.c
M src/include/access/brin.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/hash.h
M src/include/access/hash_xlog.h
M src/include/access/relscan.h
M src/include/access/twophase.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlogreader.h
M src/include/access/xlogutils.h
M src/include/c.h
M src/include/catalog/dependency.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/commands/createas.h
M src/include/commands/explain.h
M src/include/commands/subscriptioncmds.h
M src/include/common/file_utils.h
M src/include/common/scram-common.h
M src/include/executor/executor.h
M src/include/executor/nodeGatherMerge.h
M src/include/executor/spi.h
M src/include/executor/tablefunc.h
M src/include/lib/simplehash.h
M src/include/libpq/hba.h
M src/include/mb/pg_wchar.h
M src/include/nodes/execnodes.h
M src/include/nodes/makefuncs.h
M src/include/nodes/parsenodes.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/parser/parse_func.h
M src/include/parser/parse_node.h
M src/include/parser/parse_oper.h
M src/include/replication/logical.h
M src/include/replication/logicallauncher.h
M src/include/replication/logicalproto.h
M src/include/replication/logicalrelation.h
M src/include/replication/pgoutput.h
M src/include/replication/snapbuild.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h
M src/include/replication/worker_internal.h
M src/include/statistics/extended_stats_internal.h
M src/include/storage/condition_variable.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/tcop/utility.h
M src/include/utils/jsonapi.h
M src/include/utils/lsyscache.h
M src/include/utils/pg_locale.h
M src/include/utils/plancache.h
M src/include/utils/queryenvironment.h
M src/include/utils/regproc.h
M src/include/utils/rel.h
M src/include/utils/varlena.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-fe.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_typeio.c
M src/pl/tcl/pltcl.c
M src/port/dirmod.c
M src/test/regress/regress.c
M src/tools/testint128.c

Update typedefs list in prep. for post-PG10 beta1 pgindent run

commit   : 8a943324780259757c77c56cfc597347d1150cdb    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 17 May 2017 15:52:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 17 May 2017 15:52:16 -0400    

Click here for diff

M src/tools/pgindent/typedefs.list

Add download URL for perltidy version v20090616

commit   : df238b43d76fb8e08469f418f570690651baaa7a    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 17 May 2017 15:29:37 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 17 May 2017 15:29:37 -0400    

Click here for diff

M src/tools/pgindent/README

Code review for make_partition_op_expr.

commit   : b2e4399baaa805a046b7ffa155c666c80bbf8429    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 17 May 2017 14:31:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 17 May 2017 14:31:48 -0400    

Click here for diff

It's better to use the actual keynum here rather than 0, because  
someday someone might try to make list partitioning work with  
multiple partitioning columns.  
  
Jeevan Ladhe  
  
Discussion: http://postgr.es/m/CAOgcT0M6-mx+dSX47JGJuJP1CKr4XssBFVmKNETt0OZYWpFr+w@mail.gmail.com  

M src/backend/catalog/partition.c

Revert changes to pg_basebackup and pg_waldump usage() code.

commit   : 05b5feb60e7cf36db08eb0d34dbd21854cb9e8ce    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 May 2017 13:04:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 May 2017 13:04:03 -0400    

Click here for diff

Partially revert commit c079673dcb7f210617c9fc1470e6bf166d8a2971.  
There were complaints that splitting switch descriptions would  
complicate translation efforts.  There are probably ways to resolve  
the formatting problem without doing that, but undo it while we're  
discussing.  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_waldump/pg_waldump.c

Remove redundant has_null member from PartitionBoundInfoData.

commit   : 236d6d462d2c8e4ae4ce04572cea6fe3ccc724cb    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 17 May 2017 12:48:16 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 17 May 2017 12:48:16 -0400    

Click here for diff

Jeevan Ladhe, with some changes by me.  
  
Discussion: http://postgr.es/m/CAOgcT0NZ_30-pjBpW2OgneV1ammArHkZDZ8B_KFC3q+_Xb2H9A@mail.gmail.com  

M src/backend/catalog/partition.c

Add more tests for CREATE SUBSCRIPTION

commit   : 3db22794b76eb0548f002f02a607ebcd101fc68e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 17 May 2017 12:22:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 17 May 2017 12:22:56 -0400    

Click here for diff

Add some tests for parsing different option combinations.  Fix some of  
the resulting error messages for recent changes in option naming.  
  
Author: Masahiko Sawada <[email protected]>  

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

Make psql handle EOF during COPY FROM STDIN properly on all platforms.

commit   : 9485516ea2bf3b3ff36020bec03cbb752d8a204c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 May 2017 12:24:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 May 2017 12:24:19 -0400    

Click here for diff

When stdin is a terminal, it's possible to end a COPY FROM STDIN with  
a keyboard EOF signal (typically control-D), and then keep on issuing  
SQL commands.  One would expect another COPY FROM STDIN to work as well,  
but on some platforms it did not.  This turns out to be because we were  
not resetting the stream's feof() flag, and BSD-ish versions of fread()  
and fgets() won't attempt to read more data if that's set.  
  
The misbehavior is observed on BSDen (including macOS), but not Linux,  
Windows, or SysV-ish Unixen, which makes this a portability bug not  
just a missing feature.  
  
Add a clearerr() call to fix the behavior, and improve the prompt that's  
issued when copying from a TTY to mention that EOF signals work.  
  
It's been like this forever, so back-patch to all supported branches.  
  
Thomas Munro  
  
Discussion: https://postgr.es/m/CAEepm=0MCGfYf=JAMiYhO6JPtv9-3ZfBo8fcGeCZ8oMzaw+Z+Q@mail.gmail.com  

M src/bin/psql/copy.c

Check relkind of tables in CREATE/ALTER SUBSCRIPTION

commit   : 944dc0f9cec7c3d33648f41aaecfbd976106e975    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 May 2017 22:57:16 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 May 2017 22:57:16 -0400    

Click here for diff

We used to only check for a supported relkind on the subscriber during  
replication, which is needed to ensure that the setup is valid and we  
don't crash.  But it's also useful to tell the user immediately when  
CREATE or ALTER SUBSCRIPTION is executed that the relation being added  
to the subscription is not of a supported relkind.  
  
Author: Petr Jelinek <[email protected]>  
Reported-by: tushar <[email protected]>  

M src/backend/commands/subscriptioncmds.c
M src/backend/executor/execReplication.c
M src/backend/replication/logical/relation.c
M src/include/executor/executor.h

psql: publication/subscription tab completion fixes

commit   : 0fbfb65d4bfd429651dc28faf3ad1846c965e18d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 May 2017 22:19:21 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 May 2017 22:19:21 -0400    

Click here for diff

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

Preventive maintenance in advance of pgindent run.

commit   : c079673dcb7f210617c9fc1470e6bf166d8a2971    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 May 2017 20:36:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 May 2017 20:36:35 -0400    

Click here for diff

Reformat various places in which pgindent will make a mess, and  
fix a few small violations of coding style that I happened to notice  
while perusing the diffs from a pgindent dry run.  
  
There is one actual bug fix here: the need-to-enlarge-the-buffer code  
path in icu_convert_case was obviously broken.  Perhaps it's unreachable  
in our usage?  Or maybe this is just sadly undertested.  

M contrib/btree_gist/btree_utils_num.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/tsearch/wparser.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/pg_locale.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_waldump/pg_waldump.c
M src/bin/psql/tab-complete.c
M src/common/scram-common.c
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_subscription_rel.h
M src/include/replication/logicalproto.h
M src/interfaces/libpq/libpq-int.h

Fix leakage of memory context header in find_all_inheritors().

commit   : ddd243584a0f353bbaba260d976cc41b251bbf21    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 May 2017 19:33:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 May 2017 19:33:31 -0400    

Click here for diff

Commit 827d6f977 contained the same misunderstanding of hash_create's API  
as commit 090010f2e.  As in 5d00b764c, remove the unnecessary layer of  
memory context.  (This bug is less significant than the other one, since  
the extra context would be under a relatively short-lived context, but  
it's still a bug.)  

M src/backend/catalog/pg_inherits.c

Revert "Add a test for transition table usage in FOR EACH ROW trigger."

commit   : a19ea9c6601bfb06dfd9f4c1060550dbc3f7bde1    
  
author   : Kevin Grittner <[email protected]>    
date     : Tue, 16 May 2017 17:15:33 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Tue, 16 May 2017 17:15:33 -0500    

Click here for diff

This reverts commit 4a03f935b3438de27ee00d9e562ffe4e225978a9.  

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

Add a test for transition table usage in FOR EACH ROW trigger.

commit   : 4a03f935b3438de27ee00d9e562ffe4e225978a9    
  
author   : Kevin Grittner <[email protected]>    
date     : Tue, 16 May 2017 16:09:55 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Tue, 16 May 2017 16:09:55 -0500    

Click here for diff

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

Try to ensure that stats collector's receive buffer size is at least 100KB.

commit   : 8b0b6303e991079726e83d17401405e94da11564    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 May 2017 15:24:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 May 2017 15:24:52 -0400    

Click here for diff

Since commit 4e37b3e15, buildfarm member frogmouth has been failing  
occasionally with symptoms indicating that some expected stats data is  
getting dropped.  The reason that that commit changed the behavior seems  
probably to be that more data is getting shoved at the collector in a short  
span of time.  In current sources, the stats test's first session sends  
about 9KB of data while exiting, which is probably the same as what was  
sent just before wait_for_stats() in the previous test design.  But now,  
the test's second session is starting up concurrently, and it sends another  
2KB (presumably reflecting its initial catalog accesses).  Since frogmouth  
is running on Windows XP, which reputedly has a default socket receive  
buffer size of only 8KB, it is not very surprising if this has put us over  
the threshold where the receive buffer can overflow and drop messages.  
  
The same mechanism could very easily explain the intermittent stats test  
failures we've been seeing for years, since background processes such  
as the bgwriter will sometimes send data concurrently with all this, and  
could thus cause occasional buffer overflows.  
  
Hence, insert some code into pgstat_init() to increase the stats socket's  
receive buffer size to 100KB if it's less than that.  (On failure, emit a  
LOG message, but keep going.)  Modern systems seem to have default sizes  
in the range of 100KB-250KB, but older platforms don't.  I couldn't find  
any platforms that wouldn't accept 100KB, so in theory this won't cause  
any portability problems.  
  
If this is successful at reducing the buildfarm failure rate in HEAD,  
we should back-patch it, because it's certain that similar buffer overflows  
happen in the field on platforms with small buffer sizes.  Going forward,  
there might be an argument for trying to increase the buffer size even  
more, but let's take a baby step first.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c

Fix relcache leak when row triggers on partitions are fired by COPY.

commit   : 59f40566cab95181ec132b3f0208f34e4c67f2b0    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 16 May 2017 12:46:32 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 16 May 2017 12:46:32 -0400    

Click here for diff

Thomas Munro, reviewed by Amit Langote  
  
Discussion: http://postgr.es/m/CAEepm=15Jss-yhFApuKzxcoCuFnb8TR8iQiWMjG=CLYPx48QLw@mail.gmail.com  

M src/backend/commands/copy.c
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/include/executor/executor.h
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

doc: Remove unnecessary RETURN statements from example.

commit   : 8e709a612f4c10cdc4b19a734cd67ac019d0a2ec    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 16 May 2017 11:35:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 16 May 2017 11:35:23 -0400    

Click here for diff

Paul Jungwirth, reviewed by Ashutosh Bapat.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/plpgsql.sgml

In SSL tests, don't scribble on permissions of a repo file.

commit   : 91102dab44c3406f21bbbc28c1032d49e0721710    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 May 2017 23:27:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 May 2017 23:27:51 -0400    

Click here for diff

Modifying the permissions of a persistent file isn't really much nicer  
than modifying its contents, even if git doesn't currently notice it.  
Adjust the test script to make a copy and set the permissions of that  
instead.  
  
Michael Paquier, per a gripe from me.  Back-patch to 9.5 where these  
tests were introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Update CREATE SUBSCRIPTION docs for recent syntax change.

commit   : 6accefd46639db9f20bcc4c2e15c9844bae0d184    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 May 2017 22:06:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 May 2017 22:06:27 -0400    

Click here for diff

Masahiko Sawada  

M doc/src/sgml/ref/create_subscription.sgml

Stamp 10beta1.

commit   : 5ad367a35b58a02686558a0189ef74f123ac85ba    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 May 2017 17:20:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 May 2017 17:20:59 -0400    

Click here for diff

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

git-ignore intermediate files from new docs toolchain.

commit   : 1aedcf98181602890ea8899202a7143543f9785a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 May 2017 15:48:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 May 2017 15:48:23 -0400    

Click here for diff

Building PDFs with the new toolchain creates *.fo temporary files.  

M doc/src/sgml/.gitignore

Add missing apostrophe.

commit   : 0ad226f2ae55620107eb61591d2f96236aec477c    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 15 May 2017 15:41:15 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 15 May 2017 15:41:15 -0400    

Click here for diff

Masahiko Sawada  
  
Discussion: http://postgr.es/m/CAD21AoAzaR_XV7j7Wk9-QYXaFoT8H4egKwXvFY63wc8Lw2C9cg@mail.gmail.com  

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

Update oidjoins regression test for v10.

commit   : e3f67a5a1732321dfa094e14c083dc482ad066b4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 May 2017 14:04:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 May 2017 14:04:03 -0400    

Click here for diff

M src/test/regress/expected/oidjoins.out
M src/test/regress/sql/oidjoins.sql
M src/tools/findoidjoins/README

Add assertion to quiet Coverity

commit   : b1ff33fd9bb82937f4719f264972e6a3c83cdb89    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 15 May 2017 13:59:58 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 15 May 2017 13:59:58 -0400    

Click here for diff

M src/backend/commands/subscriptioncmds.c

Translation updates

commit   : 82d24bab75d4f85ae7a6d89f149d29fbb2ccbc70    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 15 May 2017 12:19:54 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 15 May 2017 12:19:54 -0400    

Click here for diff

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

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

doc: Remove unused file

commit   : 4b99d32b2b0de97063b85a0ea69d482d8a4bf075    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 15 May 2017 12:09:19 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 15 May 2017 12:09:19 -0400    

Click here for diff

sql.sgml has not been part of the documentation since forever, so it's  
pointless to keep it around.  

M doc/src/sgml/filelist.sgml
D doc/src/sgml/sql.sgml

Fix bogus syntax for CREATE PUBLICATION commands emitted by pg_dump.

commit   : 4041808b5b70433206b37e1305c807c325b06713    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 May 2017 11:48:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 May 2017 11:48:39 -0400    

Click here for diff

Original coding was careless about where to insert commas.  
  
Masahiko Sawada  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Fix unsafe reference into relcache in constructed CommentStmt.

commit   : 12590c5d33d013e55995c0c0ea6c70262a6d13b3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 May 2017 11:33:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 May 2017 11:33:44 -0400    

Click here for diff

The CommentStmt made by RebuildConstraintComment() has to pstrdup the  
relation name, else it will contain a dangling pointer after that  
relcache entry is flushed.  (I'm less sure that pstrdup'ing conname  
is necessary, but let's be safe.)  Failure to do this leads to weird  
errors or crashes, as reported by Marko Elezovic.  
  
Bug introduced by commit e42375fc8, so back-patch to 9.5 as that was.  
  
Fix by David Rowley, regression test by Michael Paquier  
  
Discussion: https://postgr.es/m/DB6PR03MB30775D58E732D4EB0C13725B9AE00@DB6PR03MB3077.eurprd03.prod.outlook.com  

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

Fix ALTER SEQUENCE locking

commit   : f8dc1985fd390774aab4ab0ba71036d6d5e631a9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 May 2017 23:35:31 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 May 2017 23:35:31 -0400    

Click here for diff

In 1753b1b027035029c2a2a1649065762fafbf63f3, the pg_sequence system  
catalog was introduced.  This made sequence metadata changes  
transactional, while the actual sequence values are still behaving  
nontransactionally.  This requires some refinement in how ALTER  
SEQUENCE, which operates on both, locks the sequence and the catalog.  
  
The main problems were:  
  
- Concurrent ALTER SEQUENCE causes "tuple concurrently updated" error,  
  caused by updates to pg_sequence catalog.  
  
- Sequence WAL writes and catalog updates are not protected by same  
  lock, which could lead to inconsistent recovery order.  
  
- nextval() disregarding uncommitted ALTER SEQUENCE changes.  
  
To fix, nextval() and friends now lock the sequence using  
RowExclusiveLock instead of AccessShareLock.  ALTER SEQUENCE locks the  
sequence using ShareRowExclusiveLock.  This means that nextval() and  
ALTER SEQUENCE block each other, and ALTER SEQUENCE on the same sequence  
blocks itself.  (This was already the case previously for the OWNER TO,  
RENAME, and SET SCHEMA variants.)  Also, rearrange some code so that the  
entire AlterSequence is protected by the lock on the sequence.  
  
As an exception, use reduced locking for ALTER SEQUENCE ... RESTART.  
Since that is basically a setval(), it does not require the full locking  
of other ALTER SEQUENCE actions.  So check whether we are only running a  
RESTART and run with less locking if so.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reported-by: Jason Petersen <[email protected]>  
Reported-by: Andres Freund <[email protected]>  

M doc/src/sgml/ref/alter_sequence.sgml
M src/backend/commands/sequence.c
A src/test/isolation/expected/sequence-ddl.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/sequence-ddl.spec

Fix typo in comment

commit   : b1c45afb01248f5d6d6d2f0761a35843576f940f    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 15 May 2017 11:08:02 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 15 May 2017 11:08:02 +0200    

Click here for diff

Michael Paquier  

M src/bin/pg_basebackup/pg_basebackup.c

stats regression test's wait_for_stats() must check timestamp too.

commit   : eda4ef81511ea62e49f5ea9edb8fbfdd529dd959    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 23:33:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 23:33:03 -0400    

Click here for diff

pg_stat_get_snapshot_timestamp() returns the timestamp seen in the "global"  
stats file.  Because pgstat_write_statsfiles() writes per-DB stats files  
before the global file (or at least before renaming it into place), there  
is a window where the test backend can see all the stats updates that  
wait_for_stats() was checking for (all of which come from the per-DB file)  
but also see the same global stats file it had seen at the start of the  
test script.  This results in a failure in only the "snapshot_newer" query,  
as reported by a couple of buildfarm members recently.  
  
I suspect that this ought to be back-patched.  Commit 4e37b3e15 has  
evidently increased the probability of this window getting hit, but  
it's not apparent why it could not have been hit before.  I'll refrain  
for the moment though.  

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

doc: update the "current as of" date in the PG 10 release notes

commit   : de7cca982ca253236051c2a7f6477bee5ce4b045    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 14 May 2017 23:15:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 14 May 2017 23:15:43 -0400    

Click here for diff

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

Make pgstat tabstat lookup hash table less fragile.

commit   : 5d00b764cd682f6071b35033f508a431d9d3f920    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 22:52:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 22:52:41 -0400    

Click here for diff

Code review for commit 090010f2e.  
  
Fix cases where an elog(ERROR) partway through a function would leave the  
persistent data structures in a corrupt state.  pgstat_report_stat got this  
wrong by invalidating PgStat_TableEntry structs before removing hashtable  
entries pointing to them, and get_tabstat_entry got it wrong by ignoring  
the possibility of palloc failure after it had already created a hashtable  
entry.  
  
Also, avoid leaking a memory context per transaction, which the previous  
code did through misunderstanding hash_create's API.  We do not need to  
create a context to hold the hash table; hash_create will do that.  
(The leak wasn't that large, amounting to only a memory context header  
per iteration, but it's still surprising that nobody noticed it yet.)  

M src/backend/postmaster/pgstat.c

doc: update PG 10 release notes for recent changes

commit   : b91e5b4684d840c903a78e86700b9d906033c2ad    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 14 May 2017 22:45:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 14 May 2017 22:45:11 -0400    

Click here for diff

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

Make stats regression test more robust in the face of parallel query.

commit   : 7606bbb3de48b35f6fc0c918b39cd4be82de8848    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 21:39:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 21:39:10 -0400    

Click here for diff

Commit 60690a6fe attempted to fix the wait_for_stats() function in this  
test so that it would wait properly if the tenk2 scans were done in  
parallel workers instead of the main session (typically as a consequence of  
force_parallel_mode being turned on).  However, we made it test for whether  
the main session's actions had been reported by looking for inserts on  
'trunc_stats_test'.  This is the Wrong Thing, because those aren't the last  
updates we expect the main session to do.  As shown by recent failures on  
buildfarm member frogmouth, it's entirely likely that the trunc_stats_test  
updates will be reported in a separate message from later updates, which  
means there can be a window in which wait_for_stats() will exit but not all  
the updates we are expecting to see will have arrived.  We should test for  
the last updates we're expecting, namely those on 'trunc_stats_test4'.  
  
Unfortunately, I doubt that this explains frogmouth's failures, because  
there's no reason to believe that it's running the tenk2 queries in  
parallel.  Still, the test is wrong on its own terms, so fix and back-patch  
to 9.6 where parallel query came in.  

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

Attempt to fix compiler warning.

commit   : edbe2a29365e0358387db92db0ccd5260d2bc7b1    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 14 May 2017 20:59:28 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 14 May 2017 20:59:28 -0400    

Click here for diff

Per a report from Tom Lane, newer versions of gcc apparently think  
that partexprs_item_saved can be used uninitialized.  Try to convince  
them otherwise.  

M src/backend/catalog/partition.c

commit   : 93ece9cc887239deef6539d607063d98aa03aff3    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 19:15:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 19:15:52 -0400    

Click here for diff

Use the "statistics object" terminology uniformly here too.  Assorted  
copy-editing.  Put new catalogs.sgml sections into alphabetical order.  

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

Fix maintenance hazards caused by ill-considered use of default: cases.

commit   : e84c0195980f24b1c7f857b88834c1dcaf20a102    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 13:32:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 13:32:59 -0400    

Click here for diff

Remove default cases from assorted switches over ObjectClass and some  
related enum types, so that we'll get compiler warnings when someone  
adds a new enum value without accounting for it in all these places.  
  
In passing, re-order some switch cases as needed to match the declaration  
of enum ObjectClass.  OK, that's just neatnik-ism, but I dislike code  
that looks like it was assembled with the help of a dartboard.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/alter.c
M src/backend/commands/event_trigger.c

Fix handling of extended statistics during ALTER COLUMN TYPE.

commit   : b5b0db19b895f033ada35bc7c337183be7356977    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 12:22:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 12:22:16 -0400    

Click here for diff

ALTER COLUMN TYPE on a column used by a statistics object fails since  
commit 928c4de30, because the relevant switch in ATExecAlterColumnType  
is unprepared for columns to have dependencies from OCLASS_STATISTIC_EXT  
objects.  
  
Although the existing types of extended statistics don't actually need us  
to do any work for a column type change, it seems completely indefensible  
that that assumption is hidden behind the failure of an unrelated module  
to contain any code for the case.  Hence, create and call an API function  
in statscmds.c where the assumption can be explained, and where we could  
add code to deal with the problem when it inevitably becomes real.  
  
Also, the reason this wasn't handled before, neither for extended stats  
nor for the last half-dozen new OCLASS kinds :-(, is that the default:  
in that switch suppresses compiler warnings, allowing people to miss the  
need to consider it when adding an OCLASS.  We don't really need a default  
because surely getObjectClass should only return valid values of the enum;  
so remove it, and add the missed OCLASS entries where they should be.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/include/commands/defrem.h
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Update config.guess and config.sub

commit   : 65b655b53ec1cb91fda0d34e5176f8cdcfcf2e3d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 14 May 2017 11:09:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 14 May 2017 11:09:34 -0400    

Click here for diff

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

Remove no-longer-needed fields of Hash plan nodes.

commit   : f6747434873693e001737ca06c30dcbcc2320b20    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 11:07:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 11:07:40 -0400    

Click here for diff

skewColType/skewColTypmod are no longer used in the wake of commit  
9aab83fc5, and seem unlikely to be wanted in future, so let's drop 'em.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/include/nodes/plannodes.h

Standardize terminology for pg_statistic_ext entries.

commit   : f04c9a61468904b6815b2bc73a48878817766e0e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 10:54:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 May 2017 10:54:47 -0400    

Click here for diff

Consistently refer to such an entry as a "statistics object", not just  
"statistics" or "extended statistics".  Previously we had a mismash of  
terms, accompanied by utter confusion as to whether the term was  
singular or plural.  That's not only grating (at least to the ear of  
a native English speaker) but could be outright misleading, eg in error  
messages that seemed to be referring to multiple objects where only one  
could be meant.  
  
This commit fixes the code and a lot of comments (though I may have  
missed a few).  I also renamed two new SQL functions,  
pg_get_statisticsextdef -> pg_get_statisticsobjdef  
pg_statistic_ext_is_visible -> pg_statistics_obj_is_visible  
to conform better with this terminology.  
  
I have not touched the SGML docs other than fixing those function  
names; the docs certainly need work but it seems like a separable task.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/catalog/aclchk.c
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/alter.c
M src/backend/commands/dropcmds.c
M src/backend/commands/statscmds.c
M src/backend/optimizer/util/plancat.c
M src/backend/statistics/README
M src/backend/statistics/README.dependencies
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mvdistinct.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/namespace.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_statistic_ext.h
M src/include/utils/acl.h
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/stats_ext.sql

Suppress indentation from Data::Dumper in regression tests

commit   : 12ad38b3b4b5004001a525e0a0eda2ec45329e8e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 14 May 2017 01:10:18 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 14 May 2017 01:10:18 -0400    

Click here for diff

Ultra-modern versions of the perl Data::Dumper module have apparently  
changed how they indent output. Instead of trying to keep up we choose  
to tell it to supporess all indentation in the hstore_plperl regression  
tests.  
  
Backpatch to 9.5 where this feature was introduced.  

M contrib/hstore_plperl/expected/hstore_plperlu.out
M contrib/hstore_plperl/sql/hstore_plperlu.sql

Specify --outputdir for isolation install check, not just plain check.

commit   : 29c7d5e4844443acaa74a0d06dd6c70b320bb315    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 13 May 2017 15:13:17 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 13 May 2017 15:13:17 -0700    

Click here for diff

This should probably have been part of 60f826c5e62.  
  
Reported-By: Andrew Gierth  

M src/Makefile.global.in

Avoid superfluous work for commits during logical slot creation.

commit   : 524dbc14335cde0b18745f05a9112436d212f061    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 13 May 2017 14:47:41 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 13 May 2017 14:47:41 -0700    

Click here for diff

Before 955a684e0401 logical decoding snapshot maintenance needed to  
cope with transactions it might not have seen in their entirety. For  
such transactions we'd to assume they modified the catalog (could have  
happened before we were watching), and thus a new snapshot had to be  
built, and distributed to concurrently running transactions.  
  
That's problematic because building a new snapshot isn't that cheap ,  
especially as the the array of committed transactions needs to be  
sorted.  When creating a slot on a server with a lot of transactions,  
this could make logical slot creation infeasibly expensive.  
  
After 955a684e0401 there's no need to deal with transaction that  
aren't guaranteed to be fully observable.  That allows to avoid  
building snapshots for transactions that haven't modified catalog,  
even before reaching consistency.  
  
While this isn't necessarily a bugfix, slot creation being impossible  
in some production workloads, is severe enough to warrant  
backpatching.  
  
Author: Andres Freund, based on a quite different patch from Petr Jelinek  
Analyzed-By: Petr Jelinek  
Reviewed-By: Petr Jelinek  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4-, where logical decoding has been introduced  

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

Fix race condition leading to hanging logical slot creation.

commit   : 955a684e0401954a58e956535107bc4b7136d952    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 13 May 2017 14:21:00 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 13 May 2017 14:21:00 -0700    

Click here for diff

The snapshot assembly during the creation of logical slots relied  
waiting for transactions in xl_running_xacts to end, by checking for  
their commit/abort records.  Unfortunately, despite locking, it is  
possible to see an xl_running_xact record listing transactions as  
ready, that have already WAL-logged an commit/abort record, as the  
locking just prevents the ProcArray to be adjusted, and the commit  
record has to be logged first.  
  
That lead to either delayed or hanging snapshot creation, because  
snapbuild.c would wait "forever" to see commit/abort records for some  
transactions.  That hang resolved only if a xl_running_xacts record  
without any running transactions happened to be logged, far from  
certain on a busy server.  
  
It's impractical to prevent that via more heavyweight locking, the  
likelihood of deadlocks and significantly increased contention would  
be too big.  
  
Instead change the initial snapshot creation to be solely based on  
tracking the oldest running transaction via  
xl_running_xacts->oldestRunningXid - that actually ends up  
significantly simplifying the code.  That has two disadvantages:  
1) Because we cannot fully "trust" the contents of xl_running_xacts,  
   we cannot use it to build the initial snapshot.  Instead we have to  
   wait twice for all running transactions to finish.  
2) Previously a slot, unless the race occurred, could be created when  
   the all transaction perceived as running based on commit/abort  
   records, now we have to wait for the next xl_running_xacts record.  
To address that, trigger logging new xl_running_xacts record from  
within snapbuild.c exactly when necessary.  
  
Unfortunately snabuild.c's SnapBuild is stored on disk, one of the  
stupider ideas of a certain Mr Freund, so we can't change it in a  
minor release.  As this is going to be backpatched, we have to hack  
around a bit to keep on-disk compatibility.  A later commit will  
rejigger that on master.  
  
Author: Andres Freund, based on a quite different patch from Petr Jelinek  
Analyzed-By: Petr Jelinek  
Reviewed-By: Petr Jelinek  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4-, where logical decoding has been introduced  

M contrib/test_decoding/expected/ondisk_startup.out
M contrib/test_decoding/specs/ondisk_startup.spec
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/snapbuild.h

Redesign get_attstatsslot()/free_attstatsslot() for more safety and speed.

commit   : 9aab83fc5039d83e84144b7bed3fb1d62a74ae78    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 May 2017 15:14:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 May 2017 15:14:39 -0400    

Click here for diff

The mess cleaned up in commit da0759600 is clear evidence that it's a  
bug hazard to expect the caller of get_attstatsslot()/free_attstatsslot()  
to provide the correct type OID for the array elements in the slot.  
Moreover, we weren't even getting any performance benefit from that,  
since get_attstatsslot() was extracting the real type OID from the array  
anyway.  So we ought to get rid of that requirement; indeed, it would  
make more sense for get_attstatsslot() to pass back the type OID it found,  
in case the caller isn't sure what to expect, which is likely in binary-  
compatible-operator cases.  
  
Another problem with the current implementation is that if the stats array  
element type is pass-by-reference, we incur a palloc/memcpy/pfree cycle  
for each element.  That seemed acceptable when the code was written because  
we were targeting O(10) array sizes --- but these days, stats arrays are  
almost always bigger than that, sometimes much bigger.  We can save a  
significant number of cycles by doing one palloc/memcpy/pfree of the whole  
array.  Indeed, in the now-probably-common case where the array is toasted,  
that happens anyway so this method is basically free.  (Note: although the  
catcache code will inline any out-of-line toasted values, it doesn't  
decompress them.  At the other end of the size range, it doesn't expand  
short-header datums either.  In either case, DatumGetArrayTypeP would have  
to make a copy.  We do end up using an extra array copy step if the element  
type is pass-by-value and the array length is neither small enough for a  
short header nor large enough to have suffered compression.  But that  
seems like a very acceptable price for winning in pass-by-ref cases.)  
  
Hence, redesign to take these insights into account.  While at it,  
convert to an API in which we fill a struct rather than passing a bunch  
of pointers to individual output arguments.  That will make it less  
painful if we ever want further expansion of what get_attstatsslot can  
pass back.  
  
It's certainly arguable that this is new development and not something to  
push post-feature-freeze.  However, I view it as primarily bug-proofing  
and therefore something that's better to have sooner not later.  Since  
we aren't quite at beta phase yet, let's put it in.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/intarray/_int_selfuncs.c
M src/backend/executor/nodeHash.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/lsyscache.c
M src/include/utils/lsyscache.h
M src/include/utils/selfuncs.h

Teach \d+ to show partitioning constraints.

commit   : 1848b73d4576e30c89ba450ad9f169774a6819bf    
  
author   : Robert Haas <[email protected]>    
date     : Sat, 13 May 2017 12:04:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Sat, 13 May 2017 12:04:53 -0400    

Click here for diff

The fact that we didn't have this in the first place is likely why  
the problem fixed by f8bffe9e6d700fd34759a92e47930ce9ba7dcbd5  
escaped detection.  
  
Patch by Amit Langote, reviewed and slightly adjusted by me.  
  
Discussion: http://postgr.es/m/CA+TgmoYWnV2GMnYLG-Czsix-E1WGAbo4D+0tx7t9NdfYBDMFsA@mail.gmail.com  

M src/backend/catalog/partition.c
M src/backend/utils/adt/ruleutils.c
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/partition.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/create_table.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/sql/create_table.sql

Fix multi-column range partitioning constraints.

commit   : f8bffe9e6d700fd34759a92e47930ce9ba7dcbd5    
  
author   : Robert Haas <[email protected]>    
date     : Sat, 13 May 2017 11:35:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Sat, 13 May 2017 11:35:30 -0400    

Click here for diff

The old logic was just plain wrong.  
  
Report by Olaf Gawenda.  Patch by Amit Langote, reviewed by  
Beena Emerson and by me.  Minor adjustments by me also.  

M src/backend/catalog/partition.c
M src/include/nodes/pg_list.h
M src/test/regress/expected/inherit.out
M src/test/regress/expected/insert.out
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/insert.sql

Avoid hard-wired sleep delays in stats regression test.

commit   : 4e37b3e15c4e129dbbcf46e00ad36672f4f7b359    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 May 2017 09:42:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 May 2017 09:42:12 -0400    

Click here for diff

On faster machines, the overall runtime for running the core regression  
tests is under twenty seconds these days, of which the hard-wired delays  
in the stats test are a significant fraction.  But on closer inspection,  
it seems like we shouldn't need those.  
  
The initial 2-second delay is there only to reduce the risk of the test's  
stats messages not getting sent due to contention.  But analysis of the  
last ten years' worth of buildfarm runs shows no evidence that such  
failures actually occur.  (We do see failures that look like stats  
messages not getting sent, particularly on Windows; but there is little  
reason to believe that the initial delay reduces their frequency.)  
  
The later 1-second delay is there to ensure that our session's stats  
will have gotten sent.  But we could also do that by starting a fresh  
session, which takes well under 1 second even on very slow machines.  
  
Hence, let's remove both delays and see what happens.  The first delay  
was the only test of pg_sleep_for() in the regression tests, but we can  
move that responsibility into wait_for_stats().  
  
Discussion: https://postgr.es/m/[email protected]  

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

Use a better way of skipping all subscription tests on Windows

commit   : 8d9f06097714ce1f4243329172f73c2d20b896a6    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 13 May 2017 02:47:11 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 13 May 2017 02:47:11 -0400    

Click here for diff

This way we only need to specify the number of tests in one place, and  
the output is also less verbose.  

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

Complete tab completion for DROP STATISTICS

commit   : d99d58cdc8c0b5b50ee92995e8575c100b1a458a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 13 May 2017 01:05:48 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 13 May 2017 01:05:48 -0300    

Click here for diff

Tab-completing DROP STATISTICS would only work if you started writing  
the schema name containing the statistics object, because the visibility  
clause was missing.  To add it, we need to add SQL-callable support for  
testing visibility of a statistics object, like all other object types  
already have.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/catalog/namespace.c
M src/backend/utils/cache/lsyscache.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/namespace.h
M src/include/catalog/pg_proc.h

Avoid searching for callback functions in CallSyscacheCallbacks().

commit   : 2df5d465558b6f17c161cbbe246b050b453ec99c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 May 2017 19:05:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 May 2017 19:05:13 -0400    

Click here for diff

We have now grown enough registerable syscache-invalidation callback  
functions that the original assumption that there would be few of them  
is causing performance problems.  In particular, let's fix things so that  
CallSyscacheCallbacks doesn't have to search the whole array to find  
which callback(s) to invoke for a given cache ID.  Preserve the original  
behavior that callbacks are called in order of registration, just in  
case there's someplace that depends on that (which I doubt).  
  
In support of this, export the number of syscaches from syscache.h.  
People could have found that out anyway from the enum, but adding a  
#define makes that much safer.  
  
This provides a useful additional speedup in Mathieu Fenniak's  
logical-decoding test case, although we're reaching the point of  
diminishing returns there.  I think any further improvement will have  
to come from reducing the number of cache invalidations that are  
triggered in the first place.  Still, we can hope that this change  
gives some incremental benefit for all invalidation scenarios.  
  
Back-patch to 9.4 where logical decoding was introduced.  
  
Discussion: https://postgr.es/m/CAHoiPjzea6N0zuCi=+f9v_j94nfsy6y8SU7-=bp4=7qw6_i=Rg@mail.gmail.com  

M src/backend/utils/cache/inval.c
M src/backend/utils/cache/syscache.c
M src/include/utils/syscache.h

doc: update markup for release note "release date" block

commit   : 9ed74fd463ede1db4ce829f9ff461d0b7f28f1f3    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 May 2017 18:31:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 May 2017 18:31:55 -0400    

Click here for diff

This has to be backpatched to all supported releases so release markup  
added to HEAD and copied to back branches matches the existing markup.  
  
Reported-by: Peter Eisentraut  
  
Discussion: [email protected]  
  
Author: initial patch and sample markup by Peter Eisentraut  
  
Backpatch-through: 9.2  

M doc/src/sgml/release-10.sgml
M doc/src/sgml/release-7.4.sgml
M doc/src/sgml/release-8.0.sgml
M doc/src/sgml/release-8.1.sgml
M doc/src/sgml/release-8.2.sgml
M doc/src/sgml/release-8.3.sgml
M doc/src/sgml/release-8.4.sgml
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
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/release-9.6.sgml
M doc/src/sgml/release-old.sgml

Reduce initial size of RelfilenodeMapHash.

commit   : 8085a4f7510191b8fe7f8f7b5846fdbc79abcf8d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 May 2017 18:30:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 May 2017 18:30:02 -0400    

Click here for diff

A test case provided by Mathieu Fenniak shows that hash_seq_search'ing  
this hashtable can consume a very significant amount of overhead during  
logical decoding, which triggers frequent cache invalidation.  Testing  
suggests that the actual population of the hashtable is often no more  
than a few dozen entries, so we can cut the overhead just by dropping  
the initial number of buckets down from 1024 --- I chose to cut it to 64.  
(In situations where we do have a significant number of entries, we  
shouldn't get any real penalty from doing this, as the dynahash.c code  
will resize the hashtable automatically.)  
  
This gives a further factor-of-two savings in Mathieu's test case.  
That may be overly optimistic for real-world benefit, as real cases  
may have larger average table populations, but it's hard to see it  
turning into a net negative for any workload.  
  
Back-patch to 9.4 where relfilenodemap.c was introduced.  
  
Discussion: https://postgr.es/m/CAHoiPjzea6N0zuCi=+f9v_j94nfsy6y8SU7-=bp4=7qw6_i=Rg@mail.gmail.com  

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

getObjectDescription: support extended statistics

commit   : 5e2af609e14ede1b5e0d73d59ed8548c76e1943a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 May 2017 19:22:03 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 May 2017 19:22:03 -0300    

Click here for diff

This was missed in 7b504eb282ca.  
  
Remove the "default:" clause in the switch, to avoid this problem in the  
future.  Other switches involving the same enum should probably be  
changed in the same way, but are not touched by this patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/objectaddress.c

Avoid searching for the target catcache in CatalogCacheIdInvalidate.

commit   : 50ee1c7462d796639eef6c24b1797df8c4d6c098    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 May 2017 18:17:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 May 2017 18:17:29 -0400    

Click here for diff

A test case provided by Mathieu Fenniak shows that the initial search for  
the target catcache in CatalogCacheIdInvalidate consumes a very significant  
amount of overhead in cases where cache invalidation is triggered but has  
little useful work to do.  There is no good reason for that search to exist  
at all, as the index array maintained by syscache.c allows direct lookup of  
the catcache from its ID.  We just need a frontend function in syscache.c,  
matching the division of labor for most other cache-accessing operations.  
  
While there's more that can be done in this area, this patch alone reduces  
the runtime of Mathieu's example by 2X.  We can hope that it offers some  
useful benefit in other cases too, although usually cache invalidation  
overhead is not such a striking fraction of the total runtime.  
  
Back-patch to 9.4 where logical decoding was introduced.  It might be  
worth going further back, but presently the only case we know of where  
cache invalidation is really a significant burden is in logical decoding.  
Also, older branches have fewer catcaches, reducing the possible benefit.  
  
(Note: although this nominally changes catcache's API, we have always  
documented CatalogCacheIdInvalidate as a private function, so I would  
have little sympathy for an external module calling it directly.  So  
backpatching should be fine.)  
  
Discussion: https://postgr.es/m/CAHoiPjzea6N0zuCi=+f9v_j94nfsy6y8SU7-=bp4=7qw6_i=Rg@mail.gmail.com  

M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/syscache.c
M src/include/utils/catcache.h
M src/include/utils/syscache.h

Fix dependencies for extended statistics objects.

commit   : 928c4de30991ca24a46a92f006892c039af30833    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 May 2017 16:26:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 May 2017 16:26:31 -0400    

Click here for diff

A stats object ought to have a dependency on each individual column  
it reads, not the entire table.  Doing this honestly lets us get rid  
of the hard-wired logic in RemoveStatisticsExt, which seems to have  
been misguidedly modeled on RemoveStatistics; and it will be far easier  
to extend to multiple tables later.  
  
Also, add overlooked dependency on owner, and make the dependency on  
schema be NORMAL like every other such dependency.  
  
There remains some unfinished work here, which is to allow statistics  
objects to be extension members.  That takes more effort than just  
adding the dependency call, though, so I left it out for now.  
  
initdb forced because this changes the set of pg_depend records that  
should exist for a statistics object.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/commands/statscmds.c
M src/include/catalog/catversion.h
M src/include/catalog/heap.h
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Change CREATE STATISTICS syntax

commit   : bc085205c8a425fcaa54e27c6dcd83101130439b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 May 2017 14:59:23 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 May 2017 14:59:23 -0300    

Click here for diff

Previously, we had the WITH clause in the middle of the command, where  
you'd specify both generic options as well as statistic types.  Few  
people liked this, so this commit changes it to remove the WITH keyword  
from that clause and makes it accept statistic types only.  (We  
currently don't have any generic options, but if we invent in the  
future, we will gain a new WITH clause, probably at the end of the  
command).  
  
Also, the column list is now specified without parens, which makes the  
whole command look more similar to a SELECT command.  This change will  
let us expand the command to supporting expressions (not just columns  
names) as well as multiple tables and their join conditions.  
  
Tom added lots of code comments and fixed some parts of the CREATE  
STATISTICS reference page, too; more changes in this area are  
forthcoming.  He also fixed a potential problem in the alter_generic  
regression test, reducing verbosity on a cascaded drop to avoid  
dependency on message ordering, as we do in other tests.  
  
Tom also closed a security bug: we documented that table ownership was  
required in order to create a statistics object on it, but didn't  
actually implement it.  
  
Implement tab-completion for statistics objects.  This can stand some  
more improvement.  
  
Authors: Alvaro Herrera, with lots of cleanup by Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/perform.sgml
M doc/src/sgml/planstats.sgml
M doc/src/sgml/ref/alter_statistics.sgml
M doc/src/sgml/ref/create_statistics.sgml
M doc/src/sgml/ref/drop_statistics.sgml
M src/backend/commands/statscmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/utils/adt/ruleutils.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/alter_generic.sql
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/stats_ext.sql

Replace another "transaction log" with "write-ahead log"

commit   : 46052d9ef314deafa8c94ac7fda4a2811db0679e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 12 May 2017 13:53:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 12 May 2017 13:53:24 -0400    

Click here for diff

Reported-by: Dagfinn Ilmari MannsĆ„ker <[email protected]>  

M doc/src/sgml/func.sgml

Standardize "WAL location" terminology

commit   : d496a65790734f808789f39e4f63b2790821c2be    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 12 May 2017 13:51:27 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 12 May 2017 13:51:27 -0400    

Click here for diff

Other previously used terms were "WAL position" or "log position".  

M doc/src/sgml/config.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_waldump.sgml
M doc/src/sgml/wal.sgml
M src/backend/access/transam/recovery.conf.sample
M src/backend/access/transam/timeline.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/timeline.h

Replace "transaction log" with "write-ahead log"

commit   : c1a7f64b4a720a662ecec809bc9e289f35e887ad    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 12 May 2017 11:49:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 12 May 2017 11:49:56 -0400    

Click here for diff

This makes documentation and error messages match the renaming of "xlog"  
to "wal" in APIs and file naming.  

M doc/src/sgml/backup.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/recovery-config.sgml
M doc/src/sgml/ref/checkpoint.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/pgtestfsync.sgml
M doc/src/sgml/release-10.sgml
M src/backend/access/transam/timeline.c
M src/backend/access/transam/transam.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xlogutils.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/postmaster.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/timeline.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogdefs.h
M src/test/perl/PostgresNode.pm

Honor PROVE_FLAGS environment setting

commit   : 56b6ef893fee9e9bf47d927a02f4d1ea911f4d9c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 12 May 2017 11:11:49 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 12 May 2017 11:11:49 -0400    

Click here for diff

On MSVC builds and on back branches that means removing the hardcoded  
--verbose setting. On master for Unix that means removing the empty  
setting in the global Makefile so that the value can be acquired from  
the environment as well as from the make arguments.  
  
Backpatch to 9.4 where we introduced TAP tests  

M src/Makefile.global.in
M src/tools/msvc/vcregress.pl

Add libxml2 include path for MSVC builds

commit   : b757e01f62e44b4f425f78e3dc4e247ca9f1e983    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 12 May 2017 10:17:54 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 12 May 2017 10:17:54 -0400    

Click here for diff

On Unix this path is detected via the use of xml2-config, but that's not  
available on Windows. This means that users building with libxml2 will  
no longer need to move things around from the standard libxml2  
installation for MSVC builds.  
  
Backpatch to all live branches.  

M src/tools/msvc/Solution.pm

pg_dump: Add --no-publications option

commit   : 96e1cb4c0fb45dfca2d8b0a58693b94cbdaabe11    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 12 May 2017 09:15:40 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 12 May 2017 09:15:40 -0400    

Click here for diff

Author: Michael Paquier <[email protected]>  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_restore.sgml
M 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_dumpall.c
M src/bin/pg_dump/pg_restore.c

Rework the options syntax for logical replication commands

commit   : b807f59828fbc02fea612e1cbc0066c6dfa3be9b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 12 May 2017 08:57:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 12 May 2017 08:57:01 -0400    

Click here for diff

For CREATE/ALTER PUBLICATION/SUBSCRIPTION, use similar option style as  
other statements that use a WITH clause for options.  
  
Author: Petr Jelinek <[email protected]>  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/commands/publicationcmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/parser/gram.y
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/tab-complete.c
M src/include/parser/kwlist.h
M src/test/modules/dummy_seclabel/expected/dummy_seclabel.out
M src/test/modules/dummy_seclabel/sql/dummy_seclabel.sql
M src/test/regress/expected/object_address.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/subscription.out
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/publication.sql
M src/test/regress/sql/subscription.sql
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl

Avoid tests which crash the calling process on Windows

commit   : 734cb4c2e7de92972c01b6339a3e15ac4bc605dd    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 12 May 2017 06:41:23 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 12 May 2017 06:41:23 -0400    

Click here for diff

Certain recovery tests use the Perl IPC::Run module's start/kill_kill  
method of processing. On at least some versions of perl this causes the  
whole process and its caller to crash. If we ever find a better way of  
doing these tests they can be re-enabled on this platform. This does not  
affect Mingw or Cygwin builds, which use a different perl and a  
different shell and so are not affected.  

M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/011_crash_recovery.pl

Lag tracking for logical replication

commit   : 024711bb544645c8b1061e9f02b261e2e336981d    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 12 May 2017 10:50:56 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 12 May 2017 10:50:56 +0100    

Click here for diff

Lag tracking is called for each commit, but we introduce  
a pacing delay to ensure we don't swamp the lag tracker.  
  
Author: Petr Jelinek, with minor pacing delay code from me  

M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/include/replication/logical.h
M src/include/replication/output_plugin.h

Doc fix: scale(numeric) returns integer, not numeric.

commit   : efa2c18f4e8a8ccc74d9005d960f4c1a2bf05ea9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 May 2017 18:09:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 May 2017 18:09:22 -0400    

Click here for diff

Thinko in commit abb173392, which introduced this function.  
  
Report: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Increase MAX_SYSCACHE_CALLBACKS to provide more room for extensions.

commit   : 596a7c8df74ed2ffb850dd4408094ef489a3d14d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 May 2017 14:51:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 May 2017 14:51:21 -0400    

Click here for diff

Increase from the historical value of 32 to 64.  We are up to 31 callers  
of CacheRegisterSyscacheCallback() in HEAD, so if they were all to be  
exercised in one process that would leave only one slot for add-on modules.  
It's probably not possible for that to happen, but still we clearly need  
more daylight here.  (At some point it might be worth making the array  
dynamically resizable; but since we've never heard a complaint of "out of  
syscache_callback_list slots" happening in the field, I doubt it's worth  
it yet.)  
  
Back-patch as far as 9.4, which is where we increased the companion limit  
MAX_RELCACHE_CALLBACKS (cf commit f01d1ae3a).  It's not as urgent in  
released branches, which have only a couple dozen call sites in core, but  
it still seems that somebody might hit the limit before these branches die.  
  
Discussion: https://postgr.es/m/[email protected]  

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

commit   : d10c626de47d8b048b663471c7785603a2ec8641    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 May 2017 11:49:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 May 2017 11:49:59 -0400    

Click here for diff

Per discussion, "location" is a rather vague term that could refer to  
multiple concepts.  "LSN" is an unambiguous term for WAL locations and  
should be preferred.  Some function names, view column names, and function  
output argument names used "lsn" already, but others used "location",  
as well as yet other terms such as "wal_position".  Since we've already  
renamed a lot of things in this area from "xlog" to "wal" for v10,  
we may as well incur a bit more compatibility pain and make these names  
all consistent.  
  
David Rowley, minor additional docs hacking by me  
  
Discussion: https://postgr.es/m/CAKJS1f8O0njDKe8ePFQ-LK5-EjwThsDws6ohJ-+c6nWK+oUxtg@mail.gmail.com  

M contrib/bloom/t/001_wal.pl
M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/test-decoding.sgml
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/system_views.sql
M src/backend/utils/misc/pg_controldata.c
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/libpq_fetch.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
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/002_archiving.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/008_fsm_truncation.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/regress/expected/rules.out
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl

Revert "Permit dump/reload of not-too-large >1GB tuples"

commit   : b66adb7b0c83e632e0f881f828fa6f4233d01d06    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 10 May 2017 18:41:27 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 10 May 2017 18:41:27 -0300    

Click here for diff

This reverts commits fa2fa9955280 and 42f50cb8fa98.  
  
While the functionality that was intended to be provided by these  
commits is desired, the patch didn't actually solve as many of the  
problematic situations as we hoped, and it created a bunch of its own  
problems.  Since we're going to require more extensive changes soon for  
other reasons and users have been working around these problems for a  
long time already, there is no point in spending effort in fixing this  
halfway measure.  
  
Per complaint from Tom Lane.  
Discussion: https://postgr.es/m/[email protected]  
  
(Commit fa2fa9955280 had already been reverted in branches 9.5 as  
f858524ee4f and 9.6 as e9e44a0953, so this touches master only.  
Commit 42f50cb8fa98 was not present in the older branches.)  

M src/backend/access/common/heaptuple.c
M src/backend/commands/copy.c
M src/backend/lib/stringinfo.c
M src/include/lib/stringinfo.h

psql: Add missing translation markers

commit   : b83f4e4a25394b964a7fadc6429c7de82d62b58a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 10 May 2017 10:14:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 10 May 2017 10:14:49 -0400    

Click here for diff

M src/bin/psql/describe.c

Fix typo.

commit   : 03bf59676ea0473e85b5540fe23be399ee3b3ac4    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:57:52 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:57:52 -0400    

Click here for diff

Thomas Munro  
  
Discussion: http://postgr.es/m/CAEepm=3vV1YKxDfLMqq-nYM2fN+STMYLwPKFCoah4M0gxqqNNg@mail.gmail.com  

M doc/src/sgml/trigger.sgml

Avoid theoretical infinite loop loading relcache partition key.

commit   : 622c82279dcba1208049b8b9ae93023757a2dbbe    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:51:54 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:51:54 -0400    

Click here for diff

Amit Langote, per report from ē”„ę˜Žę“‹  
  
Discussion: http://postgr.es/m/[email protected]  

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

Document trigger-firing behavior for inheritance/partitioning.

commit   : e17628145ac33bf271b3f575b52cdbe9dde0bb80    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:49:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:49:20 -0400    

Click here for diff

Amit Langote, reviewed Thomas Munro and by me.  
  
Discussion: http://postgr.es/m/CA+Tgmoadpcs3=mMgdyqVX7L7L_PwO_Dn5j-98a6Tj7ByBuimUQ@mail.gmail.com  

M doc/src/sgml/trigger.sgml

Remove no-longer-needed compatibility code for hash indexes.

commit   : a5775991bb86d95939b3eb1173b88d8c5312962d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:44:21 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:44:21 -0400    

Click here for diff

Because commit ea69a0dead5128c421140dc53fac165ba4af8520 bumped the  
HASH_VERSION, we don't need to worry about PostgreSQL 10 seeing  
bucket pages from earlier versions.  
  
Amit Kapila  
  
Discussion: http://postgr.es/m/CAA4eK1LAo4DGwh+mi-G3U8Pj1WkBBeFL38xdCnUHJv1z4bZFkQ@mail.gmail.com  

M src/backend/access/hash/hash.c
M src/backend/access/hash/hashpage.c

Fix typos in comments.

commit   : df1a4eba948f386845f75c2864de0a35e5ede849    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:40:08 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:40:08 -0400    

Click here for diff

Etsuro Fujita  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/executor/execMain.c

Prohibit transition tables on views and foreign tables.

commit   : 9e6104c6672dc948a430d1ee269b0c31bf5bc974    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:34:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:34:02 -0400    

Click here for diff

Thomas Munro, per off-list report from Prabhat Sabu.  Changes  
to the message wording for consistency with the existing  
relkind check for partitioned tables by me.  
  
Discussion: http://postgr.es/m/CAEepm=2xJFFpGM+N=gpWx-9Nft2q1oaFZX07_y23AHCrJQLt0g@mail.gmail.com  

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

Don't permit transition tables with TRUNCATE triggers.

commit   : 29fd3d9da0ff9e230ff051c1423871bd6eac377d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:22:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:22:39 -0400    

Click here for diff

Prior to this prohibition, such a trigger caused a crash.  
  
Thomas Munro, per a report from Neha Sharma.  I added a  
regression test.  
  
Discussion: http://postgr.es/m/CAEepm=0VR5W-N38eTkO_FqJbGqQ_ykbBRmzmvHyxDhy1p=0Csw@mail.gmail.com  

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

Pass EXEC_FLAG_REWIND when initializing a tuplestore scan.

commit   : 304007d9f1f66fd37e50e5a5aa6f17400f1239f8    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:13:21 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 23:13:21 -0400    

Click here for diff

Since a rescan is possible, we must be able to rewind.  
  
Thomas Munro, per a report from Prabhat Sabu  
  
Discussion: http://postgr.es/m/CAEepm=2=Uv5fm=exqL+ygBxaO+-tgmC=o+63H4zYAXi9HtXf1w@mail.gmail.com  

M src/backend/executor/nodeNamedtuplestorescan.c

Disallow finite partition bound following earlier UNBOUNDED column.

commit   : 3439f84475642fab029df0c06c81df94e6941dc0    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 22:41:12 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 May 2017 22:41:12 -0400    

Click here for diff

Amit Langote, per an observation by me.  
  
Discussion: http://postgr.es/m/CA+TgmoYWnV2GMnYLG-Czsix-E1WGAbo4D+0tx7t9NdfYBDMFsA@mail.gmail.com  

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

Improve memory use in logical replication apply

commit   : 489b96e80b96c0eda02575347654e87968f2f5f4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 May 2017 14:40:42 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 May 2017 14:40:42 -0400    

Click here for diff

Previously, the memory used by the logical replication apply worker for  
processing messages would never be freed, so that could end up using a  
lot of memory.  To improve that, change the existing ApplyContext memory  
context to ApplyMessageContext and reset that after every  
message (similar to MessageContext used elsewhere).  For consistency of  
naming, rename the ApplyCacheContext to ApplyContext.  
  
Author: Stas Kelvich <[email protected]>  

M src/backend/replication/logical/worker.c
M src/backend/utils/mmgr/README
M src/include/replication/worker_internal.h

Ignore PQcancel errors properly

commit   : e0bf16060be695ced920727fa29f0d9ede61bd3f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 9 May 2017 14:58:51 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 9 May 2017 14:58:51 -0300    

Click here for diff

Add a (void) cast to all PQcancel() calls that purposefully don't check  
the return value, to keep compilers and static checkers happy.  
  
Per Coverity.  

M src/bin/pg_dump/pg_backup_db.c
M src/bin/scripts/vacuumdb.c

pg_dump: Add --no-subscriptions option

commit   : 26aa1cf376f68b800b73c326edeea6d1996ec246    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 May 2017 10:58:06 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 May 2017 10:58:06 -0400    

Click here for diff

Author: Michael Paquier <[email protected]>  
Reviewed-by: Petr Jelinek <[email protected]>  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_restore.sgml
M 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_dumpall.c
M src/bin/pg_dump/pg_restore.c

doc: Add info about replication slot management

commit   : ab178bb2f4b35fbcc0f78822c72063a8a5e9dbb0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 May 2017 10:25:26 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 May 2017 10:25:26 -0400    

Click here for diff

Add some more information about managing replication slots associated  
with logical replication subscriptions.  

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

Remove the NODROP SLOT option from DROP SUBSCRIPTION

commit   : 013c1178fd0adefa0f68d5ce2d84e7ae6f9613a1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 May 2017 10:20:42 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 May 2017 10:20:42 -0400    

Click here for diff

It turned out this approach had problems, because a DROP command should  
not have any options other than CASCADE and RESTRICT.  Instead, always  
attempt to drop the slot if there is one configured, but also add an  
ALTER SUBSCRIPTION action to set the slot to NONE.  
  
Author: Petr Jelinek <[email protected]>  
Reported-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/drop_subscription.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/commands/subscriptioncmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/replication/logical/worker.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/test/modules/dummy_seclabel/expected/dummy_seclabel.out
M src/test/modules/dummy_seclabel/sql/dummy_seclabel.sql
M src/test/regress/expected/object_address.out
M src/test/regress/expected/subscription.out
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/subscription.sql
M src/test/subscription/t/001_rep_changes.pl

pgindent: use HTTP instead of FTP to retrieve pg_bsd_indent src

commit   : c4c493fd3581dfbce45e903b87e12eea508f47e4    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 9 May 2017 09:28:44 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 9 May 2017 09:28:44 -0400    

Click here for diff

FTP support will be removed from ftp.postgresql.org in months, but http  
still works.  Typedefs already used http.  

M src/tools/pgindent/pgindent

Further patch rangetypes_selfuncs.c's statistics slot management.

commit   : da0759600664439238fe25fa84b1f0059bfdcdd6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 May 2017 15:02:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 May 2017 15:02:57 -0400    

Click here for diff

Values in a STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM slot are float8,  
not of the type of the column the statistics are for.  
  
This bug is at least partly the fault of sloppy specification comments  
for get_attstatsslot()/free_attstatsslot(): the type OID they want is that  
of the stavalues entries, not of the underlying column.  (I double-checked  
other callers and they seem to get this right.)  Adjust the comments to be  
more correct.  
  
Per buildfarm.  
  
Security: CVE-2017-7484  

M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/cache/lsyscache.c
M src/include/catalog/pg_statistic.h

Check connection info string in ALTER SUBSCRIPTION

commit   : fe974cc5a69903e9f53b36d6e2709fd3de0a1ac7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 8 May 2017 14:01:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 8 May 2017 14:01:00 -0400    

Click here for diff

Previously it would allow an invalid connection string to be set.  
  
Author: Petr Jelinek <[email protected]>  
Reported-by: tushar <[email protected]>  

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

Last-minute updates for release notes.

commit   : c89d2d0204f25e556e94dabd0fd5174cf6963b1d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 May 2017 12:57:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 May 2017 12:57:27 -0400    

Click here for diff

Security: CVE-2017-7484, CVE-2017-7485, CVE-2017-7486  

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

Fix statistics reporting in logical replication workers

commit   : 9a591c1bccc5edeb06b979c59f39753982131181    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 8 May 2017 12:07:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 8 May 2017 12:07:59 -0400    

Click here for diff

This new arrangement ensures that statistics are reported right after  
commit of transactions.  The previous arrangement didn't get this quite  
right and could lead to assertion failures.  
  
Author: Petr Jelinek <[email protected]>  
Reported-by: Erik Rijkers <[email protected]>  

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

Fix possibly-uninitialized variable.

commit   : b6576e5914d042bfad1c8629fe199f59b036c342    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 May 2017 11:18:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 May 2017 11:18:40 -0400    

Click here for diff

Oversight in e2d4ef8de et al (my fault not Peter's).  Per buildfarm.  
  
Security: CVE-2017-7484  

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

Match pg_user_mappings limits to information_schema.user_mapping_options.

commit   : 3eefc51053f250837c3115c12f8119d16881a2d7    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 8 May 2017 07:24:24 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 8 May 2017 07:24:24 -0700    

Click here for diff

Both views replace the umoptions field with NULL when the user does not  
meet qualifications to see it.  They used different qualifications, and  
pg_user_mappings documented qualifications did not match its implemented  
qualifications.  Make its documentation and implementation match those  
of user_mapping_options.  One might argue for stronger qualifications,  
but these have long, documented tenure.  pg_user_mappings has always  
exhibited this problem, so back-patch to 9.2 (all supported versions).  
  
Michael Paquier and Feike Steenbergen.  Reviewed by Jeff Janes.  
Reported by Andrew Wheelwright.  
  
Security: CVE-2017-7486  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/system_views.sql
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/foreign_data.sql

Restore PGREQUIRESSL recognition in libpq.

commit   : 0170b10dff04e0f50f5522c377a4d10d4424155c    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 8 May 2017 07:24:24 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 8 May 2017 07:24:24 -0700    

Click here for diff

Commit 65c3bf19fd3e1f6a591618e92eb4c54d0b217564 moved handling of the,  
already then, deprecated requiressl parameter into conninfo_storeval().  
The default PGREQUIRESSL environment variable was however lost in the  
change resulting in a potentially silent accept of a non-SSL connection  
even when set.  Its documentation remained.  Restore its implementation.  
Also amend the documentation to mark PGREQUIRESSL as deprecated for  
those not following the link to requiressl.  Back-patch to 9.3, where  
commit 65c3bf1 first appeared.  
  
Behavior has been more complex when the user provides both deprecated  
and non-deprecated settings.  Before commit 65c3bf1, libpq operated  
according to the first of these found:  
  
  requiressl=1  
  PGREQUIRESSL=1  
  sslmode=*  
  PGSSLMODE=*  
  
(Note requiressl=0 didn't override sslmode=*; it would only suppress  
PGREQUIRESSL=1 or a previous requiressl=1.  PGREQUIRESSL=0 had no effect  
whatsoever.)  Starting with commit 65c3bf1, libpq ignored PGREQUIRESSL,  
and order of precedence changed to this:  
  
  last of requiressl=* or sslmode=*  
  PGSSLMODE=*  
  
Starting now, adopt the following order of precedence:  
  
  last of requiressl=* or sslmode=*  
  PGSSLMODE=*  
  PGREQUIRESSL=1  
  
This retains the 65c3bf1 behavior for connection strings that contain  
both requiressl=* and sslmode=*.  It retains the 65c3bf1 change that  
either connection string option overrides both environment variables.  
For the first time, PGSSLMODE has precedence over PGREQUIRESSL; this  
avoids reducing security of "PGREQUIRESSL=1 PGSSLMODE=verify-full"  
configurations originating under v9.3 and later.  
  
Daniel Gustafsson  
  
Security: CVE-2017-7485  

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

doc: add Simon Riggs to VACUUM VERBOSE PG 10 release note item

commit   : 74cadeaa2f12320c5064af61915fefcd5c24149a    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 8 May 2017 09:50:07 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 8 May 2017 09:50:07 -0400    

Click here for diff

Reported-by: Masahiko Sawada  

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

Add security checks to selectivity estimation functions

commit   : e2d4ef8de869c57e3bf270a30c12d48c2ce4e00c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 5 May 2017 12:18:48 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 5 May 2017 12:18:48 -0400    

Click here for diff

Some selectivity estimation functions run user-supplied operators over  
data obtained from pg_statistic without security checks, which allows  
those operators to leak pg_statistic data without having privileges on  
the underlying tables.  Fix by checking that one of the following is  
satisfied: (1) the user has table or column privileges on the table  
underlying the pg_statistic data, or (2) the function implementing the  
user-supplied operator is leak-proof.  If neither is satisfied, planning  
will proceed as if there are no statistics available.  
  
At least one of these is satisfied in most cases in practice.  The only  
situations that are negatively impacted are user-defined or  
not-leak-proof operators on a security-barrier view.  
  
Reported-by: Robert Haas <[email protected]>  
Author: Peter Eisentraut <[email protected]>  
Author: Tom Lane <[email protected]>  
  
Security: CVE-2017-7484  

M doc/src/sgml/planstats.sgml
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/selfuncs.c
M src/include/utils/selfuncs.h
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Remove support for password_encryption='off' / 'plain'.

commit   : eb61136dc75a76caef8460fa939244d8593100f2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 8 May 2017 11:26:07 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 8 May 2017 11:26:07 +0300    

Click here for diff

Storing passwords in plaintext hasn't been a good idea for a very long  
time, if ever. Now seems like a good time to finally forbid it, since we're  
messing with this in PostgreSQL 10 anyway.  
  
Remove the CREATE/ALTER USER UNENCRYPTED PASSSWORD 'foo' syntax, since  
storing passwords unencrypted is no longer supported. ENCRYPTED PASSWORD  
'foo' is still accepted, but ENCRYPTED is now just a noise-word, it does  
the same as just PASSWORD 'foo'.  
  
Likewise, remove the --unencrypted option from createuser, but accept  
--encrypted as a no-op for backward compatibility. AFAICS, --encrypted was  
a no-op even before this patch, because createuser encrypted the password  
before sending it to the server even if --encrypted was not specified. It  
added the ENCRYPTED keyword to the SQL command, but since the password was  
already in encrypted form, it didn't make any difference. The documentation  
was not clear on whether that was intended or not, but it's moot now.  
  
Also, while password_encryption='on' is still accepted as an alias for  
'md5', it is now marked as hidden, so that it is not listed as an accepted  
value in error hints, for example. That's not directly related to removing  
'plain', but it seems better this way.  
  
Reviewed by Michael Paquier  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/passwordcheck/passwordcheck.c
M doc/src/sgml/config.sgml
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 doc/src/sgml/ref/createuser.sgml
M src/backend/commands/user.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/crypt.c
M src/backend/parser/gram.y
M src/backend/utils/misc/guc.c
M src/bin/psql/tab-complete.c
M src/bin/scripts/createuser.c
M src/include/libpq/crypt.h
M src/interfaces/libpq/fe-auth.c
M src/test/authentication/t/001_password.pl
M src/test/regress/expected/password.out
M src/test/regress/sql/password.sql

Remove poorly worded and duplicated comment

commit   : 1f30295eab65eddaa88528876ab66e7095f4bb65    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 8 May 2017 08:49:28 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 8 May 2017 08:49:28 +0100    

Click here for diff

Move line of code to avoid need for duplicated comment  
  
Brought to attention by Masahiko Sawada  

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

Release notes for 9.6.3, 9.5.7, 9.4.12, 9.3.17, 9.2.21.

commit   : 27dae036a5809a61104b7380f0cd98c37b43170f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 May 2017 16:56:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 May 2017 16:56:02 -0400    

Click here for diff

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

Third pass on 9.6.3 release notes.

commit   : 86713deecda4ddbf8e339ec48fafa4d8080f6079    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 May 2017 14:43:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 May 2017 14:43:04 -0400    

Click here for diff

Add updates for recent commits.  
  
In passing, credit Etsuro Fujita for his work on the postgres_fdw  
query cancel feature in 9.6; I seem to have missed that in the  
original drafting of the 9.6 notes.  

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

Fix memory leaks if random salt generation fails.

commit   : 0186ded5460c4868db8c5f98ab17287c15fedd7e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 7 May 2017 19:58:21 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 7 May 2017 19:58:21 +0300    

Click here for diff

In the backend, this is just to silence coverity warnings, but in the  
frontend, it's a genuine leak, even if extremely rare.  
  
Spotted by Coverity, patch by Michael Paquier.  

M src/backend/libpq/auth-scram.c
M src/interfaces/libpq/fe-auth-scram.c

Guard against null t->tm_zone in strftime.c.

commit   : a54d5875fe0bc19d05236b85e1e1bf0af9fa2902    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 May 2017 12:33:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 May 2017 12:33:12 -0400    

Click here for diff

The upstream IANA code does not guard against null TM_ZONE pointers in this  
function, but in our code there is such a check in the other pre-existing  
use of t->tm_zone.  We do have some places that set pg_tm.tm_zone to NULL.  
I'm not entirely sure it's possible to reach strftime with such a value,  
but I'm not sure it isn't either, so be safe.  
  
Per Coverity complaint.  

M src/timezone/strftime.c

commit   : d4e59c5521c244e809c3d68df51fb79543578e41    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 May 2017 11:57:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 May 2017 11:57:41 -0400    

Click here for diff

Somehow, we'd missed ever doing this.  The consequences aren't too  
severe: basically, the timezone library would fall back on its hardwired  
notion of the DST transition dates to use for a POSIX-style zone name,  
rather than obeying US/Eastern which is the intended behavior.  The net  
effect would only be to obey current US DST law further back than it  
ought to apply; so it's not real surprising that nobody noticed.  
  
David Rowley, per report from Amit Kapila  
  
Discussion: https://postgr.es/m/CAA4eK1LC7CaNhRAQ__C3ht1JVrPzaAXXhEJRnR5L6bfYHiLmWw@mail.gmail.com  

M src/tools/msvc/Install.pm

Restore fullname[] contents before falling through in pg_open_tzfile().

commit   : 5788a5670e4a58049b8adc82c4fef97a2c3be327    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 May 2017 11:34:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 May 2017 11:34:31 -0400    

Click here for diff

Fix oversight in commit af2c5aa88: if the shortcut open() doesn't work,  
we need to reset fullname[] to be just the name of the toplevel tzdata  
directory before we fall through into the pre-existing code.  This failed  
to be exposed in my (tgl's) testing because the fall-through path is  
actually never taken under normal circumstances.  
  
David Rowley, per report from Amit Kapila  
  
Discussion: https://postgr.es/m/CAA4eK1LC7CaNhRAQ__C3ht1JVrPzaAXXhEJRnR5L6bfYHiLmWw@mail.gmail.com  

M src/timezone/pgtz.c

doc PG 10: adjustments to BRIN, WAL, JSON, XML items, syntax

commit   : 628462bda908873688ce738a191b470ab769d604    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 6 May 2017 23:31:54 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 6 May 2017 23:31:54 -0400    

Click here for diff

Reported-by: Alvaro Herrera  

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

pg_dump: Don't leak memory in buildDefaultACLCommands()

commit   : 09f842181943b6e83b0779f2e872ff0180b66883    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 6 May 2017 22:58:12 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 6 May 2017 22:58:12 -0400    

Click here for diff

buildDefaultACLCommands() didn't destroy the string buffer created in  
certain cases, leading to a memory leak.  Fix by destroying the buffer  
before returning from the function.  
  
Spotted by Coverity.  
  
Author: Michael Paquier  
  
Back-patch to 9.6 where buildDefaultACLCommands() was added.  

M src/bin/pg_dump/dumputils.c

RLS: Fix ALL vs. SELECT+UPDATE policy usage

commit   : aa5d3c0b3fb906dfa910b0ca6f75ab701b2f1c09    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 6 May 2017 21:46:35 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 6 May 2017 21:46:35 -0400    

Click here for diff

When we add the SELECT-privilege based policies to the RLS with check  
options (such as for an UPDATE statement, or when we have INSERT ...  
RETURNING), we need to be sure and use the 'USING' case if the policy is  
actually an 'ALL' policy (which could have both a USING clause and an  
independent WITH CHECK clause).  
  
This could result in policies acting differently when built using ALL  
(when the ALL had both USING and WITH CHECK clauses) and when building  
the policies independently as SELECT and UPDATE policies.  
  
Fix this by adding an explicit boolean to add_with_check_options() to  
indicate when the USING policy should be used, even if the policy has  
both USING and WITH CHECK policies on it.  
  
Reported by: Rod Taylor  
  
Back-patch to 9.5 where RLS was introduced.  

M src/backend/rewrite/rowsecurity.c

Fix duplicated words in comment.

commit   : b58c433ef90be2f9752cd54561c07dae87e3819c    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 6 May 2017 17:03:04 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 6 May 2017 17:03:04 -0700    

Click here for diff

Reported-By: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-Wzn3rY2N0gTWndaApD113T+O8L6oz8cm7_F3P8y4awdoOg@mail.gmail.com  
Backpatch: no, only present in master  

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

Fix off-by-one possibly leading to skipped XLOG_RUNNING_XACTS records.

commit   : e6c44eef55cda493c759e926cecceb92186159b8    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 6 May 2017 16:47:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 6 May 2017 16:47:40 -0700    

Click here for diff

Since 6ef2eba3f57f1 ("Skip checkpoints, archiving on idle systems."),  
GetLastImportantRecPtr() is used to avoid performing superfluous  
checkpoints, xlog switches, running-xact records when the system is  
idle.  Unfortunately the check concerning running-xact records had a  
off-by-one error, leading to such records being potentially skipped  
when only a single record has been inserted since the last  
running-xact record.  
  
An alternative approach would have been to change  
GetLastImportantRecPtr()'s definition to point to the end of records,  
but that would make the checkpoint code more complicated.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: no, code only present in master  

M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c

Second pass on 9.6.3 release notes.

commit   : 334b82cd56a65e09154d9f930d35a761a9c5cfab    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 May 2017 16:28:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 May 2017 16:28:20 -0400    

Click here for diff

Improve description of logical decoding snapshot issues, per suggestion  
from Petr Jelinek.  Mention possible need to re-sync logical replicas  
as a post-upgrade task.  Minor copy-editing for some other items.  

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

Document current_role.

commit   : a9c6d704354bfe91bc389742cb5d331ae4e93831    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 May 2017 14:19:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 May 2017 14:19:47 -0400    

Click here for diff

This system function has been there a very long time, but somehow escaped  
being listed in func.sgml.  
  
Fabien Coelho and Tom Lane  
  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1705061027580.3896@lancre  

M doc/src/sgml/func.sgml

First-draft release notes for 9.6.3.

commit   : 54dbd4dc78b045ffcc046b9a43681770c3992dd4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 May 2017 19:33:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 May 2017 19:33:34 -0400    

Click here for diff

As usual, the release notes for other branches will be made by cutting  
these down, but put them up for community review first.  Note there  
are some entries that really only apply to pre-9.6 branches.  

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

Suppress compiler warning about unportable pointer value.

commit   : b3a47cdfd692079e36d2055d7d93759e083263ca    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 May 2017 12:46:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 May 2017 12:46:04 -0400    

Click here for diff

Setting a pointer value to "0xdeadbeef" draws a warning from some  
compilers, and for good reason.  Be less cute and just set it to NULL.  
  
In passing make some other cosmetic adjustments nearby.  
  
Discussion: https://postgr.es/m/CAJrrPGdW3EkU-CRobvVKYf3fJuBdgWyuGeAbNzAQ4yBh+bfb_Q@mail.gmail.com  

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

Allow MSVC to build with Tcl 8.6.

commit   : 14722c69f924810ecf11769e8b9788b3f82d2a0e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 May 2017 12:05:34 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 May 2017 12:05:34 -0300    

Click here for diff

Commit eaba54c20c5 added support for Tcl 8.6 for configure-supported  
platforms after verifying that pltcl works without further changes, but  
the MSVC tooling wasn't updated accordingly.  Update MSVC to match,  
restructuring the code to avoid duplicating the logic for every Tcl  
version supported.  
  
Backpatch to all live branches, like eaba54c20c5.  In 9.4 and previous,  
change the patch to use backslashes rather than forward, as in the rest  
of the file.  
  
Reported by Paresh More, who also tested the patch I provided.  
Discussion: https://postgr.es/m/CAAgiCNGVw3ssBtSi3ZNstrz5k00ax=UV+_ZEHUeW_LMSGL2sew@mail.gmail.com  

M src/tools/msvc/Mkvcbuild.pm

Prevent panic during shutdown checkpoint

commit   : 086221cf6b1727c2baed4703c582f657b7c5350e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 May 2017 15:09:06 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 May 2017 15:09:06 -0400    

Click here for diff

When the checkpointer writes the shutdown checkpoint, it checks  
afterwards whether any WAL has been written since it started and throws  
a PANIC if so.  At that point, only walsenders are still active, so one  
might think this could not happen, but walsenders can also generate WAL,  
for instance in BASE_BACKUP and certain variants of  
CREATE_REPLICATION_SLOT.  So they can trigger this panic if such a  
command is run while the shutdown checkpoint is being written.  
  
To fix this, divide the walsender shutdown into two phases.  First, the  
postmaster sends a SIGUSR2 signal to all walsenders.  The walsenders  
then put themselves into the "stopping" state.  In this state, they  
reject any new commands.  (For simplicity, we reject all new commands,  
so that in the future we do not have to track meticulously which  
commands might generate WAL.)  The checkpointer waits for all walsenders  
to reach this state before proceeding with the shutdown checkpoint.  
After the shutdown checkpoint is done, the postmaster sends  
SIGINT (previously unused) to the walsenders.  This triggers the  
existing shutdown behavior of sending out the shutdown checkpoint record  
and then terminating.  
  
Author: Michael Paquier <[email protected]>  
Reported-by: Fujii Masao <[email protected]>  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xlog.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/walsender.c
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h

Fix wording in pg_upgrade docs

commit   : 499ae5f5db99c84035e9951fd30e428adf0f40d2    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 5 May 2017 12:42:21 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 5 May 2017 12:42:21 +0200    

Click here for diff

Author: Daniel Gustafsson  

M src/bin/pg_upgrade/IMPLEMENTATION

Build pgoutput.dll in MSVC build

commit   : 28d1c8ccc87128f9b0b937eae277473027c36b7e    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 5 May 2017 12:08:48 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 5 May 2017 12:08:48 +0200    

Click here for diff

Without this, logical replication obviously does not work on Windows  
  
MauMau, with clean.bet additions from me per note from Michael Paquier  

M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/clean.bat

Make SCRAM salts and nonces longer.

commit   : 0557a5dc2cf845639d384801b6861ebbd35dc7ee    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 5 May 2017 10:02:13 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 5 May 2017 10:02:13 +0300    

Click here for diff

The salt is stored base64-encoded. With the old 10 bytes raw length, it was  
always padded to 16 bytes after encoding. We might as well use 12 raw bytes  
for the salt, and it's still encoded into 16 bytes.  
  
Similarly for the random nonces, use a raw length that's divisible by 3, so  
that there's no padding after base64 encoding. Make the nonces longer while  
we're at it. 10 bytes was probably enough to prevent replay attacks, but  
there's no reason to be skimpy here.  
  
Per suggestion from Ɓlvaro HernƔndez Tortosa.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/include/common/scram-common.h
M src/test/regress/expected/password.out
M src/test/regress/sql/password.sql

Misc cleanup of SCRAM code.

commit   : e6e9c4da3a55450b120ad7e3d0be426255850914    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 5 May 2017 10:01:44 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 5 May 2017 10:01:44 +0300    

Click here for diff

* Remove is_scram_verifier() function. It was unused.  
* Fix sanitize_char() function, used in error messages on protocol  
  violations, to print bytes >= 0x7F correctly.  
* Change spelling of scram_MockSalt() function to be more consistent with  
  the surroundings.  
* Change a few more references to "server proof" to "server signature" that  
  I missed in commit d981074c24.  

M src/backend/libpq/auth-scram.c
M src/include/libpq/scram.h
M src/interfaces/libpq/fe-auth-scram.c

Don't use SCRAM-specific "e=invalid-proof" on invalid password.

commit   : 344a113079888c9b9a81ffa3c3a7d95666347119    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 5 May 2017 10:01:41 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 5 May 2017 10:01:41 +0300    

Click here for diff

Instead, send the same FATAL message as with other password-based  
authentication mechanisms. This gives a more user-friendly message:  
  
psql: FATAL:  password authentication failed for user "test"  
  
instead of:  
  
psql: error received from server in SASL exchange: invalid-proof  
  
Even before this patch, the server sent that FATAL message, after the  
SCRAM-specific "e=invalid-proof" message. But libpq would stop at the  
SCRAM error message, and not process the ErrorResponse that would come  
after that. We could've taught libpq to check for an ErrorResponse after  
failed authentication, but it's simpler to modify the server to send only  
the ErrorResponse. The SCRAM specification allows for aborting the  
authentication at any point, using an application-defined error mechanism,  
like PostgreSQL's ErrorResponse. Using the e=invalid-proof message is  
optional.  
  
Reported by Jeff Janes.  
  
Discussion: https://www.postgresql.org/message-id/CAMkU%3D1w3jQ53M1OeNfN8Cxd9O%[email protected]  

M src/backend/libpq/auth-scram.c

Change the way pg_dump retrieves partitioning info

commit   : 44c528810a1eca52a7888ed74c08353d45331b00    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 4 May 2017 22:17:52 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 4 May 2017 22:17:52 -0400    

Click here for diff

This gets rid of the code that issued separate queries to retrieve the  
partitioning parent-child relationship, parent partition key, and child  
partition bound information.  With this patch, the information is  
retrieved instead using the queries issued from getTables() and  
getInherits(), which is both more efficient than the previous approach  
and doesn't require any new code.  
  
Since the partitioning parent-child relationship is now retrieved with  
the same old code that handles inheritance, partition attributes receive  
a proper flagInhAttrs() treatment (that it didn't receive before), which  
is needed so that the inherited NOT NULL constraints are not emitted if  
we already emitted it for the parent.  
  
Also, fix a bug in pg_dump's --binary-upgrade code, which caused pg_dump  
to emit invalid command to attach a partition to its parent.  
  
Author: Amit Langote, with some additional changes by me.  

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/t/002_pg_dump.pl

doc: update PG 10 release notes

commit   : 5469e44ffc2077cb8371686497022cb5afd1af87    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 4 May 2017 20:33:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 4 May 2017 20:33:06 -0400    

Click here for diff

Mention vacuum verbose includes oldest xmin, BRIN index usage  
estimation, and multi-column statistics.  
  
Reported-by: Masahiko Sawada, Alvaro Herrera  

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

doc: PG 10 release note updates for psql, GiST, and markup

commit   : 4f45beba7aea007cbae68eaea5d04d4cab7e4f62    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 4 May 2017 19:33:41 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 4 May 2017 19:33:41 -0400    

Click here for diff

Reported-by: Andrew Borodin, Fabien COELHO, Dagfinn Ilmari Mannsaker  

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

Credit Claudio as main author of feature

commit   : c22b59edd26fb69661188b040ea3e8776a533685    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 4 May 2017 17:50:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 4 May 2017 17:50:54 -0300    

Click here for diff

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

Fix pfree-of-already-freed-tuple when rescanning a GiST index-only scan.

commit   : 3f074845a8c190b365e68e39e39017ff70330f2a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 May 2017 13:59:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 May 2017 13:59:13 -0400    

Click here for diff

GiST's getNextNearest() function attempts to pfree the previously-returned  
tuple if any (that is, scan->xs_hitup in HEAD, or scan->xs_itup in older  
branches).  However, if we are rescanning a plan node after ending a  
previous scan early, those tuple pointers could be pointing to garbage,  
because they would be pointing into the scan's pageDataCxt or queueCxt  
which has been reset.  In a debug build this reliably results in a crash,  
although I think it might sometimes accidentally fail to fail in  
production builds.  
  
To fix, clear the pointer field anyplace we reset a context it might  
be pointing into.  This may be overkill --- I think probably only the  
queueCxt case is involved in this bug, so that resetting in gistrescan()  
would be sufficient --- but dangling pointers are generally bad news,  
so let's avoid them.  
  
Another plausible answer might be to just not bother with the pfree in  
getNextNearest().  The reconstructed tuples would go away anyway in the  
context resets, and I'm far from convinced that freeing them a bit earlier  
really saves anything meaningful.  I'll stick with the original logic in  
this patch, but if we find more problems in the same area we should  
consider that approach.  
  
Per bug #14641 from Denis Smirnov.  Back-patch to 9.5 where this  
logic was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix PQencryptPasswordConn to work with older server versions.

commit   : 20bf7b2b0afcb53608ec37005ee7f831132925d2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 4 May 2017 12:28:25 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 4 May 2017 12:28:25 +0300    

Click here for diff

password_encryption was a boolean before version 10, so cope with "on" and  
"off".  
  
Also, change the behavior with "plain", to treat it the same as "md5".  
We're discussing removing the password_encryption='plain' option from the  
server altogether, which will make this the only reasonable choice, but  
even if we kept it, it seems best to never send the password in cleartext.  

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

Fix cursor_to_xml in tableforest false mode

commit   : 0de791ed760614991e7cb8a78fddd6874ea6919d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 May 2017 21:25:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 May 2017 21:25:01 -0400    

Click here for diff

It only produced <row> elements but no wrapping <table> element.  
  
By contrast, cursor_to_xmlschema produced a schema that is now correct  
but did not previously match the XML data produced by cursor_to_xml.  
  
In passing, also fix a minor misunderstanding about moving cursors in  
the tests related to this.  
  
Reported-by: [email protected]  
Based-on-patch-by: Thomas Munro <[email protected]>  

M src/backend/utils/adt/xml.c
M src/test/regress/expected/xmlmap.out
M src/test/regress/expected/xmlmap_1.out
M src/test/regress/sql/xmlmap.sql

Remove useless and rather expensive stanza in matview regression test.

commit   : 4dd4104342068e542e865e5b0486e14600746221    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 May 2017 19:37:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 May 2017 19:37:01 -0400    

Click here for diff

This removes a test case added by commit b69ec7cc9, which was intended  
to exercise a corner case involving the rule used at that time that  
materialized views were unpopulated iff they had physical size zero.  
We got rid of that rule very shortly later, in commit 1d6c72a55, but  
kept the test case.  However, because the case now asks what VACUUM  
will do to a zero-sized physical file, it would be pretty surprising  
if the answer were ever anything but "nothing" ... and if things were  
indeed that broken, surely we'd find it out from other tests.  Since  
the test involves a table that's fairly large by regression-test  
standards (100K rows), it's quite slow to run.  Dropping it should  
save some buildfarm cycles, so let's do that.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add pg_dump tests for CREATE STATISTICS

commit   : a93077ef467138235c3f05e3ba36dfcabe3d0898    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 May 2017 15:52:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 May 2017 15:52:00 -0300    

Click here for diff

CREATE STATISTICS pg_dump support code was not covered at all by  
previous tests.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pg_dump/t/002: append terminating semicolon to SQL commands

commit   : 698923d6588ee15a386d26c45e5f25ee1a68cc34    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 May 2017 15:12:09 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 May 2017 15:12:09 -0300    

Click here for diff

It's easy to overlook the need for one, and its lack is annoying for the  
next developer wanting to create a new test.  Rather than expect every  
individual command to add the semicolon, just append one automatically.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Add PQencryptPasswordConn function to libpq, use it in psql and createuser.

commit   : 8f8b9be51fd788bb11276df89606bc653163524e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 3 May 2017 11:19:07 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 3 May 2017 11:19:07 +0300    

Click here for diff

The new function supports creating SCRAM verifiers, in addition to md5  
hashes. The algorithm is chosen based on password_encryption, by default.  
  
This fixes the issue reported by Jeff Janes, that there was previously  
no way to create a SCRAM verifier with "\password".  
  
Michael Paquier and me  
  
Discussion: https://www.postgresql.org/message-id/CAMkU%3D1wfBgFPbfAMYZQE78p%3DVhZX7nN86aWkp0QcCp%3D%2BKxZ%3Dbg%40mail.gmail.com  

M doc/src/sgml/libpq.sgml
M src/backend/libpq/auth-scram.c
M src/backend/libpq/crypt.c
M src/bin/psql/command.c
M src/bin/scripts/createuser.c
M src/common/scram-common.c
M src/include/common/scram-common.h
M src/include/libpq/scram.h
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/libpq-fe.h

Improve performance of timezone loading, especially pg_timezone_names view.

commit   : af2c5aa88d38573724e40fa029499b4db20b0eb2    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 May 2017 21:50:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 May 2017 21:50:35 -0400    

Click here for diff

tzparse() would attempt to load the "posixrules" timezone database file on  
each call.  That might seem like it would only be an issue when selecting a  
POSIX-style zone name rather than a zone defined in the timezone database,  
but it turns out that each zone definition file contains a POSIX-style zone  
string and tzload() will call tzparse() to parse that.  Thus, when scanning  
the whole timezone file tree as we do in the pg_timezone_names view,  
"posixrules" was read repetitively for each zone definition file.  Fix  
that by caching the file on first use within any given process.  (We cache  
other zone definitions for the life of the process, so there seems little  
reason not to cache this one as well.)  This probably won't help much in  
processes that never run pg_timezone_names, but even one additional SET  
of the timezone GUC would come out ahead.  
  
An even worse problem for pg_timezone_names is that pg_open_tzfile()  
has an inefficient way of identifying the canonical case of a zone name:  
it basically re-descends the directory tree to the zone file.  That's not  
awful for an individual "SET timezone" operation, but it's pretty horrid  
when we're inspecting every zone in the database.  And it's pointless too  
because we already know the canonical spelling, having just read it from  
the filesystem.  Fix by teaching pg_open_tzfile() to avoid the directory  
search if it's not asked for the canonical name, and backfilling the  
proper result in pg_tzenumerate_next().  
  
In combination these changes seem to make the pg_timezone_names view  
about 3x faster to read, for me.  Since a scan of pg_timezone_names  
has up to now been one of the slowest queries in the regression tests,  
this should help some little bit for buildfarm cycle times.  
  
Back-patch to all supported branches, not so much because it's likely  
that users will care much about the view's performance as because  
tracking changes in the upstream IANA timezone code is really painful  
if we don't keep all the branches in sync.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove create_singleton_array(), hard-coding the case in its sole caller.

commit   : 23c6eb03360d270051bf7dcb289ecb0cd114d29f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 May 2017 20:41:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 May 2017 20:41:37 -0400    

Click here for diff

create_singleton_array() was not really as useful as we perhaps thought  
when we added it.  It had never accreted more than one call site, and is  
only saving a dozen lines of code at that one, which is considerably less  
bulk than the function itself.  Moreover, because of its insistence on  
using the caller's fn_extra cache space, it's arguably a coding hazard.  
text_to_array_internal() does not currently use fn_extra in any other way,  
but if it did it would be subtly broken, since the conflicting fn_extra  
uses could be needed within a single query, in the seldom-tested case that  
the field separator varies during the query.  The same objection seems  
likely to apply to any other potential caller.  
  
The replacement code is a bit uglier, because it hardwires knowledge of  
the storage parameters of type TEXT, but it's not like we haven't got  
dozens or hundreds of other places that do the same.  Uglier seems like  
a good tradeoff for smaller, faster, and safer.  
  
Per discussion with Neha Khatri.  
  
Discussion: https://postgr.es/m/CAFO0U+_fS5SRhzq6uPG+4fbERhoA9N2+nPrtvaC9mmeWivxbsA@mail.gmail.com  

M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/varlena.c
M src/include/utils/array.h

Ensure commands in extension scripts see the results of preceding DDL.

commit   : 9209e07605afe0349660447f20d83ef165cdd0ae    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 May 2017 18:05:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 May 2017 18:05:53 -0400    

Click here for diff

Due to a missing CommandCounterIncrement() call, parsing of a non-utility  
command in an extension script would not see the effects of the immediately  
preceding DDL command, unless that command's execution ends with  
CommandCounterIncrement() internally ... which some do but many don't.  
Report by Philippe Beaudoin, diagnosis by Julien Rouhaud.  
  
Rather remarkably, this bug has evaded detection since extensions were  
invented, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/extension.c
M src/test/modules/test_extensions/test_ext3–1.0.sql

extstats: change output functions to emit valid JSON

commit   : 93bbeec6a21b76612d77176a8054b41277135684    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 2 May 2017 18:49:32 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 2 May 2017 18:49:32 -0300    

Click here for diff

Manipulating extended statistics is more convenient as JSON than the  
current ad-hoc format, so let's change before it's too late.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/perform.sgml
M src/backend/statistics/dependencies.c
M src/backend/statistics/mvdistinct.c
M src/test/regress/expected/stats_ext.out

doc: Improve order in ALTER PUBLICATION/SUBSCRIPTION ref pages

commit   : e9500240661c03750923e6f539bfa2d75cfaa32a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 May 2017 15:29:30 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 May 2017 15:29:30 -0400    

Click here for diff

Move the OWNER and RENAME clauses to the end, so the interesting  
functionality is listed first.  This is more typical on nearby reference  
pages, whereas the previous order was the order in which the clauses  
were added.  

M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_subscription.sgml

Fix typos in comments.

commit   : 0d1e1f0ea45c15170c2d2ae0f0c448bc2d2b72d9    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 2 May 2017 14:47:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 2 May 2017 14:47:46 -0400    

Click here for diff

Etsuro Fujita  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/catalog/partition.c

doc: Add missing markup

commit   : 460c89f46c1fdf11baa8e76e6d04e1ff87d7e008    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 May 2017 14:33:19 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 May 2017 14:33:19 -0400    

Click here for diff

M doc/src/sgml/datatype.sgml

Avoid unnecessary catalog updates in ALTER SEQUENCE

commit   : 3d092fe5409b98272ddd6e623b657308a3c5f004    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 May 2017 10:41:48 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 May 2017 10:41:48 -0400    

Click here for diff

ALTER SEQUENCE can do nontransactional changes to the sequence (RESTART  
clause) and transactional updates to the pg_sequence catalog (most other  
clauses).  When just calling RESTART, the code would still needlessly do  
a catalog update without any changes.  This would entangle that  
operation in the concurrency issues of a catalog update (causing either  
locking or concurrency errors, depending on how that issue is to be  
resolved).  
  
Fix by keeping track during options parsing whether a catalog update is  
needed, and skip it if not.  
  
Reported-by: Jason Petersen <[email protected]>  

M src/backend/commands/sequence.c

doc: Update ALTER SEQUENCE claims about changes being nontransactional

commit   : a35ac7c4e3ccf93876b4652d94a418fc82e0eda3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 May 2017 10:34:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 May 2017 10:34:49 -0400    

Click here for diff

Clarify that all changes except RESTART are transactional (since  
1753b1b027035029c2a2a1649065762fafbf63f3).  
  
Reported-by: Michael Paquier <[email protected]>  

M doc/src/sgml/ref/alter_sequence.sgml

Fix perl thinko in commit fed6df486dca

commit   : 9a0d2008c3fe82c9d62a81e87cd0c4de1be09e0f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 2 May 2017 08:20:11 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 2 May 2017 08:20:11 -0400    

Click here for diff

Report and fix from Vaishnavi Prabakaran  
  
Backpatch to 9.4 like original.  

M src/tools/msvc/vcregress.pl

Change hot_standby default value to 'on'

commit   : 34fc61673829f0cb63811fb63cc3c510fc2aadfc    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 2 May 2017 11:12:30 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 2 May 2017 11:12:30 +0200    

Click here for diff

This goes together with the changes made to enable replication on the  
sending side by default (wal_level, max_wal_senders etc) by making the  
receiving stadby node also enable it by default.  
  
Huong Dangminh  

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

Don't wake up logical replication launcher unnecessarily

commit   : a99448ab4515aaadc17647e53633f418893f5adf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 May 2017 22:50:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 May 2017 22:50:32 -0400    

Click here for diff

In CREATE SUBSCRIPTION, only wake up the launcher when the subscription  
is enabled.  
  
Author: Fujii Masao <[email protected]>  

M src/backend/commands/subscriptioncmds.c

Improve function header comment for create_singleton_array().

commit   : 54affb41e79cf4bec00bb5e00eb12a1715b9e278    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 May 2017 15:31:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 May 2017 15:31:41 -0400    

Click here for diff

Mentioning the caller is neither future-proof nor an adequate substitute  
for giving an API specification.  Per gripe from Neha Khatri, though  
I changed the patch around some.  
  
Discussion: https://postgr.es/m/CAFO0U+_fS5SRhzq6uPG+4fbERhoA9N2+nPrtvaC9mmeWivxbsA@mail.gmail.com  

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

Reduce semijoins with unique inner relations to plain inner joins.

commit   : 92a43e4857d9682b93c9f755f453cc8fd7c66c81    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 May 2017 14:53:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 May 2017 14:53:42 -0400    

Click here for diff

If the inner relation can be proven unique, that is it can have no more  
than one matching row for any row of the outer query, then we might as  
well implement the semijoin as a plain inner join, allowing substantially  
more freedom to the planner.  This is a form of outer join strength  
reduction, but it can't be implemented in reduce_outer_joins() because  
we don't have enough info about the individual relations at that stage.  
Instead do it much like remove_useless_joins(): once we've built base  
relations, we can make another pass over the SpecialJoinInfo list and  
get rid of any entries representing reducible semijoins.  
  
This is essentially a followon to the inner-unique patch (commit 9c7f5229a)  
and makes use of the proof machinery that that patch created.  We need only  
minor refactoring of innerrel_is_unique's API to support this usage.  
  
Per performance complaint from Teodor Sigaev.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/planmain.c
M src/include/optimizer/planmain.h
M src/test/regress/expected/join.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/join.sql

Fix mis-optimization of semijoins with more than one LHS relation.

commit   : 2057a58d1629ebffce694e3cef7f714571a88dd7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 May 2017 14:39:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 May 2017 14:39:11 -0400    

Click here for diff

The inner-unique patch (commit 9c7f5229a) supposed that if we're  
considering a JOIN_UNIQUE_INNER join path, we can always set inner_unique  
for the join, because the inner path produced by create_unique_path should  
be unique relative to the outer relation.  However, that's true only if  
we're considering joining to the whole outer relation --- otherwise we may  
be applying only some of the join quals, and so the inner path might be  
non-unique from the perspective of this join.  Adjust the test to only  
believe that we can set inner_unique if we have the whole semijoin LHS on  
the outer side.  
  
There is more that can be done in this area, but this commit is only  
intended to provide the minimal fix needed to get correct plans.  
  
Per report from Teodor Sigaev.  Thanks to David Rowley for preliminary  
investigation.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/joinpath.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Update time zone data files to tzdata release 2017b.

commit   : 74a20d0ab7c99b3efcf5dc7aac741e3b2f952a34    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 May 2017 11:52:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 May 2017 11:52:59 -0400    

Click here for diff

DST law changes in Chile, Haiti, and Mongolia.  Historical corrections for  
Ecuador, Kazakhstan, Liberia, and Spain.  
  
The IANA crew continue their campaign to replace invented time zone  
abbrevations with numeric GMT offsets.  This update changes numerous zones  
in South America, the Pacific and Indian oceans, and some Asian and Middle  
Eastern zones.  I kept these abbreviations in the tznames/ data files,  
however, so that we will still accept them for input.  (We may want to  
start trimming those files someday, but I think we should wait for the  
upstream dust to settle before deciding what to do.)  
  
In passing, add MESZ (Mitteleuropaeische Sommerzeit) to the tznames lists;  
since we accept MEZ (Mitteleuropaeische Zeit) it seems rather strange not  
to take the other one.  And fix some incorrect, or at least obsolete,  
comments that certain abbreviations are not traceable to the IANA data.  

M src/timezone/data/africa
M src/timezone/data/antarctica
M src/timezone/data/asia
M src/timezone/data/australasia
M src/timezone/data/backward
M src/timezone/data/backzone
M src/timezone/data/europe
M src/timezone/data/northamerica
M src/timezone/data/southamerica
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/Atlantic.txt
M src/timezone/tznames/Australia.txt
M src/timezone/tznames/Default
M src/timezone/tznames/Europe.txt
M src/timezone/tznames/Indian.txt
M src/timezone/tznames/Pacific.txt
M src/timezone/tznames/README

libpq: Fix inadvertent change in .pgpass lookup behavior.

commit   : bdac9836d3b910c5fd592aaeaac3c2e2e1defcad    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 1 May 2017 11:27:09 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 1 May 2017 11:27:09 -0400    

Click here for diff

Commit 274bb2b3857cc987cfa21d14775cae9b0dababa5 caused password file  
lookups to use the hostaddr in preference to the host, but that was  
not intended and the documented behavior is the opposite.  
  
Report and patch by Kyotaro Horiguchi.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Allow vcregress.pl to run an arbitrary TAP test set

commit   : fed6df486dca1b9e53d3f560031b9a236c99f4bb    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 1 May 2017 10:12:02 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 1 May 2017 10:12:02 -0400    

Click here for diff

Currently only provision for running the bin checks in a single step is  
provided for. Now these tests can be run individually, as well as tests  
in other locations (e.g. src.test/recover).  
  
Also provide for suppressing unnecessary temp installs by setting the  
NO_TEMP_INSTALL environment variable just as the Makefiles do.  
  
Backpatch to 9.4.  

M src/tools/msvc/vcregress.pl

Fix logical replication launcher wake up and reset

commit   : 9414e41ea703ea5fcc288bcf7dc000e53306896b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 May 2017 10:18:09 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 May 2017 10:18:09 -0400    

Click here for diff

After the logical replication launcher was told to wake up at  
commit (for example, by a CREATE SUBSCRIPTION command), the flag to wake  
up was not reset, so it would be woken up at every following commit as  
well.  So fix that by resetting the flag.  
  
Also, we don't need to wake up anything if the transaction was rolled  
back.  Just reset the flag in that case.  
  
Author: Masahiko Sawada <[email protected]>  
Reported-by: Fujii Masao <[email protected]>  

M src/backend/access/transam/xact.c
M src/backend/replication/logical/launcher.c
M src/include/replication/logicallauncher.h

Fire per-statement triggers on partitioned tables.

commit   : e180c8aa8caf5c55a273d4a8e6092e77ff3cff10    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 1 May 2017 08:23:01 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 1 May 2017 08:23:01 -0400    

Click here for diff

Even though no actual tuples are ever inserted into a partitioned  
table (the actual tuples are in the partitions, not the partitioned  
table itself), we still need to have a ResultRelInfo for the  
partitioned table, or per-statement triggers won't get fired.  
  
Amit Langote, per a report from Rajkumar Raghuwanshi.  Reviewed by me.  
  
Discussion: http://postgr.es/m/CAKcux6%3DwYospCRY2J4XEFuVy0L41S%3Dfic7rmkbsU-GXhhSbmBg%40mail.gmail.com  

M doc/src/sgml/trigger.sgml
M src/backend/executor/execMain.c
M src/backend/executor/nodeModifyTable.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

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

commit   : e18b2c480da478f62781e06488cda56fe1b4e919    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Apr 2017 15:13:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Apr 2017 15:13:51 -0400    

Click here for diff

zic no longer mishandles some transitions in January 2038 when it  
attempts to work around Qt bug 53071.  This fixes a bug affecting  
Pacific/Tongatapu that was introduced in zic 2016e.  localtime.c  
now contains a workaround, useful when loading a file generated by  
a buggy zic.  
  
There are assorted cosmetic changes as well, notably relocation  
of a bunch of #defines.  

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

Fix possible null pointer dereference or invalid warning message.

commit   : 12d11432b4db8a2ae665287e05f0f6868d35545e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Apr 2017 12:21:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Apr 2017 12:21:02 -0400    

Click here for diff

Thinko in commit de4389712: this warning message references the wrong  
"LogicalRepWorker *" variable.  This would often result in a core dump,  
but if it didn't, the message would show the wrong subscription OID.  
  
In passing, adjust the message text to format a subscription OID  
similarly to how that's done elsewhere in the function; and fix  
grammatical issues in some nearby messages.  
  
Per Coverity testing.  

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

Micro-optimize some slower queries in the opr_sanity regression test.

commit   : c23844212d768b0423859437ca8189b89fd85250    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 29 Apr 2017 20:14:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 29 Apr 2017 20:14:52 -0400    

Click here for diff

Convert the binary_coercible() and physically_coercible() functions from  
SQL to plpgsql.  It's not that plpgsql is inherently better at doing  
queries; if you simply convert the previous single SQL query into one  
RETURN expression, it's no faster.  The problem with the existing code  
is that it fools the plancache into deciding that it's worth re-planning  
the query every time, since constant-folding with a concrete value for $2  
allows elimination of at least one sub-SELECT.  In reality that's using the  
planner to do the equivalent of a few runtime boolean tests, causing the  
function to run much slower than it should.  Splitting the AND/OR logic  
into separate plpgsql statements allows each if-expression to acquire a  
static plan.  
  
Also, get rid of some uses of obj_description() in favor of explicitly  
joining to pg_description, allowing the joins to be optimized better.  
(Someday we might improve the SQL-function-inlining logic enough that  
this happens automatically, but today is not that day.)  
  
Together, these changes reduce the runtime of the opr_sanity regression  
test by about a factor of two on one of my slower machines.  They don't  
seem to help as much on a fast machine, but this should at least benefit  
the buildfarm.  

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

doc: Fix typo in 9.6 release notes

commit   : bc920bee296ec4c1e8cd1598c71f21d80a59d351    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 28 Apr 2017 15:30:54 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 28 Apr 2017 15:30:54 -0400    

Click here for diff

Author: Huong Dangminh <[email protected]>  

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

Fix VALIDATE CONSTRAINT to consider NO INHERIT attribute.

commit   : 6a4dda44e02bfd5148c13b00d8f81045a2e17f2c    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 28 Apr 2017 14:48:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 28 Apr 2017 14:48:38 -0400    

Click here for diff

Currently, trying to validate a NO INHERIT constraint on the parent will  
search for the constraint in child tables (where it is not supposed to  
exist), wrongly causing a "constraint does not exist" error.  
  
Amit Langote, per a report from Hans Buschmann.  
  
Discussion: http://postgr.es/m/[email protected]  

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

psql: Support identity columns in sequence display

commit   : e4fddfd49241dc8dfda354993bad8d5518df1873    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 28 Apr 2017 14:43:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 28 Apr 2017 14:43:36 -0400    

Click here for diff

Where the footer for an owned serial sequence would say "Owned by", put  
something analogous for a sequence belonging to an identity column.  
  
Reported-by: Vitaly Burovoy <[email protected]>  

M src/bin/psql/describe.c

In load_relcache_init_file, initialize rd_pdcxt.

commit   : 5e1ccd48442dbdbe812c95cd70cc1d3c1c960c4c    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 28 Apr 2017 14:05:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 28 Apr 2017 14:05:13 -0400    

Click here for diff

Oversight noted by Gao Zeng Qi.  
  
Discussion: http://postgr.es/m/CAFmBtr1N3-SbepJbnGpaYp=jw-FvWMnYY7-bTtRgvjvbyB8YJA@mail.gmail.com  

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

Speed up dropping tables with many partitions.

commit   : c1e0e7e1d790bf18c913e6a452dea811e858b554    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 28 Apr 2017 14:00:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 28 Apr 2017 14:00:58 -0400    

Click here for diff

We need to lock the parent, but we don't need a relcache entry  
for it.  
  
Gao Zeng Qi, reviewed by Amit Langote  
  
Discussion: http://postgr.es/m/CAFmBtr0ukqJjRJEhPWL5wt4rNMrJUUxggVAGXPR3SyYh3E+HDQ@mail.gmail.com  

M src/backend/catalog/heap.c

Fix crash when partitioned column specified twice.

commit   : 504c2205abc7de67386f9c95630f38ee15626f07    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 28 Apr 2017 13:52:17 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 28 Apr 2017 13:52:17 -0400    

Click here for diff

Amit Langote, reviewed by Beena Emerson  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Wait between tablesync worker restarts

commit   : e3cf708016ca6045dc1cd5a0768cfecf17caf3d1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 27 Apr 2017 14:57:26 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 27 Apr 2017 14:57:26 -0400    

Click here for diff

Before restarting a tablesync worker for the same relation, wait  
wal_retrieve_retry_interval (currently 5s by default).  This avoids  
restarting failing workers in a tight loop.  
  
We keep the last start times in a hash table last_start_times that is  
separate from the table_states list, because that list is cleared out on  
syscache invalidation, which happens whenever a table finishes syncing.  
The hash table is kept until all tables have finished syncing.  
  
A future project might be to unify these two and keep everything in one  
data structure, but for now this is a less invasive change to accomplish  
the original purpose.  
  
For the test suite, set wal_retrieve_retry_interval to its minimum  
value, to not increase the test suite run time.  
  
Reviewed-by: Petr Jelinek <[email protected]>  
Reported-by: Masahiko Sawada <[email protected]>  

M src/backend/replication/logical/tablesync.c
M src/test/subscription/t/004_sync.pl

Misc SCRAM code cleanups.

commit   : d981074c24d2f1e4f44bc6d80e967e523ce64f50    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 28 Apr 2017 15:04:02 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 28 Apr 2017 15:04:02 +0300    

Click here for diff

* Move computation of SaltedPassword to a separate function from  
  scram_ClientOrServerKey(). This saves a lot of cycles in libpq, by  
  computing SaltedPassword only once per authentication. (Computing  
  SaltedPassword is expensive by design.)  
  
* Split scram_ClientOrServerKey() into two functions. Improves  
  readability, by making the calling code less verbose.  
  
* Rename "server proof" to "server signature", to better match the  
  nomenclature used in RFC 5802.  
  
* Rename SCRAM_SALT_LEN to SCRAM_DEFAULT_SALT_LEN, to make it more clear  
  that the salt can be of any length, and the constant only specifies how  
  long a salt we use when we generate a new verifier. Also rename  
  SCRAM_ITERATIONS_DEFAULT to SCRAM_DEFAULT_ITERATIONS, for consistency.  
  
These things caught my eye while working on other upcoming changes.  

M src/backend/libpq/auth-scram.c
M src/common/scram-common.c
M src/include/common/scram-common.h
M src/interfaces/libpq/fe-auth-scram.c

Remove unnecessairly duplicated gram.y productions

commit   : b9a3ef55b253d885081c2d0e9dc45802cab71c7b    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 27 Apr 2017 20:14:39 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 27 Apr 2017 20:14:39 -0400    

Click here for diff

Declarative partitioning duplicated the TypedTableElement productions,  
evidently to remove the need to specify WITH OPTIONS when creating  
partitions.  Instead, simply make WITH OPTIONS optional in the  
TypedTableElement production and remove all of the duplicate  
PartitionElement-related productions.  This change simplifies the  
syntax and makes WITH OPTIONS optional when adding defaults, constraints  
or storage parameters to columns when creating either typed tables or  
partitions.  
  
Also update pg_dump to no longer include WITH OPTIONS, since it's not  
necessary, and update the documentation to reflect that WITH OPTIONS is  
now optional.  

M doc/src/sgml/ref/create_foreign_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/parser/gram.y
M src/bin/pg_dump/pg_dump.c
M src/test/regress/expected/create_table.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/typed_table.out
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/typed_table.sql

Don't build full initial logical decoding snapshot if NOEXPORT_SNAPSHOT.

commit   : ab9c43381ef7a7333086107847413e0b593854d0    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 27 Apr 2017 15:49:22 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 27 Apr 2017 15:49:22 -0700    

Click here for diff

Earlier commits (56e19d938dd14 and 2bef06d5164) make it cheaper to  
create a logical slot if not exporting the initial snapshot.  If  
NOEXPORT_SNAPSHOT is specified, we can skip the overhead, not just  
when creating a slot via sql (which can't export snapshots).  As  
NOEXPORT_SNAPSHOT has only recently been introduced, this shouldn't be  
backpatched.  

M src/backend/replication/walsender.c

Don't use on-disk snapshots for exported logical decoding snapshot.

commit   : 56e19d938dd1457ae078304df1b9903509a0a2bf    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 27 Apr 2017 15:28:24 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 27 Apr 2017 15:28:24 -0700    

Click here for diff

Logical decoding stores historical snapshots on disk, so that logical  
decoding can restart without having to reconstruct a snapshot from  
scratch (for which the resources are not guaranteed to be present  
anymore).  These serialized snapshots were also used when creating a  
new slot via the walsender interface, which can export a "full"  
snapshot (i.e. one that can read all tables, not just catalog ones).  
  
The problem is that the serialized snapshots are only useful for  
catalogs and not for normal user tables.  Thus the use of such a  
serialized snapshot could result in an inconsistent snapshot being  
exported, which could lead to queries returning wrong data.  This  
would only happen if logical slots are created while another logical  
slot already exists.  
  
Author: Petr Jelinek  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backport: 9.4, where logical decoding was introduced.  

M src/backend/replication/logical/logical.c
M src/backend/replication/logical/snapbuild.c
M src/include/replication/snapbuild.h

Avoid slow shutdown of pg_basebackup.

commit   : 7834d20b57a4320308c3f8262fabf898f89e6a71    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Apr 2017 18:27:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Apr 2017 18:27:02 -0400    

Click here for diff

pg_basebackup's child process did not pay any attention to the pipe  
from its parent while waiting for input from the source server.  
If no server data was arriving, it would only wake up and check the  
pipe every standby_message_timeout or so.  This creates a problem  
since the parent process might determine and send the desired stop  
position only after the server has reached end-of-WAL and stopped  
sending data.  In the src/test/recovery regression tests, the timing  
is repeatably such that it takes nearly 10 seconds for the child  
process to realize that it should shut down.  It's not clear how  
often that would happen in real-world cases, but it sure seems like  
a bug --- and if the user turns off standby_message_timeout or sets  
it very large, the delay could be a lot worse.  
  
To fix, expand the StreamCtl API to allow the pipe input FD to be  
passed down to the low-level wait routine, and watch both sockets  
when sleeping.  
  
(Note: AFAICS this issue doesn't affect the Windows port, since  
it doesn't rely on a pipe to transfer the stop position to the  
child thread.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h

Fix bug so logical rep launcher saves correctly time of last startup of worker.

commit   : 9f11fcec6624511ca85c1a6b049201be1fed6ef4    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 28 Apr 2017 06:35:00 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 28 Apr 2017 06:35:00 +0900    

Click here for diff

Previously the logical replication launcher stored the last timestamp  
when it started the worker, in the local variable "last_start_time",  
in order to check whether wal_retrive_retry_interval elapsed since  
the last startup of worker. If it has elapsed, the launcher sees  
pg_subscription and starts new worker if necessary. This is for  
limitting the startup of worker to once a wal_retrieve_retry_interval.  
  
The bug was that the variable "last_start_time" was defined and  
always initialized with 0 at the beginning of the launcher's main loop.  
So even if it's set to the last timestamp in later phase of the loop,  
it's always reset to 0. Therefore the launcher could not check  
correctly whether wal_retrieve_retry_interval elapsed since  
the last startup.  
  
This patch moves the variable "last_start_time" outside the main loop  
so that it will not be reset.  
  
Reviewed-by: Petr Jelinek  
Discussion: http://postgr.es/m/CAHGQGwGJrPO++XM4mFENAwpy1eGXKsGdguYv43GUgLgU-x8nTQ@mail.gmail.com  

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

Cope with glibc too old to have epoll_create1().

commit   : 82ebbeb0abfe40fe5f19a6fcdffc7484fd3a35b0    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Apr 2017 17:13:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Apr 2017 17:13:29 -0400    

Click here for diff

Commit fa31b6f4e supposed that we didn't have to worry about that  
anymore, but it seems that RHEL5 is like that, and that's still  
a supported platform.  Put back the prior coding under an #ifdef,  
adding an explicit fcntl() to retain the desired CLOEXEC property.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Preserve required !catalog tuples while computing initial decoding snapshot.

commit   : 2bef06d51646058c6bb480fcdbffb1f0cc914fed    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 23 Apr 2017 20:41:29 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 23 Apr 2017 20:41:29 -0700    

Click here for diff

The logical decoding machinery already preserved all the required  
catalog tuples, which is sufficient in the course of normal logical  
decoding, but did not guarantee that non-catalog tuples were preserved  
during computation of the initial snapshot when creating a slot over  
the replication protocol.  
  
This could cause a corrupted initial snapshot being exported.  The  
time window for issues is usually not terribly large, but on a busy  
server it's perfectly possible to it hit it.  Ongoing decoding is not  
affected by this bug.  
  
To avoid increased overhead for the SQL API, only retain additional  
tuples when a logical slot is being created over the replication  
protocol.  To do so this commit changes the signature of  
CreateInitDecodingContext(), but it seems unlikely that it's being  
used in an extension, so that's probably ok.  
  
In a drive-by fix, fix handling of  
ReplicationSlotsComputeRequiredXmin's already_locked argument, which  
should only apply to ProcArrayLock, not ReplicationSlotControlLock.  
  
Reported-By: Erik Rijkers  
Analyzed-By: Petr Jelinek  
Author: Petr Jelinek, heavily editorialized by Andres Freund  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backport: 9.4, where logical decoding was introduced.  

M src/backend/replication/logical/logical.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/procarray.c
M src/include/replication/logical.h
M src/include/storage/procarray.h

Make latch.c more paranoid about child-process cases.

commit   : fa31b6f4e9696f3c9777bf4ec2faea822826ce9f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Apr 2017 15:07:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Apr 2017 15:07:36 -0400    

Click here for diff

Although the postmaster doesn't currently create a self-pipe or any  
latches, there's discussion of it doing so in future.  It's also  
conceivable that a shared_preload_libraries extension would try to  
create such a thing in the postmaster process today.  In that case  
the self-pipe FDs would be inherited by forked child processes.  
latch.c was entirely unprepared for such a case and could suffer an  
assertion failure, or worse try to use the inherited pipe if somebody  
called WaitLatch without having called InitializeLatchSupport in that  
process.  Make it keep track of whether InitializeLatchSupport has been  
called in the *current* process, and do the right thing if state has  
been inherited from a parent.  
  
Apply FD_CLOEXEC to file descriptors created in latch.c (the self-pipe,  
as well as epoll event sets).  This ensures that child processes spawned  
in backends, the archiver, etc cannot accidentally or intentionally mess  
with these FDs.  It also ensures that we end up with the right state  
for the self-pipe in EXEC_BACKEND processes, which otherwise wouldn't  
know to close the postmaster's self-pipe FDs.  
  
Back-patch to 9.6, mainly to keep latch.c looking similar in all branches  
it exists in.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: PG10 release note typo fix

commit   : a311d2a04f849f76d33b59995097999a311a4c62    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 27 Apr 2017 10:21:44 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 27 Apr 2017 10:21:44 -0400    

Click here for diff

Reported-by: daniel.westermann  

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

doc PG10rel: adjust hash index commits and add parallel subquery

commit   : f8ab08ad0e411139060bf943fa9931f7fbe97cde    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 27 Apr 2017 10:17:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 27 Apr 2017 10:17:08 -0400    

Click here for diff

Reported-by: Amit Kapila  

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

Rework handling of subtransactions in 2PC recovery

commit   : 49e928154978da2a5976628588fc545b726ad84a    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 27 Apr 2017 14:41:22 +0200    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 27 Apr 2017 14:41:22 +0200    

Click here for diff

The bug fixed by 0874d4f3e183757ba15a4b3f3bf563e0393dd9c2  
caused us to question and rework the handling of  
subtransactions in 2PC during and at end of recovery.  
Patch adds checks and tests to ensure no further bugs.  
  
This effectively removes the temporary measure put in place  
by 546c13e11b29a5408b9d6a6e3cca301380b47f7f.  
  
Author: Simon Riggs  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: http://postgr.es/m/CANP8+j+vvXmruL_i2buvdhMeVv5TQu0Hm2+C5N+kdVwHJuor8w@mail.gmail.com  

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/storage/ipc/procarray.c
M src/include/access/subtrans.h
M src/include/access/twophase.h

Additional tests for subtransactions in recovery

commit   : 0352c15e5ab4f70c3ab2ac1d48d9f38a5dd11786    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 27 Apr 2017 14:26:57 +0200    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 27 Apr 2017 14:26:57 +0200    

Click here for diff

Tests for normal and prepared transactions  
  
Author: Nikhil Sontakke, placed in new test file by me  

M src/test/recovery/t/009_twophase.pl
A src/test/recovery/t/012_subtransactions.pl

Fix typo in comment

commit   : 6c9bd27aece5efd0ccef668828a44f59bd2c7a44    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 26 Apr 2017 21:12:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 26 Apr 2017 21:12:35 -0400    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

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

Allow multiple bgworkers to be launched per postmaster iteration.

commit   : aa1351f1eec4adae39be59ce9a21410f9dd42118    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Apr 2017 16:17:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Apr 2017 16:17:29 -0400    

Click here for diff

Previously, maybe_start_bgworker() would launch at most one bgworker  
process per call, on the grounds that the postmaster might otherwise  
neglect its other duties for too long.  However, that seems overly  
conservative, especially since bad effects only become obvious when  
many hundreds of bgworkers need to be launched at once.  On the other  
side of the coin is that the existing logic could result in substantial  
delay of bgworker launches, because ServerLoop isn't guaranteed to  
iterate immediately after a signal arrives.  (My attempt to fix that  
by using pselect(2) encountered too many portability question marks,  
and in any case could not help on platforms without pselect().)  
One could also question the wisdom of using an O(N^2) processing  
method if the system is intended to support so many bgworkers.  
  
As a compromise, allow that function to launch up to 100 bgworkers  
per call (and in consequence, rename it to maybe_start_bgworkers).  
This will allow any normal parallel-query request for workers  
to be satisfied immediately during sigusr1_handler, avoiding the  
question of whether ServerLoop will be able to launch more promptly.  
  
There is talk of rewriting the postmaster to use a WaitEventSet to  
avoid the signal-response-delay problem, but I'd argue that this change  
should be kept even after that happens (if it ever does).  
  
Backpatch to 9.6 where parallel query was added.  The issue exists  
before that, but previous uses of bgworkers typically aren't as  
sensitive to how quickly they get launched.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c

doc PG10: add commit for transition table item

commit   : fda4fec578505a624e4c0f0244816ae5bc10a3d1    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 26 Apr 2017 15:50:51 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 26 Apr 2017 15:50:51 -0400    

Click here for diff

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

pg_get_partkeydef: return NULL for non-partitions

commit   : 0c76c2463e8ab4cfd633ad8de259050e3f28b78f    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 26 Apr 2017 14:59:22 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 26 Apr 2017 14:59:22 -0400    

Click here for diff

Our general rule for pg_get_X(oid) functions is to simply return NULL  
when passed an invalid or inappropriate OID.  Teach pg_get_partkeydef to  
do this also, making it easier for users to use this function when  
querying against tables with both partitions and non-partitions (such as  
pg_class).  
  
As a concrete example, this makes pg_dump's life a little easier.  
  
Author: Amit Langote  

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

Silence compiler warning induced by commit de4389712.

commit   : 49da00677dc25d83be44372918e21a405863ace2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Apr 2017 14:01:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Apr 2017 14:01:26 -0400    

Click here for diff

Smarter compilers can see that "slot" can't be used uninitialized,  
but some popular ones cannot.  Noted by Jeff Janes.  

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

doc: ALTER SUBSCRIPTION documentation fixes

commit   : e315346d839ef27f9d5f2584f44de09f08573df2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 26 Apr 2017 12:05:11 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 26 Apr 2017 12:05:11 -0400    

Click here for diff

WITH is optional for REFRESH PUBLICATION.  Also, remove a spurious  
bracket and fix a punctuation.  
  
Author: Euler Taveira <[email protected]>  

M doc/src/sgml/ref/alter_subscription.sgml

Fix query that gets remote relation info

commit   : 61ecc90be624e699164a8d3efb291e267b711142    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 26 Apr 2017 12:05:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 26 Apr 2017 12:05:04 -0400    

Click here for diff

Publisher relation can be incorrectly chosen, if there are more than  
one relation in different schemas with the same name.  
  
Author: Euler Taveira <[email protected]>  

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

Spelling fixes in code comments

commit   : e495c1683f2c243f6769b34a009cf9c28526b555    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 26 Apr 2017 12:04:44 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 26 Apr 2017 12:04:44 -0400    

Click here for diff

Author: Euler Taveira <[email protected]>  

M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_subscription.c
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/tablesync.c

Fix typo in comment.

commit   : 1f8b060121d654fbb08702752f63d251f5ce8088    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 27 Apr 2017 00:03:07 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 27 Apr 2017 00:03:07 +0900    

Click here for diff

Author: Masahiko Sawada  

M src/backend/commands/subscriptioncmds.c

Fix various concurrency issues in logical replication worker launching

commit   : de4389712206d2686e09ad8d6dd112dc4b6c6d42    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 26 Apr 2017 10:43:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 26 Apr 2017 10:43:04 -0400    

Click here for diff

The code was originally written with assumption that launcher is the  
only process starting the worker.  However that hasn't been true since  
commit 7c4f52409 which failed to modify the worker management code  
adequately.  
  
This patch adds an in_use field to the LogicalRepWorker struct to  
indicate whether the worker slot is being used and uses proper locking  
everywhere this flag is set or read.  
  
However if the parent process dies while the new worker is starting and  
the new worker fails to attach to shared memory, this flag would never  
get cleared.  We solve this rare corner case by adding a sort of garbage  
collector for in_use slots.  This uses another field in the  
LogicalRepWorker struct named launch_time that contains the time when  
the worker was started.  If any request to start a new worker does not  
find free slot, we'll check for workers that were supposed to start but  
took too long to actually do so, and reuse their slot.  
  
In passing also fix possible race conditions when stopping a worker that  
hasn't finished starting yet.  
  
Author: Petr Jelinek <[email protected]>  
Reported-by: Fujii Masao <[email protected]>  

M src/backend/replication/logical/launcher.c
M src/include/replication/worker_internal.h

doc PG10: add Rafia Sabih to parallel index scan item

commit   : 309191f66a947c5b63dd348a13aafa52b5847f94    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 26 Apr 2017 06:33:25 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 26 Apr 2017 06:33:25 -0400    

Click here for diff

Reported-by: Amit Kapila  

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

Allow ALTER TABLE ONLY on partitioned tables

commit   : 9139aa19423b736470f669e566f8ef6a7f19b801    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 25 Apr 2017 16:57:43 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 25 Apr 2017 16:57:43 -0400    

Click here for diff

There is no need to forbid ALTER TABLE ONLY on partitioned tables,  
when no partitions exist yet.  This can be handy for users who are  
building up their partitioned table independently and will create actual  
partitions later.  
  
In addition, this is how pg_dump likes to operate in certain instances.  
  
Author: Amit Langote, with some error message word-smithing by me  

M doc/src/sgml/ddl.sgml
M src/backend/commands/tablecmds.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/truncate.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/truncate.sql

doc PG10: update EXPLAIN SUMMARY item

commit   : 5f2b48d1dd17156c2021f9fa7c85d5c550bc2c6a    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 15:30:45 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 15:30:45 -0400    

Click here for diff

Reported-by: Tels  

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

Wake up launcher when enabling a subscription

commit   : a3f17b9c315512e9c116dbc243056aad8b372e18    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 25 Apr 2017 14:40:33 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 25 Apr 2017 14:40:33 -0400    

Click here for diff

Otherwise one would have to wait up to DEFAULT_NAPTIME_PER_CYCLE until  
the subscription worker is considered for starting.  
  
There is a small race condition:  If one enables a subscription right  
after disabling it, the launcher might not have registered the stopping  
when receiving the wakeup signal for the re-enabling.  The start will  
then not happen right away but after the full cycle time.  
  
Author: Kyotaro HORIGUCHI <[email protected]>  

M src/backend/commands/subscriptioncmds.c

doc: update PG 10 item about referencing many relations

commit   : ef0ba572b6e163328a2292bf9d6de7c919bd7cdd    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 13:47:51 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 13:47:51 -0400    

Click here for diff

Reported-by: Tom Lane  

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

doc: add PG 10 doc item about VACUUM truncation, 7e26e02ee

commit   : 3d7741194a4688adea8404ab0a7bb57bac20232b    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 13:45:47 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 13:45:47 -0400    

Click here for diff

Reported-by: Andres Freund  

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

doc PG10: add commit 090010f2e and adjust EXPLAIN SUMMARY item

commit   : 3640cf5e1c8a0ae6ac55bf6384de0521dc77facf    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 13:29:26 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 13:29:26 -0400    

Click here for diff

Reported-by: Tels, Andres Freund  

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

doc: properly indent SGML tags in PG 10 release notes

commit   : bf368fbee2a9ff1139b9331f025986ba68b8922a    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 12:54:37 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 12:54:37 -0400    

Click here for diff

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

Set the priorities of all quorum synchronous standbys to 1.

commit   : 346199dcab4cfb2c023373fb3d859583b59810d7    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 26 Apr 2017 01:07:13 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 26 Apr 2017 01:07:13 +0900    

Click here for diff

In quorum-based synchronous replication, all the standbys listed in  
synchronous_standby_names equally have chances to be chosen  
as synchronous standbys. So they should have the same priority.  
However, previously, quorum standbys whose names appear earlier  
in the list were given higher priority values though the difference of  
those priority values didn't affect the selection of synchronous standbys.  
Users could see those "meaningless" priority values in pg_stat_replication  
and this was confusing.  
  
This commit gives all the quorum synchronous standbys the same  
highest priority, i.e., 1, in order to remove such confusion.  
  
Author: Fujii Masao  
Reviewed-by: Masahiko Sawada, Kyotaro Horiguchi  
Discussion: http://postgr.es/m/CAHGQGwEKOw=SmPLxJzkBsH6wwDBgOnVz46QjHbtsiZ-d-2RGUg@mail.gmail.com  

M src/backend/replication/syncrep.c
M src/test/recovery/t/007_sync_rep.pl

doc: PG 10 release notes updates

commit   : cdd5bcad5ea6a2409e38e5c6e11e9901dae2d946    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 11:17:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 11:17:14 -0400    

Click here for diff

Reported-by: Michael Paquier, Felix Gerzaguet  

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

doc: PG 10 release note updates

commit   : 64f0f7cfc75d92910cadb07dbcce3844eec79c36    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 11:04:35 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 11:04:35 -0400    

Click here for diff

Reported-by: David Rowley, Amit Langote, Ashutosh Bapat  

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

Adjust outdated comment.

commit   : 914ae8d3cbbe480f8002a38deef4a5319970d2f4    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 25 Apr 2017 10:57:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 25 Apr 2017 10:57:13 -0400    

Click here for diff

Commit 5dfc198146b49ce7ecc8a1fc9d5e171fb75f6ba5 removed the only  
existing caller of hash_freeze, but left behind a comment indicating  
that hash_freeze was still used.  Adjust.  
  
Kyotaro Horiguchi  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/utils/hash/dynahash.c

commit   : 7cc14ae9d8a46a6fac002cb5d7ef385fc6ccdeb4    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 25 Apr 2017 23:38:41 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 25 Apr 2017 23:38:41 +0900    

Click here for diff

This commit also fixes copyright line missed by the automated script.  
  
Author: Masahiko Sawada  

M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/mmgr/memdebug.c

doc: move hash info to new section and split out growth item

commit   : 45e3d8ae2b1d16f6e6453089424e9c3346fa35f8    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 09:44:50 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 25 Apr 2017 09:44:50 -0400    

Click here for diff

Reported-by: Amit Kapila  

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

doc: move hash performance item into index section

commit   : cef5dbbf2b8d8a5e7b536bcbf6d9066588c6173b    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 23:29:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 23:29:14 -0400    

Click here for diff

The requirement to rebuild pg_upgrade-ed hash indexes was kept in the  
incompatibilities section.  
  
Reported-by: Amit Kapila  

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

doc: add Rafia Sabih to PG 10 release note item

commit   : b007b1af20c3b276d5804b11dc3e471c8045480b    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 23:08:25 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 23:08:25 -0400    

Click here for diff

Reported-by: Amit Kapila  

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

doc: fix PG 10 release note doc markup

commit   : d103e6718bfe4a1f50eb25b94db2cf9f84c69766    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 22:53:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 22:53:16 -0400    

Click here for diff

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

doc: merge PG 10 release SysV item

commit   : 419a055454dd234b78925e605582caf0def51ecb    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 22:51:20 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 22:51:20 -0400    

Click here for diff

Reported-by: Takayuki Tsunakawa  

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

postgres_fdw: Fix join push down with extensions

commit   : 332bec1e6096679b04ec9717beb44a858495260f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 24 Apr 2017 22:50:07 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 24 Apr 2017 22:50:07 -0400    

Click here for diff

Objects in an extension are shippable to a foreign server if the  
extension is part of the foreign server definition's shippable  
extensions list.  But this was not properly considered in some cases  
when checking whether a join condition can be pushed to a foreign server  
and the join condition uses an object from a shippable extension.  So  
the join would never be pushed down in those cases.  
  
So, the list of extensions needs to be made available in fpinfo of the  
relation being considered to be pushed down before any expressions are  
assessed for being shippable.  Fix foreign_join_ok() to do that for a  
join relation.  
  
The code to save FDW options in fpinfo is scattered at multiple places.  
Bring all of that together into functions apply_server_options(),  
apply_table_options(), and merge_fdw_options().  
  
David Rowley and Ashutosh Bapat, per report from David Rowley  

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

doc: PG 10 fixes

commit   : 6e033c6a9639078501ac1830676ae062ee8a4aca    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 22:48:25 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 22:48:25 -0400    

Click here for diff

Reported-by: Takayuki Tsunakawa  

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

doc: several minor PG 10 doc adjustments

commit   : bba375eb9df037c73af3743521f2b44e6fdf8c3b    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 22:45:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 22:45:06 -0400    

Click here for diff

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

doc: fix attribution of sequence item, order incompatibilities

commit   : a0d932b39da7d7445dfc8da1e9979dd5cf4ea0a1    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 21:53:37 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 21:53:37 -0400    

Click here for diff

Reported-by: Andreas Karlsson  

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

doc: first draft of Postgres 10 release notes

commit   : 1d8573ed5569c014b9fd32e42248e58c7c28386d    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 21:26:33 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 21:26:33 -0400    

Click here for diff

M doc/src/sgml/filelist.sgml
M doc/src/sgml/ref/create_table.sgml
A doc/src/sgml/release-10.sgml
M doc/src/sgml/release.sgml

doc: update release doc markup instructions

commit   : 66fade8a0447093e6bd5a39ee6fec38790479664    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 19:04:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 24 Apr 2017 19:04:28 -0400    

Click here for diff

M doc/src/sgml/release.sgml

Revert "Use pselect(2) not select(2), if available, to wait in postmaster's loop."

commit   : 64925603c972aa3a9f1d4c42686dba67f1a7e9d0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Apr 2017 18:29:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Apr 2017 18:29:03 -0400    

Click here for diff

This reverts commit 81069a9efc5a374dd39874a161f456f0fb3afba4.  
  
Buildfarm results suggest that some platforms have versions of pselect(2)  
that are not merely non-atomic, but flat out non-functional.  Revert the  
use-pselect patch to confirm this diagnosis (and exclude the no-SA_RESTART  
patch as the source of trouble).  If it's so, we should probably look into  
blacklisting specific platforms that have broken pselect.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/backend/postmaster/postmaster.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Use pselect(2) not select(2), if available, to wait in postmaster's loop.

commit   : 81069a9efc5a374dd39874a161f456f0fb3afba4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Apr 2017 14:03:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Apr 2017 14:03:14 -0400    

Click here for diff

Traditionally we've unblocked signals, called select(2), and then blocked  
signals again.  The code expects that the select() will be cancelled with  
EINTR if an interrupt occurs; but there's a race condition, which is that  
an already-pending signal will be delivered as soon as we unblock, and then  
when we reach select() there will be nothing preventing it from waiting.  
This can result in a long delay before we perform any action that  
ServerLoop was supposed to have taken in response to the signal.  As with  
the somewhat-similar symptoms fixed by commit 893902085, the main practical  
problem is slow launching of parallel workers.  The window for trouble is  
usually pretty short, corresponding to one iteration of ServerLoop; but  
it's not negligible.  
  
To fix, use pselect(2) in place of select(2) where available, as that's  
designed to solve exactly this problem.  Where not available, we continue  
to use the old way, and are no worse off than before.  
  
pselect(2) has been required by POSIX since about 2001, so most modern  
platforms should have it.  A bigger portability issue is that some  
implementations are said to be non-atomic, ie pselect() isn't really  
any different from unblock/select/reblock.  Still, we're no worse off  
than before on such a platform.  
  
There is talk of rewriting the postmaster to use a WaitEventSet and  
not do signal response work in signal handlers, at which point this  
could be reverted, since we'd be using a self-pipe to solve the race  
condition.  But that's not happening before v11 at the earliest.  
  
Back-patch to 9.6.  The problem exists much further back, but the  
worst symptom arises only in connection with parallel query, so it  
does not seem worth taking any portability risks in older branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/backend/postmaster/postmaster.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Run the postmaster's signal handlers without SA_RESTART.

commit   : 8939020853e63da6b4f5a63f023b02776a441b5d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Apr 2017 13:00:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Apr 2017 13:00:23 -0400    

Click here for diff

The postmaster keeps signals blocked everywhere except while waiting  
for something to happen in ServerLoop().  The code expects that the  
select(2) will be cancelled with EINTR if an interrupt occurs; without  
that, followup actions that should be performed by ServerLoop() itself  
will be delayed.  However, some platforms interpret the SA_RESTART  
signal flag as meaning that they should restart rather than cancel  
the select(2).  Worse yet, some of them restart it with the original  
timeout delay, meaning that a steady stream of signal interrupts can  
prevent ServerLoop() from iterating at all if there are no incoming  
connection requests.  
  
Observable symptoms of this, on an affected platform such as HPUX 10,  
include extremely slow parallel query startup (possibly as much as  
30 seconds) and failure to update timestamps on the postmaster's sockets  
and lockfiles when no new connections arrive for a long time.  
  
We can fix this by running the postmaster's signal handlers without  
SA_RESTART.  That would be quite a scary change if the range of code  
where signals are accepted weren't so tiny, but as it is, it seems  
safe enough.  (Note that postmaster children do, and must, reset all  
the handlers before unblocking signals; so this change should not  
affect any child process.)  
  
There is talk of rewriting the postmaster to use a WaitEventSet and  
not do signal response work in signal handlers, at which point it might  
be appropriate to revert this patch.  But that's not happening before  
v11 at the earliest.  
  
Back-patch to 9.6.  The problem exists much further back, but the  
worst symptom arises only in connection with parallel query, so it  
does not seem worth taking any portability risks in older branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c
M src/include/port.h
M src/port/pqsignal.c

Get rid of extern declarations of non-existent functions.

commit   : cbc2270e3fcfae0831e4aa22f797f1dcac483d46    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 25 Apr 2017 01:31:42 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 25 Apr 2017 01:31:42 +0900    

Click here for diff

Those extern declartions were mistakenly added by commit 7c4f52409.  
  
Author: Petr Jelinek  

M src/include/replication/logical.h

Fix postmaster's handling of fork failure for a bgworker process.

commit   : 4fe04244b584749351657e99f3e6e1436e9b65a8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Apr 2017 12:16:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Apr 2017 12:16:58 -0400    

Click here for diff

This corner case didn't behave nicely at all: the postmaster would  
(partially) update its state as though the process had started  
successfully, and be quite confused thereafter.  Fix it to act  
like the worker had crashed, instead.  
  
In passing, refactor so that do_start_bgworker contains all the  
state-change logic for bgworker launch, rather than just some of it.  
  
Back-patch as far as 9.4.  9.3 contains similar logic, but it's just  
enough different that I don't feel comfortable applying the patch  
without more study; and the use of bgworkers in 9.3 was so small  
that it doesn't seem worth the extra work.  
  
transam/parallel.c is still entirely unprepared for the possibility  
of bgworker startup failure, but that seems like material for a  
separate patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c

Code review for commands/statscmds.c.

commit   : 4b34624daadd9837cd65f20419f832b295c67ecb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Apr 2017 11:15:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Apr 2017 11:15:15 -0400    

Click here for diff

Fix machine-dependent sorting of column numbers.  (Odd behavior  
would only materialize for column numbers above 255, but that's  
certainly legal.)  
  
Fix poor choice of SQLSTATE for some errors, and improve error message  
wording.  (Notably, "is not a scalar type" is a totally misleading way  
to explain "does not have a default btree opclass".)  
  
Avoid taking AccessExclusiveLock on the associated relation during DROP  
STATISTICS.  That's neither necessary nor desirable, and it could easily  
have put us into situations where DROP fails (compare commit 68ea2b7f9).  
  
Adjust/improve comments.  
  
David Rowley and Tom Lane  
  
Discussion: https://postgr.es/m/CAKJS1f-GmCfPvBbAEaM5xoVOaYdVgVN1gicALSoYQ77z-+vLbw@mail.gmail.com  

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

Don't include sys/poll.h anymore.

commit   : b182a4ae2f9a542f7bab082c460f1250ca8a0aef    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 23 Apr 2017 16:04:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 23 Apr 2017 16:04:46 -0700    

Click here for diff

poll.h is mandated by Single Unix Spec v2, the usual baseline for  
postgres on unix.  None of the unixoid buildfarms animals has  
sys/poll.h but not poll.h.  Therefore there's not much point to test  
for sys/poll.h's existence and include it optionally.  
  
Author: Andres Freund, per suggestion from Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/backend/storage/ipc/latch.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/interfaces/libpq/fe-misc.c

Zero padding in replication origin's checkpointed on disk-state.

commit   : eb97aa7e65627c602f559207a5a104cacbdd585f    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 23 Apr 2017 15:48:31 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 23 Apr 2017 15:48:31 -0700    

Click here for diff

This seems to be largely cosmetic, avoiding valgrind bleats and the  
like. The uninitialized padding influences the CRC of the on-disk  
entry, but because it's also used when verifying the CRC, that doesn't  
cause spurious failures.  Backpatch nonetheless.  
  
It's a bit unfortunate that contrib/test_decoding/sql/replorigin.sql  
doesn't exercise the checkpoint path, but checkpoints are fairly  
expensive on weaker machines, and we'd have to stop/start for that to  
be meaningful.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.5, where replication origins were introduced  

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

Initialize all memory for logical replication relation cache.

commit   : e84d243b1ce6366e8415cefc623ca53e73a20393    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 23 Apr 2017 15:36:47 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 23 Apr 2017 15:36:47 -0700    

Click here for diff

As reported by buildfarm animal skink / valgrind, some of the  
variables weren't always initialized.  To avoid further mishaps use  
memset to ensure the entire entry is initialized.  
  
Author: Petr Jelinek  
Reported-By: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: none, code new in master  

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

Remove select(2) backed latch implementation.

commit   : 61c21ddad03dda1f92a05a723cf449087d80ec08    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 23 Apr 2017 15:26:25 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 23 Apr 2017 15:26:25 -0700    

Click here for diff

poll(2) is required by Single Unix Spec v2, the usual baseline for  
postgres (leaving windows aside).  There's not been any buildfarm  
animals without poll(2) for a long while, leaving the select(2)  
implementation to be largely untested.  
  
On windows, including mingw, poll() is not available, but we have a  
special case implementation for windows anyway.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Workaround for RecoverPreparedTransactions()

commit   : 546c13e11b29a5408b9d6a6e3cca301380b47f7f    
  
author   : Simon Riggs <[email protected]>    
date     : Sun, 23 Apr 2017 22:12:01 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Sun, 23 Apr 2017 22:12:01 +0100    

Click here for diff

Force overwriteOK = true while we investigate deeper fix  
  
Proposed by Tom Lane as temporary measure, accepted by me  

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

Fix LagTrackerRead() for timeline increments

commit   : 8463880872cf8a6fc6bb9a4ad34b84aded7a33e2    
  
author   : Simon Riggs <[email protected]>    
date     : Sun, 23 Apr 2017 21:35:41 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Sun, 23 Apr 2017 21:35:41 +0100    

Click here for diff

Bug was masked by error in running 004_timeline_switch.pl that was  
fixed recently in 7d68f2281a.  
  
Detective work by Alvaro Herrera and Tom Lane  
  
Author: Thomas Munro  

M src/backend/replication/walsender.c

Fix order of arguments to SubTransSetParent().

commit   : 0874d4f3e183757ba15a4b3f3bf563e0393dd9c2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Apr 2017 13:10:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Apr 2017 13:10:57 -0400    

Click here for diff

ProcessTwoPhaseBuffer (formerly StandbyRecoverPreparedTransactions)  
mixed up the parent and child XIDs when calling SubTransSetParent to  
record the transactions' relationship in pg_subtrans.  
  
Remarkably, analysis by Simon Riggs suggests that this doesn't lead to  
visible problems (at least, not in non-Assert builds).  That might  
explain why we'd not noticed it before.  Nonetheless, it's surely wrong.  
  
This code was born broken, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix TAP infrastructure to support Mingw better

commit   : 33f3bbc6d37dde23f02cb1f73753791fb9e6c4a8    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 23 Apr 2017 09:21:38 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 23 Apr 2017 09:21:38 -0400    

Click here for diff

archive_command and restore_command need to refer to Windows paths, not  
Msys virtual file system paths, as postgres is completely unaware of the  
latter, so prefix them with the Windows path to the virtual file system  
root. Clean psql and pg_recvlogical output of carriage returns.  

M src/test/perl/PostgresNode.pm

Make PostgresNode.pm check server status more carefully.

commit   : 7d68f2281a4b56834c8e5648fc7da0b73b674c45    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Apr 2017 18:18:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Apr 2017 18:18:25 -0400    

Click here for diff

PostgresNode blithely ignored the exit status of pg_ctl, and in general  
made no effort to be sure that the server was running when it should be.  
This caused it to miss server crashes, which is a serious shortcoming  
in a test scaffold.  Make it complain if pg_ctl fails, and modify the  
start and stop logic to complain if the server doesn't start, or doesn't  
stop, when expected.  
  
Also, have it turn off the "restart_after_crash" configuration parameter  
in created clusters, as bitter experience has shown that leaving that on  
can mask crashes too.  
  
We might at some point need variant functions that allow for, eg,  
server start failure to be expected.  But no existing test case appears  
to want that, and it surely shouldn't be the default behavior.  
  
Note that this *will* break the buildfarm, as it will expose known  
bugs that the previous testing failed to.  I'm committing it despite  
that, to verify that we get the expected failures in the buildfarm  
not just in manual testing.  
  
Back-patch into 9.6 where PostgresNode was introduced.  (The 9.6  
branch is not expected to show any failures.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgresNode.pm

Make PostgresNode::append_conf append a newline automatically.

commit   : 8a19c1a3736c6b928ebc3503edaf0bd289366bcc    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Apr 2017 16:58:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Apr 2017 16:58:15 -0400    

Click here for diff

Although the documentation for append_conf said clearly that it didn't  
add a newline, many test authors seem to have forgotten that ... or maybe  
they just consulted the example at the top of the POD documentation,  
which clearly shows adding a config entry without bothering to add a  
trailing newline.  The worst part of that is that it works, as long as  
you don't do it more than once, since the backend isn't picky about  
whether config files end with newlines.  So there's not a strong forcing  
function reminding test authors not to do it like that.  Upshot is that  
this is a terribly fragile way to go about things, and there's at least  
one existing test case that is demonstrably broken and not testing what  
it thinks it is.  
  
Let's just make append_conf append a newline, instead; that is clearly  
way safer than the old definition.  
  
I also cleaned up a few call sites that were unnecessarily ugly.  
(I left things alone in places where it's plausible that additional  
config lines would need to be added someday.)  
  
Back-patch the change in append_conf itself to 9.6 where it was added,  
as having a definitional inconsistency between branches would obviously  
be pretty hazardous for back-patching TAP tests.  The other changes are  
just cosmetic and don't need to be back-patched.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/commit_ts/t/004_restart.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

Require sufficiently modern version of Test::More for TAP tests

commit   : f92562adbaa614cf185dc170417b9c2c238573b8    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 22 Apr 2017 10:04:01 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 22 Apr 2017 10:04:01 -0400    

Click here for diff

Ancient versions of Test::More don't support the note() function used in  
some TAP tests, so we require the minimum version of the module that  
does.  

M src/test/perl/TestLib.pm

Partially revert commit 536d47bd9d5fce8d91929bee3128fa1d08dbcc57.

commit   : 5041cdf2b79216b10ca90498d9a9b8fd4abf1745    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Apr 2017 02:06:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Apr 2017 02:06:16 -0400    

Click here for diff

Per buildfarm, the "#ifdef F_SETFD" removed in that commit actually  
is needed on Windows, because fcntl() isn't available at all on that  
platform, unless using Cygwin.  We could perhaps spell it more like  
"#ifdef HAVE_FCNTL", or "#ifndef WIN32", but it's not clear that  
those choices are better.  
  
It does seem that we don't need the bogus manual definition of  
FD_CLOEXEC, though, so keep that change.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Update link

commit   : f58b664393dcfd02c2f57b3ff20fc0aee6dfebf1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 21 Apr 2017 19:42:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 21 Apr 2017 19:42:01 -0400    

Click here for diff

The reference "That is the topic of the next section." has been  
incorrect since the materialized views documentation got inserted  
between the section "rules-views" and "rules-update".  
  
Author: Zertrin <[email protected]>  

M doc/src/sgml/rules.sgml

Avoid depending on non-POSIX behavior of fcntl(2).

commit   : 3e51725b3854e80b84347774516e988fce12f46d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Apr 2017 15:55:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Apr 2017 15:55:56 -0400    

Click here for diff

The POSIX standard does not say that the success return value for  
fcntl(F_SETFD) and fcntl(F_SETFL) is zero; it says only that it's not -1.  
We had several calls that were making the stronger assumption.  Adjust  
them to test specifically for -1 for strict spec compliance.  
  
The standard further leaves open the possibility that the O_NONBLOCK  
flag bit is not the only active one in F_SETFL's argument.  Formally,  
therefore, one ought to get the current flags with F_GETFL and store  
them back with only the O_NONBLOCK bit changed when trying to change  
the nonblock state.  In port/noblock.c, we were doing the full pushup  
in pg_set_block but not in pg_set_noblock, which is just weird.  Make  
both of them do it properly, since they have little business making  
any assumptions about the socket they're handed.  The other places  
where we're issuing F_SETFL are working with FDs we just got from  
pipe(2), so it's reasonable to assume the FDs' properties are all  
default, so I didn't bother adding F_GETFL steps there.  
  
Also, while pg_set_block deserves some points for trying to do things  
right, somebody had decided that it'd be even better to cast fcntl's  
third argument to "long".  Which is completely loony, because POSIX  
clearly says the third argument for an F_SETFL call is "int".  
  
Given the lack of field complaints, these missteps apparently are not  
of significance on any common platforms.  But they're still wrong,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/latch.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/port/noblock.c

Change the on-disk format of SCRAM verifiers to conform to RFC 5803.

commit   : 68e61ee72eb6914f493f08be98363c2f980ee242    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 21 Apr 2017 22:51:57 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 21 Apr 2017 22:51:57 +0300    

Click here for diff

It doesn't make any immediate difference to PostgreSQL, but might as well  
follow the standard, since one exists. (I looked at RFC 5803 earlier, but  
didn't fully understand it back then.)  
  
The new format uses Base64 instead of hex to encode StoredKey and  
ServerKey, which makes the verifiers slightly smaller. Using the same  
encoding for the salt and the keys also means that you only need one  
encoder/decoder instead of two. Although we have code in the backend to  
do both, we are talking about teaching libpq how to create SCRAM verifiers  
for PQencodePassword(), and libpq doesn't currently have any code for hex  
encoding.  
  
Bump catversion, because this renders any existing SCRAM verifiers in  
pg_authid invalid.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/libpq/auth-scram.c
M src/backend/libpq/crypt.c
M src/include/catalog/catversion.h
M src/test/regress/expected/password.out
M src/test/regress/sql/password.sql

doc: Fix typo

commit   : c29a752c683d9b08ee1376709b825532e94c2709    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 21 Apr 2017 15:33:25 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 21 Apr 2017 15:33:25 -0400    

Click here for diff

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

Remove long-obsolete catering for platforms without F_SETFD/FD_CLOEXEC.

commit   : 536d47bd9d5fce8d91929bee3128fa1d08dbcc57    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Apr 2017 14:48:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Apr 2017 14:48:29 -0400    

Click here for diff

SUSv2 mandates that <fcntl.h> provide both F_SETFD and FD_CLOEXEC,  
so it seems pretty unlikely that any platforms remain without those.  
Remove the #ifdef-ery installed by commit 7627b91cd to see if the  
buildfarm agrees.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Synchronize table list before creating slot in CREATE SUBSCRIPTION

commit   : dcb39c37c1d3b90115e1501af8efb7af59c341c3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 21 Apr 2017 08:35:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 21 Apr 2017 08:35:24 -0400    

Click here for diff

This way a failure to synchronize the table list will not leave an  
unused slot on the publisher.  
  
Author: Petr Jelinek <[email protected]>  

M src/backend/commands/subscriptioncmds.c

Add missing erand48.c to libpq/.gitignore.

commit   : 77c316be7e6950990f21ba58f78ce67db1950fa9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Apr 2017 16:31:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Apr 2017 16:31:10 -0400    

Click here for diff

Oversight in commit 818fd4a67.  While at it, sync order of file list  
in .gitignore with those in the Makefile.  

M src/interfaces/libpq/.gitignore

Improve multivariate statistics documentation

commit   : 919f6d746e45c8fe84d02799053ef47c3bb11050    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 20 Apr 2017 15:43:33 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 20 Apr 2017 15:43:33 -0300    

Click here for diff

Extended statistics commit 7b504eb282c did not include appropriate  
documentation next to where we document regular planner statistics (I  
ripped what was submitted before commit and then forgot to put it back),  
and while later commit 2686ee1b7ccf added some material, it structurally  
depended on what I had ripped out, so the end result wasn't proper.  
  
Fix those problems by shuffling what was added by 2686ee1b7ccf and  
including some additional material, so that now chapter 14 "Performance  
Tips" now describes the types of multivariate statistics we currently  
have, and chapter 68 "How the Planner Uses Statistics" shows some  
examples.  The new text should be more in line with previous material,  
in (hopefully) the appropriate depth.  
  
While at it, fix a small bug in pg_statistic_ext docs: one column was  
listed in the wrong spot.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/planstats.sgml

Sync pg_ctl documentation and usage message with reality.

commit   : 8bcb31ad5a7b3f4a0a6e4fbd8cbc1a7a8dde423d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Apr 2017 14:41:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Apr 2017 14:41:48 -0400    

Click here for diff

Commit 05cd12ed5 ("pg_ctl: Change default to wait for all actions")  
was a tad sloppy about updating the documentation to match.  The  
documentation was also sorely in need of a copy-editing pass, having  
been adjusted at different times by different people who took little  
care to maintain consistency of style.  

M doc/src/sgml/ref/pg_ctl-ref.sgml
M src/bin/pg_ctl/pg_ctl.c

Modify message when partitioned table is added to publication

commit   : 594b526bcf32e307b963ea77f10c9720d9ca423f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 20 Apr 2017 14:18:33 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 20 Apr 2017 14:18:33 -0400    

Click here for diff

Give a more specific error message than "xyz is not a table".  
  
Also document in CREATE PUBLICATION which kinds of relations are not  
supported.  
  
based on patch by Amit Langote <[email protected]>  

M doc/src/sgml/ref/create_publication.sgml
M src/backend/catalog/pg_publication.c
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Prevent log_replication_commands from causing SQL commands to be logged.

commit   : 3a66581dd12b4108ce22fb4dad38258df39cb685    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 21 Apr 2017 00:56:27 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 21 Apr 2017 00:56:27 +0900    

Click here for diff

Commit 7c4f524 allowed walsender to execute normal SQL commands  
to support table sync feature in logical replication. Previously  
while log_statement caused such SQL commands to be logged,  
log_replication_commands caused them to be logged, too.  
That is, such SQL commands were logged twice unexpectedly  
when those settings were both enabled.  
  
This commit forces log_replication_commands to log only replication  
commands, to prevent normal SQL commands from being logged twice.  
  
Author: Masahiko Sawada  
Reviewed-by: Kyotaro Horiguchi  
Reported-by: Fujii Masao  
Discussion: http://postgr.es/m/CAHGQGwFDWh_Qr-q_GEMpD+qH=vYPMdVqw=ZOSY3kX_Pna9R9SA@mail.gmail.com  

M src/backend/replication/walsender.c

Mark some columns in pg_subscription as NOT NULL.

commit   : 88b0a31926331eb5336ec92010b3b4f7e6efb53c    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 20 Apr 2017 23:35:30 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 20 Apr 2017 23:35:30 +0900    

Click here for diff

In pg_subscription, subconninfo, subslotname, subsynccommit and  
subpublications are expected not to be NULL. Therefore this patch  
adds BKI_FORCE_NOT_NULL markings to them.  
  
This patch is basically unnecessary unless the code has a bug which  
wrongly sets either of those columns to NULL. But it's good to have  
this as a safeguard.  
  
Author: Masahiko Sawada  
Reviewed-by: Kyotaro Horiguchi  
Reported-by: Fujii Masao  
Discussion: http://postgr.es/m/CAHGQGwFDWh_Qr-q_GEMpD+qH=vYPMdVqw=ZOSY3kX_Pna9R9SA@mail.gmail.com  

M src/include/catalog/pg_subscription.h

Don't call the function that may raise an error while holding spinlock.

commit   : 8bbc618b4825b13a9776f2289acd06483e140300    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 20 Apr 2017 23:12:57 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 20 Apr 2017 23:12:57 +0900    

Click here for diff

It's not safe to raise an error while holding spinlock. But previously  
logical replication worker for table sync called the function which  
reads the system catalog and may raise an error while it's holding  
spinlock. Which could lead to the trouble where spinlock will never  
be released and the server gets stuck infinitely.  
  
Author: Petr Jelinek  
Reviewed-by: Kyotaro Horiguchi and Fujii Masao  
Reported-by: Fujii Masao  
Discussion: http://postgr.es/m/CAHGQGwFDWh_Qr-q_GEMpD+qH=vYPMdVqw=ZOSY3kX_Pna9R9SA@mail.gmail.com  

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

Fix typo in docs on SASL authentication.

commit   : e68432a0e1ad07b6848fc9bbc11e382eb43b8618    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 19 Apr 2017 21:42:27 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 19 Apr 2017 21:42:27 +0300    

Click here for diff

Word "sends" was missing.  
  
Jaime Casanova  

M doc/src/sgml/protocol.sgml

Fix testing of parallel-safety of SubPlans.

commit   : 39151781c8cd2c8bf6057496426fb9c07178eda5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Apr 2017 15:43:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Apr 2017 15:43:56 -0400    

Click here for diff

is_parallel_safe() supposed that the only relevant property of a SubPlan  
was the parallel safety of the referenced subplan tree.  This is wrong:  
the testexpr or args subtrees might contain parallel-unsafe stuff, as  
demonstrated by the test case added here.  However, just recursing into the  
subtrees fails in a different way: we'll typically find PARAM_EXEC Params  
representing the subplan's output columns in the testexpr.  The previous  
coding supposed that any Param must be treated as parallel-restricted, so  
that a naive attempt at fixing this disabled parallel pushdown of SubPlans  
altogether.  We must instead determine, for any visited Param, whether it  
is one that would be computed by a surrounding SubPlan node; if so, it's  
safe to push down along with the SubPlan node.  
  
We might later be able to extend this logic to cope with Params used for  
correlated subplans and other cases; but that's a task for v11 or beyond.  
  
Tom Lane and Amit Kapila  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/clauses.c
M src/include/nodes/primnodes.h
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Doc: improve markup in self-signed certificate example.

commit   : 539f67012ec978e931054e413a4ab3c4c68bb737    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Apr 2017 14:21:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Apr 2017 14:21:57 -0400    

Click here for diff

M doc/src/sgml/runtime.sgml

Improve documentation and comment for quorum-based sync replication.

commit   : a790ed9f69ef584c12aec68d0d80e6b6b543bacb    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 19 Apr 2017 02:58:28 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 19 Apr 2017 02:58:28 +0900    

Click here for diff

Author: Masahiko Sawada, heavily modified by me  
Discussion: http://postgr.es/m/CAHGQGwEKOw=SmPLxJzkBsH6wwDBgOnVz46QjHbtsiZ-d-2RGUg@mail.gmail.com  

M doc/src/sgml/high-availability.sgml
M src/backend/replication/syncrep.c

Provide an error cursor for "can't call an SRF here" errors.

commit   : e240a65c7dfc5ad80ab757ecb1aa9b9032c7f8ae    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Apr 2017 13:20:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Apr 2017 13:20:59 -0400    

Click here for diff

Since it appears that v10 is going to move the goalposts by some amount  
in terms of where you can and can't invoke set-returning functions,  
arrange for the executor's "set-valued function called in context that  
cannot accept a set" errors to include a syntax position if possible,  
pointing to the specific SRF that can't be called where it's located.  
  
The main bit of infrastructure needed for this is to make the query source  
text accessible in the executor; but it turns out that commit 4c728f382  
already did that.  We just need a new function executor_errposition()  
modeled on parser_errposition(), and we're ready to rock.  
  
While experimenting with this, I noted that the error position wasn't  
properly reported if it occurred in a plpgsql FOR-over-query loop,  
which turned out to be because SPI_cursor_open_internal wasn't providing  
an error context callback during PortalStart.  Fix that.  
  
There's a whole lot more that could be done with this infrastructure  
now that it's there, but this is not the right time in the development  
cycle for that sort of work.  Hence, resist the temptation to plaster  
executor_errposition() calls everywhere ... for the moment.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/executor/execSRF.c
M src/backend/executor/execUtils.c
M src/backend/executor/spi.c
M src/include/executor/executor.h
M src/test/regress/expected/tsrf.out

A collection of small fixes for logical replication.

commit   : 280c53ecfbcad442c4b5eaab4cc3e65408f486eb    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 19 Apr 2017 02:16:34 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 19 Apr 2017 02:16:34 +0900    

Click here for diff

* Be sure to reset the launcher's pid (LogicalRepCtx->launcher_pid) to 0  
  even when the launcher emits an error.  
  
* Declare ApplyLauncherWakeup() as a static function because it's called  
  only in launcher.c.  
  
* Previously IsBackendPId() was used to check whether the launcher's pid  
  was valid. IsBackendPid() was necessary because there was the bug where  
  the launcher's pid was not reset to 0. But now it's fixed, so IsBackendPid()  
  is not necessary and this patch removes it.  
  
Author: Masahiko Sawada  
Reviewed-by: Kyotaro Horiguchi  
Reported-by: Fujii Masao  
Discussion: http://postgr.es/m/CAHGQGwFDWh_Qr-q_GEMpD+qH=vYPMdVqw=ZOSY3kX_Pna9R9SA@mail.gmail.com  

M src/backend/replication/logical/launcher.c
M src/include/replication/logicallauncher.h

Use DatumGetInt32() to extract 32-bit integer value from a datum.

commit   : 39a6772d04940b994acd9a3fd954cacdc2f88b26    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 19 Apr 2017 00:12:27 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 19 Apr 2017 00:12:27 +0900    

Click here for diff

Previously DatumGetObjectId() was wrongly used for that.  
  
Author: Masahiko Sawada  
Reviewed-by: Kyotaro Horiguchi  
Reported-by: Fujii Masao  
Discussion: http://postgr.es/m/CAHGQGwFDWh_Qr-q_GEMpD+qH=vYPMdVqw=ZOSY3kX_Pna9R9SA@mail.gmail.com  

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

Also fix comment in sample postgresql.conf file, for "scram-sha-256".

commit   : b977780a9b2c546f8e2bf19fa3232b3e3d334916    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 18 Apr 2017 17:38:32 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 18 Apr 2017 17:38:32 +0300    

Click here for diff

Reported offlist by hubert depesz lubaczewski.  

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

Simplify docs on creating a self-signed SSL certificate

commit   : 2b67c9d207d428c2476af0dd39043d83469d70c2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 18 Apr 2017 08:50:15 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 18 Apr 2017 08:50:15 -0400    

Click here for diff

Discussion: <https://postgr.es/m/[email protected]>  

M doc/src/sgml/runtime.sgml

Rename "scram" to "scram-sha-256" in pg_hba.conf and password_encryption.

commit   : c727f120ff50f624a1ee3abe700d995c18314a0b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 18 Apr 2017 14:50:50 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 18 Apr 2017 14:50:50 +0300    

Click here for diff

Per discussion, plain "scram" is confusing because we actually implement  
SCRAM-SHA-256 rather than the original SCRAM that uses SHA-1 as the hash  
algorithm. If we add support for SCRAM-SHA-512 or some other mechanism in  
the SCRAM family in the future, that would become even more confusing.  
  
Most of the internal files and functions still use just "scram" as a  
shorthand for SCRMA-SHA-256, but I did change PASSWORD_TYPE_SCRAM to  
PASSWORD_TYPE_SCRAM_SHA_256, as that could potentially be used by 3rd  
party extensions that hook into the password-check hook.  
  
Michael Paquier did this in an earlier version of the SCRAM patch set  
already, but I didn't include that in the version that was committed.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/client-auth.sgml
M doc/src/sgml/config.sgml
M src/backend/commands/user.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/backend/libpq/pg_hba.conf.sample
M src/backend/utils/misc/guc.c
M src/bin/initdb/initdb.c
M src/include/libpq/crypt.h
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/regress/expected/password.out
M src/test/regress/sql/password.sql

Fix minor typo in comment

commit   : 123aaffb5b881f3dadaac676877a90b50233a847    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 18 Apr 2017 11:57:11 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 18 Apr 2017 11:57:11 +0100    

Click here for diff

Reported-by: Amit Langote  

M src/backend/catalog/partition.c

Exit correctly from PrepareRedoRemove() when not found

commit   : ee01f7092fb6430ad9bb9bb1f42f19d22bcb9329    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 18 Apr 2017 11:35:38 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 18 Apr 2017 11:35:38 +0100    

Click here for diff

Complex crash bug all started with this failure.  
Diagnosed and fixed by Nikhil Sontakke, reviewed by me.  
  
Reported-by: Jeff Janes  
Author: Nikhil Sontakke  
Discussion: https://postgr.es/m/CAMkU=1xBP8cqdS5eK8APHL=X6RHMMM2vG5g+QamduuTsyCwv9g@mail.gmail.com  

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

Donā€™t push nextid too far forwards in recovery

commit   : aa203e76004daaee3d70b19cc727ed17b87b3d3a    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 18 Apr 2017 11:14:05 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 18 Apr 2017 11:14:05 +0100    

Click here for diff

Doing so allows various crash possibilities. Fix by avoiding  
having PrescanPreparedTransactions() increment  
ShmemVariableCache->nextXid when it has no 2PC files  
  
Bug found by Jeff Janes, diagnosis and patch by Pavan Deolasee,  
then patch re-designed for clarity and full accuracy by  
Michael Paquier.  
  
Reported-by: Jeff Janes  
Author: Pavan Deolasee, Michael Paquier  
Discussion: https://postgr.es/m/CAMkU=1zMLnH_i1-PVQ-biZzvNx7VcuatriquEnh7HNk6K8Ss3Q@mail.gmail.com  

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

Allow COMMENT ON COLUMN with partitioned tables

commit   : 51175f3638524231405e674e40bde159b0b76727    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 18 Apr 2017 10:42:10 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 18 Apr 2017 10:42:10 +0100    

Click here for diff

Amit Langote  

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

Fix example on creating a trigger with a transition table.

commit   : b2188575c59462c0fd23b63c92fb802206162e49    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 18 Apr 2017 11:51:06 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 18 Apr 2017 11:51:06 +0300    

Click here for diff

Yugo Nagata  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

doc: Clarify logical replication details

commit   : 8efd1e08f063892be13de085e5e2c0e802fadf55    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Apr 2017 23:32:54 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Apr 2017 23:32:54 -0400    

Click here for diff

Document more explicitly that the target table can have more columns  
than the source table.  
  
Reported-by: Euler Taveira <[email protected]>  

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

Set range table for CopyFrom() in tablesync

commit   : e6242c18a5bb08788e6c4cc773952fc8e2a6291a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Apr 2017 23:22:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Apr 2017 23:22:04 -0400    

Click here for diff

CopyFrom() needs a range table for formatting certain errors for  
constraint violations.  
  
This changes the mechanism of how the range table is passed to the  
CopyFrom() executor state.  We used to generate the range table and one  
entry for the relation manually inside DoCopy().  Now we use  
addRangeTableEntryForRelation() to setup the range table and relation  
entry for the ParseState, which is then passed down by BeginCopyFrom().  
  
Author: Petr Jelinek <[email protected]>  
Reported-by: Euler Taveira <[email protected]>  

M src/backend/commands/copy.c
M src/backend/replication/logical/tablesync.c

Rename columns in new pg_statistic_ext catalog

commit   : ee6922112e9b3c02b995bd1d838c9a261f060133    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 17 Apr 2017 18:34:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 17 Apr 2017 18:34:29 -0300    

Click here for diff

The new catalog reused a column prefix "sta" from pg_statistic, but this  
is undesirable, so change the catalog to use prefix "stx" instead.  
Also, rename the column that lists enabled statistic kinds as "stxkind"  
rather than "enabled".  
  
Discussion: https://postgr.es/m/CAKJS1f_2t5jhSN7huYRFH3w3rrHfG2QU7hiUHsu-Vdjd1rYT3w@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/planstats.sgml
M src/backend/catalog/aclchk.c
M src/backend/catalog/heap.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/statscmds.c
M src/backend/optimizer/util/plancat.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mvdistinct.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/syscache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_statistic_ext.h
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/alter_generic.sql
M src/test/regress/sql/stats_ext.sql

Tighten up relation kind checks for extended statistics

commit   : 8c5cdb7f4f6e1d6a6104cb58ce4f23453891651b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 17 Apr 2017 17:55:17 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 17 Apr 2017 17:55:17 -0300    

Click here for diff

We were accepting creation of extended statistics only for regular  
tables, but they can usefully be created for foreign tables, partitioned  
tables, and materialized views, too.  Allow those cases.  
  
While at it, make sure all the rejected cases throw a consistent error  
message, and add regression tests for the whole thing.  
  
Author: David Rowley, Ɓlvaro Herrera  
Discussion: https://postgr.es/m/CAKJS1f-BmGo410bh5RSPZUvOO0LhmHL2NYmdrC_Jm8pk_FfyCA@mail.gmail.com  

M doc/src/sgml/ref/create_statistics.sgml
M src/backend/commands/statscmds.c
M src/bin/pg_dump/pg_dump.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Always build a custom plan node's targetlist from the path's pathtarget.

commit   : 76799fc89d2ca6f357c188daa4e1b38f0a59e360    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Apr 2017 15:29:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Apr 2017 15:29:00 -0400    

Click here for diff

We were applying the use_physical_tlist optimization to all relation  
scan plans, even those implemented by custom scan providers.  However,  
that's a bad idea for a couple of reasons.  The custom provider might  
be unable to provide columns that it hadn't expected to be asked for  
(for example, the custom scan might depend on an index-only scan).  
Even more to the point, there's no good reason to suppose that this  
"optimization" is a win for a custom scan; whatever the custom provider  
is doing is likely not based on simply returning physical heap tuples.  
(As a counterexample, if the custom scan is an interface to a column store,  
demanding all columns would be a huge loss.)  If it is a win, the custom  
provider could make that decision for itself and insert a suitable  
pathtarget into the path, anyway.  
  
Per discussion with Dmitry Ivanov.  Back-patch to 9.5 where custom scan  
support was introduced.  The argument that the custom provider can adjust  
the behavior by changing the pathtarget only applies to 9.6+, but on  
balance it seems more likely that use_physical_tlist will hurt custom  
scans than help them.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typos in comment and log message.

commit   : 9e0e5550c5f273dc4133687b1a682eb39933f47e    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 18 Apr 2017 03:19:39 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 18 Apr 2017 03:19:39 +0900    

Click here for diff

M src/backend/catalog/aclchk.c
M src/backend/commands/subscriptioncmds.c
M src/test/regress/expected/subscription.out

Fix new warnings from GCC 7

commit   : 6275f5d28a1577563f53f2171689d4f890a46881    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 11 Apr 2017 14:13:31 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 11 Apr 2017 14:13:31 -0400    

Click here for diff

This addresses the new warning types -Wformat-truncation  
-Wformat-overflow that are part of -Wall, via -Wformat, in GCC 7.  

M contrib/pg_standby/pg_standby.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/xlog.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.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/ipc/dsm.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/error/elog.c
M src/backend/utils/time/snapmgr.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/copy_fetch.c
M src/common/file_utils.c
M src/timezone/pgtz.c

Fix perlcritic warnings

commit   : 0e8286d354520cd8b8ac5e7a963130769f731476    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Apr 2017 13:49:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Apr 2017 13:49:04 -0400    

Click here for diff

M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_norm_table.pl

Fix extended statistics with partial analyzes

commit   : bf2a691e02d7766f185d9d8e0f092222a5c0a129    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 17 Apr 2017 14:00:47 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 17 Apr 2017 14:00:47 -0300    

Click here for diff

Either because of a previous ALTER TABLE .. SET STATISTICS 0 or because  
of being invoked with a partial column list, ANALYZE could fail to  
acquire sufficient data to build extended statistics.  Previously, this  
would draw an ERROR and fail to collect any statistics at all (extended  
and regular).  Change things so that we raise a WARNING instead, and  
remove a hint that was wrong in half the cases.  
  
Reported by: David Rowley  
Discussion: https://postgr.es/m/CAKJS1f9Kk0NF6Fg7TA=JUXsjpS9kX6NVu27pb5QDCpOYAvb-Og@mail.gmail.com  

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

pg_dump: Emit ONLY before table added to publication

commit   : 419a23b478ae760b797188341ddce5b41322684b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Apr 2017 09:47:39 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Apr 2017 09:47:39 -0400    

Click here for diff

This is necessary to be able to reproduce publication membership  
correctly if tables are involved in inheritance.  
  
Author: Amit Langote <[email protected]>  

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

Document that ONLY can be specified in publication commands

commit   : 1fe33252a08c285de9e84615cfde0569b9a75e58    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Apr 2017 09:14:22 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Apr 2017 09:14:22 -0400    

Click here for diff

Author: Amit Langote <[email protected]>  

M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Ensure BackgroundWorker struct contents are well-defined.

commit   : b6dd1271281ce856ab774fc0b491a92878e3b501    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Apr 2017 23:23:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Apr 2017 23:23:44 -0400    

Click here for diff

Coverity complained because bgw.bgw_extra wasn't being filled in by  
ApplyLauncherRegister().  The most future-proof fix is to memset the  
whole BackgroundWorker struct to zeroes.  While at it, let's apply the  
same coding rule to other places that set up BackgroundWorker structs;  
four out of five had the same or related issues.  

M src/backend/access/transam/parallel.c
M src/backend/replication/logical/launcher.c
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/worker_spi/worker_spi.c

Fix typo in comment

commit   : c7d225e227aa481c30532b2954055afd1705af31    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 16 Apr 2017 19:47:37 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 16 Apr 2017 19:47:37 -0400    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

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

Sync addRangeTableEntryForENR() with its peer functions.

commit   : a1888b59b511b42290a6fcfa87e35323d128c4f6    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Apr 2017 14:02:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Apr 2017 14:02:47 -0400    

Click here for diff

addRangeTableEntryForENR had a check for pstate != NULL, which Coverity  
pointed out was rather useless since it'd already dereferenced pstate  
before that.  More to the point, we'd established policy in commit  
bc93ac12c that we'd require non-NULL pstate for all addRangeTableEntryFor*  
functions; this test was evidently copied-and-pasted from some older  
version of one of those functions.  Make it look more like the others.  
  
In passing, make an elog message look more like the rest of the code,  
too.  
  
Michael Paquier  

M src/backend/parser/parse_relation.c

Make sure to run one initdb TAP test with no TZ set

commit   : 033b969edde62c84ee15b53972ee638150a28c90    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 15 Apr 2017 18:43:13 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 15 Apr 2017 18:43:13 -0400    

Click here for diff

That way we make sure that initdb's time zone setting code is exercised.  
This doesn't add an extra test, it just alters an existing test.  
  
Discussion: <https://postgr.es/m/[email protected]>  

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

Provide a way to control SysV shmem attach address in EXEC_BACKEND builds.

commit   : a74740fbd3bb89cd626f6e98417847f696e60bd8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Apr 2017 17:27:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Apr 2017 17:27:38 -0400    

Click here for diff

In standard non-Windows builds, there's no particular reason to care what  
address the kernel chooses to map the shared memory segment at.  However,  
when building with EXEC_BACKEND, there's a risk that the chosen address  
won't be available in all child processes.  Linux with ASLR enabled (which  
it is by default) seems particularly at risk because it puts shmem segments  
into the same area where it maps shared libraries.  We can work around  
that by specifying a mapping address that's outside the range where  
shared libraries could get mapped.  On x86_64 Linux, 0x7e0000000000  
seems to work well.  
  
This is only meant for testing/debugging purposes, so it doesn't seem  
necessary to go as far as providing a GUC (or any user-visible  
documentation, though we might change that later).  Instead, it's just  
controlled by setting an environment variable PG_SHMEM_ADDR to the  
desired attach address.  
  
Back-patch to all supported branches, since the point here is to  
remove intermittent buildfarm failures on EXEC_BACKEND animals.  
Owners of affected animals will need to add a suitable setting of  
PG_SHMEM_ADDR to their build_env configuration.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/sysv_shmem.c

Fix erroneous cross-reference in comment.

commit   : bfba563bc5d80263637a3cfba6a572c20949defe    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Apr 2017 14:22:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Apr 2017 14:22:26 -0400    

Click here for diff

Seems to have been introduced in commit c219d9b0a.  I think there indeed  
was a "tupbasics.h" in some early drafts of that refactoring, but it  
didn't survive into the committed version.  
  
Amit Kapila  

M src/include/access/htup_details.h

More cleanup of manipulations of hash indexes' hasho_flag field.

commit   : 083dc95a14c05bdaeec3015508ca1d16fc7483b5    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Apr 2017 14:11:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Apr 2017 14:11:15 -0400    

Click here for diff

Not much point in defining test macros for the flag bits if we  
don't use 'em.  
  
Amit Kapila  

M src/backend/access/hash/hash.c

Downcase "Wincrypt.h"

commit   : 0eba6be1b8d37fa368a45795ba350d46cc86df54    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 15 Apr 2017 09:47:36 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 15 Apr 2017 09:47:36 -0400    

Click here for diff

This is consistent with how we refer to other Windows include files, and  
prevents a failure when cross-compiling on a system with case sensitive  
file names.  

M src/port/pg_strong_random.c

Avoid passing function pointers across process boundaries.

commit   : 32470825d36d99a81347ee36c181d609c952c061    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Apr 2017 23:50:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Apr 2017 23:50:16 -0400    

Click here for diff

We'd already recognized that we can't pass function pointers across process  
boundaries for functions in loadable modules, since a shared library could  
get loaded at different addresses in different processes.  But actually the  
practice doesn't work for functions in the core backend either, if we're  
using EXEC_BACKEND.  This is the cause of recent failures on buildfarm  
member culicidae.  Switch to passing a string function name in all cases.  
  
Something like this needs to be back-patched into 9.6, but let's see  
if the buildfarm likes it first.  
  
Petr Jelinek, with a bunch of basically-cosmetic adjustments by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/README.parallel
M src/backend/access/transam/parallel.c
M src/backend/executor/execParallel.c
M src/backend/postmaster/bgworker.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/include/access/parallel.h
M src/include/executor/execParallel.h
M src/include/fmgr.h

doc: Fix typo

commit   : 5a617ab3e691aec56725960e6d28c98c8af6ddaa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2017 19:36:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2017 19:36:34 -0400    

Click here for diff

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

Use one transaction while reading postgres.bki, not one per line.

commit   : 85a0781334a204c15c9c6ea9d3e6c75334c2beb6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Apr 2017 17:51:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Apr 2017 17:51:25 -0400    

Click here for diff

AFAICT, the only actual benefit of closing a bootstrap transaction  
is to reclaim transient memory.  We can do that a lot more cheaply  
by just doing a MemoryContextReset on a suitable context.  This  
gets the runtime of the "bootstrap" phase of initdb down to the  
point where, at least by eyeball, it's quite negligible compared  
to the rest of the phases.  Per discussion with Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootstrap.c

Clean up manipulations of hash indexes' hasho_flag field.

commit   : 2040bb4a0b50ef0434a1a723f00d040ab4f1c06f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Apr 2017 17:04:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Apr 2017 17:04:25 -0400    

Click here for diff

Standardize on testing a hash index page's type by doing  
	(opaque->hasho_flag & LH_PAGE_TYPE) == LH_xxx_PAGE  
Various places were taking shortcuts like  
	opaque->hasho_flag & LH_BUCKET_PAGE  
which while not actually wrong, is still bad practice because  
it encourages use of  
	opaque->hasho_flag & LH_UNUSED_PAGE  
which *is* wrong (LH_UNUSED_PAGE == 0, so the above is constant false).  
hash_xlog.c's hash_mask() contained such an incorrect test.  
  
This also ensures that we mask out the additional flag bits that  
hasho_flag has accreted since 9.6.  pgstattuple's pgstat_hash_page(),  
for one, was failing to do that and was thus actively broken.  
  
Also fix assorted comments that hadn't been updated to reflect the  
extended usage of hasho_flag, and fix some macros that were testing  
just "(hasho_flag & bit)" to use the less dangerous, project-approved  
form "((hasho_flag & bit) != 0)".  
  
Coverity found the bug in hash_mask(); I noted the one in  
pgstat_hash_page() through code reading.  

M contrib/pageinspect/hashfuncs.c
M contrib/pgstattuple/pgstattuple.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashutil.c
M src/include/access/hash.h

Further fix pg_trgm's extraction of trigrams from regular expressions.

commit   : 1dffabed49054a81b6005a363ab2da4aee0aab9e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Apr 2017 14:52:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Apr 2017 14:52:03 -0400    

Click here for diff

Commit 9e43e8714 turns out to have been insufficient: not only is it  
necessary to track tentative parent links while considering a set of  
arc removals, but it's necessary to track tentative flag additions  
as well.  This is because we always merge arc target states into  
arc source states; therefore, when considering a merge of the final  
state with some other, it is the other state that will acquire a new  
TSTATE_FIN bit.  If there's another arc for the same color trigram  
that would cause merging of that state with the initial state, we  
failed to recognize the problem.  The test cases for the prior commit  
evidently only exercised situations where a tentative merge with the  
initial state occurs before one with the final state.  If it goes the  
other way around, we'll happily merge the initial and final states,  
either producing a broken final graph that would never match anything,  
or triggering the Assert added by the prior commit.  
  
It's tempting to consider switching the merge direction when the merge  
involves the final state, but I lack the time to analyze that idea in  
detail.  Instead just keep track of the flag changes that would result  
from proposed merges, in the same way that the prior commit tracked  
proposed parent links.  
  
Along the way, add some more debugging support, because I'm not entirely  
confident that this is the last bug here.  And tweak matters so that  
the transformed.dot file uses small integers rather than pointer values  
to identify states; that makes it more readable if you're just eyeballing  
it rather than fooling with Graphviz.  And rename a couple of identically  
named struct fields to reduce confusion.  
  
Per report from Corey Csuhta.  Add a test case based on his example.  
(Note: this case does not trigger the bug under 9.3, apparently because  
its different measurement of costs causes it to stop merging states before  
it hits the failure.  I spent some time trying to find a variant that would  
fail in 9.3, without success; but I'm sure such cases exist.)  
  
Like the previous patch, back-patch to 9.3 where this code was added.  
  
Report: https://postgr.es/m/[email protected]  

M contrib/pg_trgm/expected/pg_trgm.out
M contrib/pg_trgm/sql/pg_trgm.sql
M contrib/pg_trgm/trgm_regexp.c

Report statistics in logical replication workers

commit   : 139eb9673cb84c76f493af7e68301ae204199746    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2017 14:35:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2017 14:35:05 -0400    

Click here for diff

Author: Stas Kelvich <[email protected]>  
Author: Petr Jelinek <[email protected]>  
Reported-by: Fujii Masao <[email protected]>  

M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c

Catversion bump

commit   : 67c2def11d49de05aacd959ecdffc6736f52efee    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2017 14:24:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2017 14:24:01 -0400    

Click here for diff

for commit 887227a1cc861d87ca0f175cf8bd1447554090eb  

M src/include/catalog/catversion.h

Fix typo in comment

commit   : 6e5f9a6dc0a9e417544692db56d2c80a64dd83c7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2017 14:07:44 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2017 14:07:44 -0400    

Click here for diff

M doc/src/sgml/ref/drop_foreign_table.sgml

Add option to modify sync commit per subscription

commit   : 887227a1cc861d87ca0f175cf8bd1447554090eb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2017 13:58:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2017 13:58:46 -0400    

Click here for diff

This also changes default behaviour of subscription workers to  
synchronous_commit = off.  
  
Author: Petr Jelinek <[email protected]>  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/worker.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/pg_subscription.h
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql

Remove pstrdup of TextDatumGetCString

commit   : 25371a72b95aab43b0a3547ead4d3286c1128351    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2017 12:54:09 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2017 12:54:09 -0400    

Click here for diff

The result of TextDatumGetCString is already palloc'ed.  

M src/backend/catalog/pg_subscription.c
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/tablesync.c

Remove useless trailing spaces in queries in C strings

commit   : 0c22327f269eb3bec25327b0e620bdca082e4628    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2017 23:47:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2017 23:47:46 -0400    

Click here for diff

Author: Alexander Law <[email protected]>  

M contrib/oid2name/oid2name.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/psql/describe.c

Remove trailing spaces in some output

commit   : 674677c705f11464857e6dfd0a0d6104656d9c4a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2017 23:15:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2017 23:15:52 -0400    

Click here for diff

Author: Alexander Law <[email protected]>  

M src/backend/executor/nodeMergejoin.c
M src/bin/pg_waldump/pg_waldump.c
M src/interfaces/libpq/fe-connect.c

pg_dump: Dump comments and security labels for publication and subscriptions

commit   : cf615fbaa9893af42ba0f58a02dd52107bde0048    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2017 22:32:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2017 22:32:03 -0400    

Click here for diff

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

Make header self-contained

commit   : d04eac1148a491177cf107fbedc678bcc68b4e31    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2017 21:47:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2017 21:47:24 -0400    

Click here for diff

Add necessary include files for things used in the header.  (signal.h  
needed for sig_atomic_t.)  

M src/include/replication/worker_internal.h

pg_dumpall: Allow --no-role-passwords and --binary-upgrade together

commit   : ff46f2a0534560367ba748ac9d859a2cf05ce3fc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2017 21:23:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2017 21:23:34 -0400    

Click here for diff

This was introduced as part of the patch to add --no-role-passwords, but  
while it's an unusual combination, there is no actual reason to prevent  
it.  

M src/bin/pg_dump/pg_dumpall.c

Fix regexport.c to behave sanely with lookaround constraints.

commit   : 6cfaffc0ddc73dab6857c094f98b28761898cc6d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Apr 2017 17:18:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Apr 2017 17:18:35 -0400    

Click here for diff

regexport.c thought it could just ignore LACON arcs, but the correct  
behavior is to treat them as satisfiable while consuming zero input  
(rather reminiscently of commit 9f1e642d5).  Otherwise, the emitted  
simplified-NFA representation may contain no paths leading from initial  
to final state, which unsurprisingly confuses pg_trgm, as seen in  
bug #14623 from Jeff Janes.  
  
Since regexport's output representation has no concept of an arc that  
consumes zero input, recurse internally to find the next normal arc(s)  
after any LACON transitions.  We'd be forced into changing that  
representation if a LACON could be the last arc reaching the final  
state, but fortunately the regex library never builds NFAs with such  
a configuration, so there always is a next normal arc.  
  
Back-patch to 9.3 where this logic was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_trgm/expected/pg_trgm.out
M contrib/pg_trgm/sql/pg_trgm.sql
M src/backend/regex/regexport.c

doc: add missing sect1 close tag

commit   : 885fea5a34b036983379688d707b2a20735ebe4a    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 13 Apr 2017 13:12:58 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 13 Apr 2017 13:12:58 -0400    

Click here for diff

Fixes commit 4f3b87ab780b95c2cc8a591259baefaff4852037  

M doc/src/sgml/protocol.sgml

Improve the SASL authentication protocol.

commit   : 4f3b87ab780b95c2cc8a591259baefaff4852037    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Apr 2017 19:34:16 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Apr 2017 19:34:16 +0300    

Click here for diff

This contains some protocol changes to SASL authentiation (which is new  
in v10):  
  
* For future-proofing, in the AuthenticationSASL message that begins SASL  
  authentication, provide a list of SASL mechanisms that the server  
  supports, for the client to choose from. Currently, it's always just  
  SCRAM-SHA-256.  
  
* Add a separate authentication message type for the final server->client  
  SASL message, which the client doesn't need to respond to. This makes  
  it unambiguous whether the client is supposed to send a response or not.  
  The SASL mechanism should know that anyway, but better to be explicit.  
  
Also, in the server, support clients that don't send an Initial Client  
response in the first SASLInitialResponse message. The server is supposed  
to first send an empty request in that case, to which the client will  
respond with the data that usually comes in the Initial Client Response.  
libpq uses the Initial Client Response field and doesn't need this, and I  
would assume any other sensible implementation to use Initial Client  
Response, too, but let's follow the SASL spec.  
  
Improve the documentation on SASL authentication in protocol. Add a  
section describing the SASL message flow, and some details on our  
SCRAM-SHA-256 implementation.  
  
Document the different kinds of PasswordMessages that the frontend sends  
in different phases of SASL authentication, as well as GSS/SSPI  
authentication as separate message formats. Even though they're all 'p'  
messages, and the exact format depends on the context, describing them as  
separate message formats makes the documentation more clear.  
  
Reviewed by Michael Paquier and Ɓlvaro HernƔndez Tortosa.  
  
Discussion: https://www.postgresql.org/message-id/CAB7nPqS-aFg0iM3AQOJwKDv_0WkAedRjs1W2X8EixSz+sKBXCQ@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/include/libpq/pqcomm.h
M src/interfaces/libpq/fe-auth.c

Refactor libpq authentication request processing.

commit   : 61bf96cab06390fec66405d3caad789f4417f25a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Apr 2017 19:34:14 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Apr 2017 19:34:14 +0300    

Click here for diff

Move the responsibility of reading the data from the authentication request  
message from PQconnectPoll() to pg_fe_sendauth(). This way, PQconnectPoll()  
doesn't need to know about all the different authentication request types,  
and we don't need the extra fields in the pg_conn struct to pass the data  
from PQconnectPoll() to pg_fe_sendauth() anymore.  
  
Reviewed by Michael Paquier.  
  
Discussion: https://www.postgresql.org/message-id/6490b975-5ee1-6280-ac1d-af975b19fb9a%40iki.fi  

M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h

Move bootstrap-time lookup of regproc OIDs into genbki.pl.

commit   : 5e39f06cfe65acbecedf42a660f577c3fca47bcc    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Apr 2017 12:07:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Apr 2017 12:07:47 -0400    

Click here for diff

Formerly, the bootstrap backend looked up the OIDs corresponding to  
names in regproc catalog entries using brute-force searches of pg_proc.  
It was somewhat remarkable that that worked at all, since it was used  
while populating other pretty-fundamental catalogs like pg_operator.  
And it was also quite slow, and getting slower as pg_proc gets bigger.  
  
This patch moves the lookup work into genbki.pl, so that the values in  
postgres.bki for regproc columns are always numeric OIDs, an option  
that regprocin() already supported.  Perl isn't the world's speediest  
language, so this about doubles the time needed to run genbki.pl (from  
0.3 to 0.6 sec on my machine).  But we only do that at most once per  
build.  The time needed to run initdb drops significantly --- on my  
machine, initdb --no-sync goes from 1.8 to 1.3 seconds.  So this is  
a small net win even for just one initdb per build, and it becomes  
quite a nice win for test sequences requiring many initdb runs.  
  
Strip out the now-dead code for brute-force catalog searching in  
regprocin.  We'd also cargo-culted similar logic into regoperin  
and some (not all) of the other reg*in functions.  That is all  
dead code too since we currently have no need to load such values  
during bootstrap.  I removed it all, reasoning that if we ever  
need such functionality it'd be much better to do it in a similar  
way to this patch.  
  
There might be some simplifications possible in the backend now that  
regprocin doesn't require doing catalog reads so early in bootstrap.  
I've not looked into that, though.  
  
Andreas Karlsson, with some small adjustments by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/adt/regproc.c

pg_dump: Always dump subscriptions NOCONNECT

commit   : a9254e675bde7dc2d976d207450c559d914c0dd6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Apr 2017 22:12:30 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Apr 2017 22:12:30 -0400    

Click here for diff

This removes the pg_dump option --no-subscription-connect and makes it  
the default.  Dumping a subscription so that it activates right away  
when restored is not very useful, because the state of the publication  
server is unclear.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/ref/pg_dump.sgml
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl

pg_dump: Dump subscriptions by default

commit   : c31671f9b5f6eee9b6726baad2db1795c94839d1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 11 Apr 2017 22:02:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 11 Apr 2017 22:02:59 -0400    

Click here for diff

Dump subscriptions if the current user is a superuser, otherwise write a  
warning and skip them.  Remove the pg_dump option  
--include-subscriptions.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/pg_dump.sgml
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
M src/bin/pg_dump/t/002_pg_dump.pl

Fix XMLTABLE synopsis, add XMLNAMESPACES example

commit   : 73c1748d833617c6ba19750236f8e09beedb132a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Apr 2017 12:08:34 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Apr 2017 12:08:34 -0300    

Click here for diff

Add a missing comma in the synopsis after the XMLNAMESPACES clause.  
Also, add an example illustrating the use of that clause.  
  
Author: Arjen Nienhuis and Pavel Stěhule  

M doc/src/sgml/func.sgml

Catversion bump forgotten in previous commit

commit   : 27bcc372b1b323f2d6e0958a05a66b119cfdda38    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Apr 2017 11:54:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Apr 2017 11:54:00 -0300    

Click here for diff

M src/include/catalog/catversion.h

Minor cleanup of backend SCRAM code.

commit   : 00707fa58275e370dc445fa7e1130085aa04f37b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Apr 2017 17:44:15 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Apr 2017 17:44:15 +0300    

Click here for diff

Free each SASL message after sending it. It's not a lot of wasted memory,  
and it's short-lived, but the authentication code in general tries to  
pfree() stuff, so let's follow the example.  
  
Adding the pfree() revealed a little bug in build_server_first_message().  
It attempts to keeps a copy of the sent message, but it was missing a  
pstrdup(), so the pointer started to dangle, after adding the pfree()  
into CheckSCRAMAuth().  
  
Reword comments and debug messages slightly, while we're at it.  
  
Reviewed by Michael Paquier.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c

Remove pg_stats_ext view

commit   : 3d5facfd9ab66c819ed583b2614b0560405a6aa2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Apr 2017 11:35:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Apr 2017 11:35:22 -0300    

Click here for diff

It was created as equivalent of pg_stats, but since the code underlying  
pg_statistic_ext is more convenient than the one for pg_statistic,  
pg_stats_ext is no longer useful.  
  
Author: David Rowley  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/CAKJS1f9zAkPUf9nQrqpFBAsrOHvb5eYa2FVNsmCJy1wegcO_TQ@mail.gmail.com  

M doc/src/sgml/planstats.sgml
M src/backend/catalog/system_views.sql
M src/test/regress/expected/rules.out

docs: update major release instructions

commit   : 06fc54cd4355caf8e271ffc864885ccaa879159e    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 13 Apr 2017 10:19:12 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 13 Apr 2017 10:19:12 -0400    

Click here for diff

M src/tools/RELEASE_CHANGES

git_changelog: improve comment

commit   : e1c86a55762c81ffbcf3985f7eb711026d40824f    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 13 Apr 2017 09:13:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 13 Apr 2017 09:13:43 -0400    

Click here for diff

M src/tools/git_changelog

Mention pg_index changes also cause relcache invalidation

commit   : 2c2ecddcffba979ce3457bce3655136b6230a127    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 13 Apr 2017 10:07:21 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 13 Apr 2017 10:07:21 +0100    

Click here for diff

Amit Langote, additional line by me  

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

Move pg_stat_progress_vacuum to the table of Dynamic Statistics Views in doc.

commit   : 7a3e8d7b503c25e009b9f591554617a2434c72eb    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 13 Apr 2017 12:09:14 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 13 Apr 2017 12:09:14 +0900    

Click here for diff

Previously the description about pg_stat_progress_vacuum was in the table  
of "Collected Statistics Views" in the doc. But since it repors dynamic  
information, i.e., the current progress of VACUUM, its description should be  
in the table of "Dynamic Statistics Views".  
  
Back-patch to 9.6 where pg_stat_progress_vacuum was added.  
  
Author: Amit Langote  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml

Improve documentations for ALTER PUBLICATION and ALTER SUBSCRIPTION.

commit   : a6e7d591d0129bc7f1f186cb40a6ebd7963956ab    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 13 Apr 2017 11:29:53 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 13 Apr 2017 11:29:53 +0900    

Click here for diff

Discussion: http://postgr.es/m/CAD21AoC32YgtateNqTFXzTJmHHe6hXs4cpJTND3n-Ts8f-aMqw@mail.gmail.com  

M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_subscription.sgml

Improve tab-completion of DDL for publication and subscription.

commit   : c525f740661104e3d8578a133ed6b4a8cd7028ac    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 13 Apr 2017 11:26:36 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 13 Apr 2017 11:26:36 +0900    

Click here for diff

Author: Masahiko Sawada  
Discussion: http://postgr.es/m/CAD21AoC32YgtateNqTFXzTJmHHe6hXs4cpJTND3n-Ts8f-aMqw@mail.gmail.com  

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

Speed up hash_index regression test.

commit   : 4a8bc39b08aa83694f22ea56a8626e91e28a0227    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Apr 2017 16:17:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Apr 2017 16:17:53 -0400    

Click here for diff

Commit f5ab0a14e made this test take substantially longer than it used  
to.  With a bit more care, we can get the runtime back down while  
achieving the same, or even a bit better, code coverage.  
  
Mithun Cy  
  
Discussion: https://postgr.es/m/CAD__Ouh-qaEb+rD7Uy-4g3xQYOrhPzHs-a_TrFAjiQ5azAW5+w@mail.gmail.com  

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

Avoid transferring parallel-unsafe subplans to parallel workers.

commit   : 16ebab68862bb5d3595b8c8df083f650d9d7cd20    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Apr 2017 16:06:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Apr 2017 16:06:49 -0400    

Click here for diff

Commit 5e6d8d2bb allowed parallel workers to execute parallel-safe  
subplans, but it transmitted the query's entire list of subplans to  
the worker(s).  Since execMain.c blindly does ExecInitNode and later  
ExecEndNode on every list element, this resulted in parallel-unsafe plan  
nodes nonetheless getting started up and shut down in parallel workers.  
That seems mostly harmless as far as core plan node types go (but  
maybe not so much for Gather?).  But it resulted in postgres_fdw  
opening and then closing extra remote connections, and it's likely  
that other non-parallel-safe FDWs or custom scan providers would have  
worse reactions.  
  
To fix, just make ExecSerializePlan replace parallel-unsafe subplans  
with NULLs in the cut-down plan tree that it transmits to workers.  
This relies on ExecInitNode and ExecEndNode to do nothing on NULL  
input, but they do anyway.  If anything else is touching the dropped  
subplans in a parallel worker, that would be a bug to be fixed.  
(This thus provides a strong guarantee that we won't try to do  
something with a parallel-unsafe subplan in a worker.)  
  
This is, I think, the last fix directly occasioned by Andreas Seltenreich's  
bug report of a few days ago.  
  
Tom Lane and Amit Kapila  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execParallel.c
M src/include/nodes/plannodes.h

doc: Tweak CSS

commit   : f6f9f8a24cdf1bc8a714c65dc45fd67fef59217a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Apr 2017 15:37:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Apr 2017 15:37:03 -0400    

Click here for diff

Tweak CSS a bit to match latest similar changes to web site style.  Also  
move some CSS out of the HTML to the stylesheet so that the web site  
stylesheet can override it.  This should ensure that notes and such are  
back to being centered.  

M doc/src/sgml/stylesheet.css
M doc/src/sgml/stylesheet.xsl

git_changelog: improve instructions for finding branch commits

commit   : 854854019a282b6e74f586a3ee8c88c791193d32    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 12 Apr 2017 15:40:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 12 Apr 2017 15:40:30 -0400    

Click here for diff

Specifically, use '--summary' with 'git show'.  

M src/tools/git_changelog

Mark finished Plan nodes with parallel_safe flags.

commit   : 003d80f3dfadd57c6aac8480436ff53ee2c978bd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Apr 2017 15:13:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Apr 2017 15:13:23 -0400    

Click here for diff

We'd managed to avoid doing this so far, but it seems pretty obvious  
that it would be forced on us some day, and this is much the cleanest  
way of approaching the open problem that parallel-unsafe subplans are  
being transmitted to parallel workers.  Anyway there's no space cost  
due to alignment considerations, and the time cost is pretty minimal  
since we're just copying the flag from the corresponding Path node.  
(At least in most cases ... some of the klugier spots in createplan.c  
have to work a bit harder.)  
  
In principle we could perhaps get rid of SubPlan.parallel_safe,  
but I thought it better to keep that in case there are reasons to  
consider a SubPlan unsafe even when its child plan is parallel-safe.  
  
This patch doesn't actually do anything with the new flags, but  
I thought I'd commit it separately anyway.  
  
Note: although this touches outfuncs/readfuncs, there's no need for  
a catversion bump because Plan trees aren't stored on disk.  
  
Discussion: https://postgr.es/m/[email protected]  

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/subselect.c
M src/include/nodes/plannodes.h

Remove some tabs in SQL code in C string literals

commit   : 35b5f7b608fa1ae12d07cd475c382c5f1341648d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Apr 2017 14:43:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Apr 2017 14:43:01 -0400    

Click here for diff

This is not handled uniformly throughout the code, but at least nearby  
code can be consistent.  

M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c

Fix pgstattuple's handling of unused hash pages.

commit   : 9cc27566c1a8d659c15b9eea2413dcc07a7a42c9    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 12 Apr 2017 11:53:00 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 12 Apr 2017 11:53:00 -0400    

Click here for diff

Hash indexes can contain both pages which are all-zeroes (i.e.  
PageIsNew()) and pages which have been initialized but currently  
aren't used.  The latter category can happen either when a page  
has been reserved but not yet used or when it is used for a time  
and then freed.  pgstattuple was only prepared to deal with the  
pages that are actually-zeroes, which it called zero_pages.  
Rename the column to unused_pages (extension version 1.5 is  
as-yet-unreleased) and make it count both kinds of unused pages.  
  
Along the way, slightly tidy up the way we test for pages of  
various types.  
  
Robert Haas and Ashutosh Sharma, reviewed by Amit Kapila  
  
Discussion: http://postgr.es/m/CAE9k0PkTtKFB3YndOyQMjwuHx+-FtUP1ynK8E-nHtetoow3NtQ@mail.gmail.com  

M contrib/pgstattuple/expected/pgstattuple.out
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/pgstattuple–1.4–1.5.sql
M doc/src/sgml/pgstattuple.sgml

Code review for c94e6942cefe7d20c5feed856e27f672734b1e2b.

commit   : 1d5fede4a900d135745c1fa5a70dcfe0b3359e3d    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 12 Apr 2017 11:13:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 12 Apr 2017 11:13:44 -0400    

Click here for diff

validateCheckConstraint() shouldn't try to access the storage for  
a partitioned table, because it no longer has any.  Creating a  
_RETURN table on a partitioned table shouldn't be allowed, both  
because there's no value in it and because trying to do so would  
involve a validation scan against its nonexistent storage.  
  
Amit Langote, reviewed by Tom Lane.  Regression test outputs  
updated to pass by me.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Fix reversed check of return value from sync

commit   : b935eb7da37254a18c48acc7b07517c8dfbb2339    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 12 Apr 2017 13:43:59 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 12 Apr 2017 13:43:59 +0200    

Click here for diff

While at it also update the comments in walmethods.h to make it less  
likely for mistakes like this to appear in the future (thanks to Tom for  
improvements to the comments).  
  
And finally, in passing change the return type of walmethod.getlasterror  
to being const, also per suggestion from Tom.  

M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h

Remove bogus redefinition of _MSC_VER.

commit   : 587d62d8562d658a2a9be60bc4574b6f9e592cb1    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Apr 2017 15:32:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Apr 2017 15:32:33 -0400    

Click here for diff

Commit a4777f355 was a shade too mechanical: we don't want to override  
MSVC's own definition of _MSC_VER, as that breaks tests on its numerical  
value.  Per buildfarm.  

M src/tools/msvc/ecpg_regression.proj

Simplify handling of remote-qual pass-forward in postgres_fdw.

commit   : 88e902b769e180a232013e265ff9fd582dde125b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Apr 2017 13:53:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Apr 2017 13:53:13 -0400    

Click here for diff

Commit 0bf3ae88a encountered a need to pass the finally chosen remote qual  
conditions forward from postgresGetForeignPlan to postgresPlanDirectModify.  
It solved that by sticking them into the plan node's fdw_private list,  
which in hindsight was a pretty bad idea.  In the first place, there's no  
use for those qual trees either in EXPLAIN or execution; indeed they could  
never safely be used for any post-planning purposes, because they would not  
get processed by setrefs.c.  So they're just dead weight to carry around in  
the finished plan tree, plus being an attractive nuisance for somebody who  
might get the idea that they could be used that way.  Secondly, because  
those qual trees (sometimes) contained RestrictInfos, they created a  
plan-transmission hazard for parallel query, which is how come we noticed a  
problem.  We dealt with that symptom in commit 28b047875, but really a more  
straightforward and more efficient fix is to pass the data through in a new  
field of struct PgFdwRelationInfo.  So do it that way.  (There's no need  
to revert 28b047875, as it has sufficient reason to live anyway.)  
  
Per fuzz testing by Andreas Seltenreich.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Allow a rule on partitioned table to be renamed.

commit   : 02af7857e5694b13c21401d1982ac21d31e27dee    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 11 Apr 2017 13:17:22 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 11 Apr 2017 13:17:22 -0400    

Click here for diff

Commit f0e44751d7175fa3394da2c8f85e3ceb3cdbfe63 should have updated  
this code, but did not.  
  
Amit Langote  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/rewrite/rewriteDefine.c
M src/test/regress/expected/rules.out
M src/test/regress/sql/rules.sql

Add an Assert() to max_parallel_workers enforcement.

commit   : 6599c9ac3340b6cd3d86a0a7f866b80a009fecab    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 11 Apr 2017 13:03:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 11 Apr 2017 13:03:44 -0400    

Click here for diff

To prevent future bugs along the lines of the one corrected by commit  
8ff518699f19dd0a5076f5090bac8400b8233f7f, or find any that remain  
in the current code, add an Assert() that the difference between  
parallel_register_count and parallel_terminate_count is in a sane  
range.  
  
Kuntal Ghosh, with considerable tidying-up by me, per a suggestion  
from Neha Khatri.  Reviewed by Tomas Vondra.  
  
Discussion: http://postgr.es/m/CAFO0U+-E8yzchwVnvn5BeRDPgX2z9vZUxQ8dxx9c0XFGBC7N1Q@mail.gmail.com  

M src/backend/postmaster/bgworker.c
M src/backend/utils/misc/guc.c
M src/include/postmaster/bgworker_internals.h

Fix confusion of max_parallel_workers mechanism following crash.

commit   : 8ff518699f19dd0a5076f5090bac8400b8233f7f    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 11 Apr 2017 12:31:00 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 11 Apr 2017 12:31:00 -0400    

Click here for diff

Commit b460f5d6693103076dc554aa7cbb96e1e53074f9 failed to contemplate  
the possibilit that a parallel worker registered before a crash would  
be unregistered only after the crash; if that happened, we'd end up  
with parallel_terminate_count > parallel_register_count and the  
system would refuse to launch any more parallel workers.  
  
The easiest way to fix that seems to be to forget BGW_NEVER_RESTART  
workers in ResetBackgroundWorkerCrashTimes() rather than leaving them  
around to be cleaned up after the conclusion of the restart, so that  
they go away before rather than after shared memory is reset.  
  
To make sure that this fix is water-tight, don't allow parallel  
workers to be anything other than BGW_NEVER_RESTART, so that after  
recovering from a crash, 0 is guaranteed to be the correct starting  
value for parallel_register_count.  The core code wouldn't do this  
anyway, but somebody might try to do it in extension code.  
  
Report by Thomas Vondra.  Patch by me, reviewed by Kuntal Ghosh.  
  
Discussion: http://postgr.es/m/CAGz5QC+AVEVS+3rBKRq83AxkJLMZ1peMt4nnrQwczxOrmo3CNw@mail.gmail.com  

M src/backend/postmaster/bgworker.c

doc: clearify pg_upgrade default copy behavior

commit   : 1e298b8dbb3220a0d5e073e0ad6a8afd35042c2a    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 11 Apr 2017 12:14:01 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 11 Apr 2017 12:14:01 -0400    

Click here for diff

Reported-by: Marek <[email protected]>  
  
Discussion: [email protected]  

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

Fix failure when a shared tidbitmap has only one page.

commit   : 4c3b59abf4c476843bca23de7fb66d647627f30e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 11 Apr 2017 12:03:12 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 11 Apr 2017 12:03:12 -0400    

Click here for diff

Commit 98e6e89040a0534ca26914c66cae9dd49ef62ad9 made inadequate  
provision for the case of a single-page shared tidbitmap.  It  
allocate space for a shared PagetableEntry, but failed to  
initialize it.  
  
Report by Thomas Munro.  Patch by Dilip Kumar, with some comment  
changes by me.  
  
Discussion: http://postgr.es/m/CAEepm=19Cmnfbi-j2Bw-a6yGPeHE1OVhKvvKz9bRBTJGKfGHMA@mail.gmail.com  

M src/backend/nodes/tidbitmap.c

Handle restriction clause lists more uniformly in postgres_fdw.

commit   : 28b047875554b29837cded70a19384dae107c61a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Apr 2017 11:58:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Apr 2017 11:58:59 -0400    

Click here for diff

Clauses in the lists retained by postgres_fdw during planning were  
sometimes bare boolean clauses, sometimes RestrictInfos, and sometimes  
a mixture of the two in the same list.  The comment about that situation  
didn't come close to telling the full truth, either.  Aside from being  
confusing, this had a couple of bad practical consequences:  
* waste of planning cycles due to inability to cache per-clause selectivity  
and cost estimates;  
* sometimes, RestrictInfos would sneak into the fdw_private list of a  
finished Plan node, causing failures if, for example, we tried to ship  
the Plan tree to a parallel worker.  
(It may well be that it's a bug in the parallel-query logic that we  
would ever try to ship such a plan to a parallel worker, but in any  
case this deserves to be cleaned up.)  
  
To fix, rearrange so that clause lists in PgFdwRelationInfo are always  
lists of RestrictInfos, and then strip the RestrictInfos at the last  
minute when making a Plan node.  In passing do a bit of refactoring and  
comment cleanup in postgresGetForeignPlan and foreign_join_ok.  
  
Although the messiness here dates back at least to 9.6, there's no evidence  
that it causes anything worse than wasted planning cycles in 9.6, so no  
back-patch for now.  
  
Per fuzz testing by Andreas Seltenreich.  
  
Tom Lane and Ashutosh Bapat  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h

Add max_sync_workers_per_subscription to postgresql.conf.sample.

commit   : ff7bce174390ae063c122ab04020bd4ee070d6ad    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 12 Apr 2017 00:10:54 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 12 Apr 2017 00:10:54 +0900    

Click here for diff

This commit also does  
  
- add REPLICATION_SUBSCRIBERS into config_group  
- mark max_logical_replication_workers and max_sync_workers_per_subscription  
  as REPLICATION_SUBSCRIBERS parameters  
- move those parameters into "Subscribers" section in postgresql.conf.sample  
  
Author: Masahiko Sawada, Petr Jelinek and me  
Reported-by: Masahiko Sawada  
Discussion: http://postgr.es/m/CAD21AoAonSCoa=v=87ZO3vhfUZA1k_E2XRNHTt=xioWGUa+0ug@mail.gmail.com  

M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/utils/guc_tables.h

docs: Improve window function docs

commit   : 1c1a4726eba5bb8c0772db8a8efe0315d71887fb    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 11 Apr 2017 10:47:40 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 11 Apr 2017 10:47:40 -0400    

Click here for diff

Specifically, the behavior of general-purpose and statistical aggregates  
as window functions was not clearly documented, and terms were  
inconsistently used.  Also add docs about the difference between  
cume_dist and percent_rank, rather than just the formulas.  
  
Discussion: [email protected]  

M doc/src/sgml/advanced.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/syntax.sgml

Remove symbol WIN32_ONLY_COMPILER

commit   : a4777f35565b80ae10605d6d417e5d173156f7da    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 11 Apr 2017 15:21:25 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 11 Apr 2017 15:21:25 +0200    

Click here for diff

This used to mean "Visual C++ except in those parts where Borland C++  
was supported where it meant one of those". Now that we don't support  
Borland C++ anymore, simplify by using _MSC_VER which is the normal way  
to detect Visual C++.  

M src/backend/libpq/auth.c
M src/backend/libpq/pqcomm.c
M src/backend/port/win32/mingwcompat.c
M src/common/exec.c
M src/include/getaddrinfo.h
M src/include/libpq/libpq-be.h
M src/include/port.h
M src/include/port/atomics.h
M src/include/port/atomics/arch-x86.h
M src/include/port/win32.h
M src/include/storage/s_lock.h
M src/interfaces/ecpg/test/expected/thread-thread.c
M src/interfaces/ecpg/test/expected/thread-thread_implicit.c
M src/interfaces/ecpg/test/thread/thread.pgc
M src/interfaces/ecpg/test/thread/thread_implicit.pgc
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/tools/msvc/ecpg_regression.proj

Remove support for bcc and msvc standalone libpq builds

commit   : 6da56f3f84d430671d5edd8f9336bd744c089e31    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 11 Apr 2017 15:14:26 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 11 Apr 2017 15:14:26 +0200    

Click here for diff

This removes the support for building just libpq using Borland C++ or  
Visual C++. This has not worked properly for years, and given the number  
of complaints it's clearly not worth the maintenance burden.  
  
Building libpq using the standard MSVC build system is of course still  
supported, along with mingw.  

M doc/src/sgml/install-windows.sgml
M src/Makefile.shlib
D src/bcc32.mak
M src/bin/psql/command.c
M src/include/getaddrinfo.h
M src/include/port.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/win32.h
D src/interfaces/libpq/bcc32.mak
M src/interfaces/libpq/win32.h
D src/interfaces/libpq/win32.mak
D src/win32.mak

Fix possibile deadlock when dropping partitions.

commit   : 258cef12540fa1cb244881a0f019cefd698c809e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 11 Apr 2017 09:08:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 11 Apr 2017 09:08:36 -0400    

Click here for diff

heap_drop_with_catalog and RangeVarCallbackForDropRelation should  
lock the parent before locking the target relation.  
  
Amit Langote  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c

Fix pgbench's --progress-timestamp option to print Unix-epoch timestamps.

commit   : feffa0e0795a5a99324890a6dd548ba162ec104c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Apr 2017 08:59:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Apr 2017 08:59:40 -0400    

Click here for diff

As a consequence of commit 1d63f7d2d, on platforms with CLOCK_MONOTONIC,  
you got some random timescale or other instead of standard Unix timestamps  
as expected.  I'd attempted to fix pgbench for that change in commits  
74baa1e3b and 67a875355, but missed this place.  Fix in the same way as  
those previous commits, ie, just eat the cost of an extra gettimeofday();  
one extra syscall per progress report isn't worth sweating over.  Per  
report from Jeff Janes.  
  
In passing, use snprintf not sprintf for this purpose.  I don't think  
there's any chance of actual buffer overrun, but it just looks safer.  
  
Discussion: https://postgr.es/m/CAMkU=1zrQaPwBN+NcBd3pWCb=vWaiL=mmWfJjDJjh-a7eVr-Og@mail.gmail.com  

M src/bin/pgbench/pgbench.c

Document that bytea is best represented as char * in C for ecpg.

commit   : a6940bdcb9ef87a54459deac5699a61cfdbc696c    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 11 Apr 2017 12:41:06 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 11 Apr 2017 12:41:06 +0200    

Click here for diff

Patch by Kato, Sho <[email protected]>  

M doc/src/sgml/ecpg.sgml

Run most pg_dump and pg_dumpall tests with --no-sync

commit   : 3820c63da8d0e59e2bd4476e91968f03be5dd041    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 10 Apr 2017 19:53:47 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 10 Apr 2017 19:53:47 -0400    

Click here for diff

Commit 96a7128b made pg_dump and pg_dumpall sync their output by  
default. However, there's no great need for that in testing, and it  
could impose a performance penalty, so we add the --no-sync flag to most  
of the test cases.  
  
Michael Paquier  

M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_upgrade/test.sh
M src/test/modules/test_pg_dump/t/001_base.pl

Use weaker locks when updating pg_subscription_rel

commit   : 521fd4795e3ec3d0b263b62e5eb58e1557be9c86    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 10 Apr 2017 15:08:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 10 Apr 2017 15:08:14 -0400    

Click here for diff

The previously used ShareRowExclusiveLock, while technically probably  
more correct, led to deadlocks during seemingly unrelated operations and  
thus a poor experience.  Use RowExclusiveLock, like for most similar  
catalog operations.  In some care cases, the user might see an error  
from DDL commands.  
  
Discussion: https://www.postgresql.org/message-id/flat/13592.1490851519%40sss.pgh.pa.us  
  
Author: Petr Jelinek <[email protected]>  

M src/backend/catalog/pg_subscription.c

Fix initialization of dsa.c free area counter.

commit   : c45b1d2283c6631b990de25098ea389a1b96277a    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 10 Apr 2017 11:56:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 10 Apr 2017 11:56:46 -0700    

Click here for diff

The backend local copy of dsa_area_control->freed_segment_counter was  
not properly initialized / maintained.  This could, if unlucky, lead  
to keeping attached to a segment for too long.  
  
Found via valgrind bleat on buildfarm animal skink.  
  
Author: Thomas Munro  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/dsa.c

Improve castNode notation by introducing list-extraction-specific variants.

commit   : 8f0530f58061b185dc385df42e62d78a18d4ae3e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Apr 2017 13:51:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Apr 2017 13:51:29 -0400    

Click here for diff

This extends the castNode() notation introduced by commit 5bcab1114 to  
provide, in one step, extraction of a list cell's pointer and coercion to  
a concrete node type.  For example, "lfirst_node(Foo, lc)" is the same  
as "castNode(Foo, lfirst(lc))".  Almost half of the uses of castNode  
that have appeared so far include a list extraction call, so this is  
pretty widely useful, and it saves a few more keystrokes compared to the  
old way.  
  
As with the previous patch, back-patch the addition of these macros to  
pg_list.h, so that the notation will be available when back-patching.  
  
Patch by me, after an idea of Andrew Gierth's.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/async.c
M src/backend/commands/collationcmds.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dropcmds.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/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/user.c
M src/backend/commands/view.c
M src/backend/executor/execExpr.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/spi.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/misc/guc.c
M src/backend/utils/mmgr/portalmem.c
M src/include/nodes/pg_list.h
M src/pl/plpgsql/src/pl_exec.c

Fix typo in comment

commit   : 56dd8e85c40fef3e3c2c10afa186ee30416ec507    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 10 Apr 2017 13:42:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 10 Apr 2017 13:42:05 -0400    

Click here for diff

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

Support configuration reload in logical replication workers

commit   : 26ad194cb0a6b955e155d44fb52a74212ce85759    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 10 Apr 2017 13:40:55 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 10 Apr 2017 13:40:55 -0400    

Click here for diff

Author: Michael Paquier <[email protected]>  
Reviewed-by: Petr Jelinek <[email protected]>  
Reported-by: Fujii Masao <[email protected]>  

M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/worker.c
M src/include/replication/worker_internal.h

Fix reporting of violations in ExecConstraints, again.

commit   : c0a8ae7be392aa09dd7e148ff662013e8e148893    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 10 Apr 2017 12:20:08 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 10 Apr 2017 12:20:08 -0400    

Click here for diff

We decided in f1b4c771ea74f42447dccaed42ffcdcccf3aa694 to pass the  
original slot to ExecConstraints(), but that breaks when there are  
BEFORE ROW triggers involved.  So we need to do reverse-map the tuples  
back to the original descriptor instead, as Amit originally proposed.  
  
Amit Langote, reviewed by Ashutosh Bapat.  One overlooked comment  
fixed by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/commands/copy.c
M src/backend/executor/execMain.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/executor.h
M src/test/regress/expected/insert.out
M src/test/regress/sql/insert.sql

Fix whitespace

commit   : 244f1c89070c1a661623bf1eaddf1307f8f598a3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 10 Apr 2017 11:18:15 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 10 Apr 2017 11:18:15 -0400    

Click here for diff

M contrib/sepgsql/expected/dml.out
M contrib/sepgsql/sql/dml.sql

Move isolationtester's is-blocked query into C code for speed.

commit   : 511540dadf1166d80b864f63979178f324844060    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Apr 2017 10:26:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Apr 2017 10:26:54 -0400    

Click here for diff

Commit 4deb41381 modified isolationtester's query to see whether a  
session is blocked to also check for waits occurring in GetSafeSnapshot.  
However, it did that in a way that enormously increased the query's  
runtime under CLOBBER_CACHE_ALWAYS, causing the buildfarm members  
that use that to run about four times slower than before, and in some  
cases fail entirely.  To fix, push the entire logic into a dedicated  
backend function.  This should actually reduce the CLOBBER_CACHE_ALWAYS  
runtime from what it was previously, though I've not checked that.  
  
In passing, expose a SQL function to check for safe-snapshot blockage,  
comparable to pg_blocking_pids.  This is more or less free given the  
infrastructure built to solve the other problem, so we might as well.  
  
Thomas Munro  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/storage/lmgr/predicate.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/predicate_internals.h
M src/test/isolation/.gitignore
M src/test/isolation/isolationtester.c

Fix indentation.

commit   : 9cf5c31964315181e475fc37a5e9ad2204fe3484    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 10 Apr 2017 14:13:15 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 10 Apr 2017 14:13:15 +0300    

Click here for diff

Oops, I forgot to "git add" this to previous commit.  

M doc/src/sgml/protocol.sgml

Document the "replication" option in StartupMessage.

commit   : 6c4ad8b7bf420a6f598e4b45560cffc40ded0875    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 10 Apr 2017 14:08:20 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 10 Apr 2017 14:08:20 +0300    

Click here for diff

It is documented in the Streaming Replication Protocol section, but was  
missing from the list of options in StartupMessage description.  

M doc/src/sgml/protocol.sgml

Make sepgsql regression tests robust vs. collation differences

commit   : 86fa9b2d1b74cf7e3402c7653f7515b075eacc7b    
  
author   : Joe Conway <[email protected]>    
date     : Sun, 9 Apr 2017 15:59:02 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Sun, 9 Apr 2017 15:59:02 -0700    

Click here for diff

In commit 25542d77, regression test coverage was added to sepgsql  
for partitioned tables. Unfortunately it was not robust in the face  
of collation differences, per the buildfarm. Force "C" collation  
in order to fix that.  
  
Discussion: https://postgr.es/m/flat/623bcaae-112e-ced0-8c22-a84f75ae0c53%40joeconway.com  

M contrib/sepgsql/expected/dml.out
M contrib/sepgsql/expected/label.out
M contrib/sepgsql/sql/dml.sql
M contrib/sepgsql/sql/label.sql

Add partitioned table support to sepgsql

commit   : 25542d77dd549940468d1a932809feb9959d717d    
  
author   : Joe Conway <[email protected]>    
date     : Sun, 9 Apr 2017 14:01:58 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Sun, 9 Apr 2017 14:01:58 -0700    

Click here for diff

The new partitioned table capability added a new relkind, namely  
RELKIND_PARTITIONED_TABLE. Update sepgsql to treat this new relkind  
exactly the same way it does RELKIND_RELATION.  
  
In addition, add regression test coverage for partitioned tables.  
  
Issue raised by Stephen Frost and initial patch by Mike Palmiotto.  
Review by Tom Lane and Robert Haas, and editorializing by me.  
  
Discussion: https://postgr.es/m/flat/623bcaae-112e-ced0-8c22-a84f75ae0c53%40joeconway.com  

M contrib/sepgsql/dml.c
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/label.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/sql/alter.sql
M contrib/sepgsql/sql/ddl.sql
M contrib/sepgsql/sql/dml.sql
M contrib/sepgsql/sql/label.sql
M contrib/sepgsql/sql/misc.sql

Clean up bugs in clause_selectivity() cleanup.

commit   : eef8c0069e4d5eea2e52965ce3eb018b5a594fd6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 8 Apr 2017 16:38:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 8 Apr 2017 16:38:03 -0400    

Click here for diff

Commit ac2b09508 was not terribly carefully reviewed.  Band-aid it to  
not fail on non-RestrictInfo input, per report from Andreas Seltenreich.  
Also make it do something more reasonable with variable-free clauses,  
and improve nearby comments.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add newly-symlinked files to "make clean" target.

commit   : aba696d1af9a267eee85d69845c3cdeccf788525    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 8 Apr 2017 14:25:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 8 Apr 2017 14:25:45 -0400    

Click here for diff

Oversight in 60f11b87a.  

M src/interfaces/libpq/Makefile

Fix the new SASLprep tests to work with non-UTF-8 locales.

commit   : 9025af3ed039dd3bb9286b5af2fbdb29b9eb204e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 8 Apr 2017 13:32:38 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 8 Apr 2017 13:32:38 +0300    

Click here for diff

Fix by forcing database encoding to UTF-8, regardless of the current  
locale.  
  
Pointed out by Tom Lane.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/test/authentication/t/002_saslprep.pl

doc: Add some markup

commit   : f0e44021dfbdd37cb72aea71e3b3cf8b0397f9c5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 7 Apr 2017 22:42:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 7 Apr 2017 22:42:03 -0400    

Click here for diff

M doc/src/sgml/ref/alter_domain.sgml
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/create_statistics.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/grant.sgml

Add GUCs for predicate lock promotion thresholds.

commit   : c63172d60f242ad3581c83723a5b315bbe547a0e    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 7 Apr 2017 21:38:05 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 7 Apr 2017 21:38:05 -0500    

Click here for diff

Defaults match the fixed behavior of prior releases, but now DBAs  
have better options to tune serializable workloads.  
  
It might be nice to be able to set this per relation, but that part  
will need to wait for another release.  
  
Author: Dagfinn Ilmari MannsƄker  

M doc/src/sgml/config.sgml
M doc/src/sgml/mvcc.sgml
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/storage/predicate.h

Optimize joins when the inner relation can be proven unique.

commit   : 9c7f5229ad68d7e0e4dd149e3f80257893e404d4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2017 22:20:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2017 22:20:03 -0400    

Click here for diff

If there can certainly be no more than one matching inner row for a given  
outer row, then the executor can move on to the next outer row as soon as  
it's found one match; there's no need to continue scanning the inner  
relation for this outer row.  This saves useless scanning in nestloop  
and hash joins.  In merge joins, it offers the opportunity to skip  
mark/restore processing, because we know we have not advanced past the  
first possible match for the next outer row.  
  
Of course, the devil is in the details: the proof of uniqueness must  
depend only on joinquals (not otherquals), and if we want to skip  
mergejoin mark/restore then it must depend only on merge clauses.  
To avoid adding more planning overhead than absolutely necessary,  
the present patch errs in the conservative direction: there are cases  
where inner_unique or skip_mark_restore processing could be used, but  
it will not do so because it's not sure that the uniqueness proof  
depended only on "safe" clauses.  This could be improved later.  
  
David Rowley, reviewed and rather heavily editorialized on by me  
  
Discussion: https://postgr.es/m/CAApHDvqF6Sw-TK98bW48TdtFJ+3a7D2mFyZ7++=D-RyPsL76gw@mail.gmail.com  

M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/commands/explain.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeNestloop.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/relnode.c
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
M src/include/optimizer/planmain.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/equivclass.out
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Fix issues in e8fdbd58fe.

commit   : f13a9121f9822eafe05cc3178bf046155a248173    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2017 17:03:21 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2017 17:03:21 -0700    

Click here for diff

When the 64bit atomics simulation is in use, we can't necessarily  
guarantee the correct alignment of the atomics due to lack of compiler  
support for doing so- that's fine from a safety perspective, because  
everything is protected by a lock, but we asserted the alignment in  
all cases.  Weaken them.  Per complaint from Alvaro Herrera.  
  
My #ifdefery for PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY wasn't  
sufficient. Fix that.  Per complaint from Alexander Korotkov.  

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

doc: Add SPFLAGS to osx calls

commit   : 453aaf76880b42eb5f205933d2422fe7c773b06f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 7 Apr 2017 18:26:06 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 7 Apr 2017 18:26:06 -0400    

Click here for diff

This enables the same OpenSP warnings on osx calls that we get from  
onsgmls (make check) and formerly from openjade.  
  
Older tool chains apparently have some of these warnings on by  
default (see comment at SPFLAGS assignment).  So users of such tool  
chains would complain about warnings or errors that users of newer tool  
chains would not see, unless they used "make check".  

M doc/src/sgml/Makefile

doc: Add missing closing tag

commit   : 234811c21de4246e347e8369328bcaf706a35281    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 7 Apr 2017 18:25:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 7 Apr 2017 18:25:24 -0400    

Click here for diff

Author: Erik Rijkers <[email protected]>  

M doc/src/sgml/monitoring.sgml

Fix printf format to use %zd when printing sizes

commit   : 8acc1e0fe21015d403c0e005d92d04250ece84b9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 7 Apr 2017 19:27:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 7 Apr 2017 19:27:00 -0300    

Click here for diff

Using %ld as we were doing raises compiler warnings on 32 bit platforms.  
  
Reported by Andres Freund.  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/statistics/dependencies.c
M src/backend/statistics/mvdistinct.c

Reduce the number of pallocs() in BRIN

commit   : 8bf74967dab1b368f4e217c960ede1516c42a989    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 7 Apr 2017 18:54:26 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 7 Apr 2017 18:54:26 -0300    

Click here for diff

Instead of allocating memory in brin_deform_tuple and brin_copy_tuple  
over and over during a scan, allow reuse of previously allocated memory.  
This is said to make for a measurable performance improvement.  
  
Author: Jinyu Zhang, Ɓlvaro Herrera  
Reviewed by: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/brinfuncs.c
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_tuple.c
M src/include/access/brin_tuple.h

Improve 64bit atomics support.

commit   : e8fdbd58fe564a29977f4331cd26f9697d76fc40    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2017 14:44:47 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2017 14:44:47 -0700    

Click here for diff

When adding atomics back in b64d92f1a, I added 64bit support as  
optional; there wasn't yet a direct user in sight.  That turned out to  
be a bit short-sighted, it'd already have been useful a number of times.  
  
Add a fallback implementation of 64bit atomics, just like the one we  
have for 32bit atomics.  
  
Additionally optimize reads/writes to 64bit on a number of platforms  
where aligned writes of that size are atomic. This can now be tested  
with PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY.  
  
Author: Andres Freund  
Reviewed-By: Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/atomics.c
M src/include/port/atomics.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.h
M src/test/regress/regress.c

Fix compiler warning

commit   : 28afad5c85b436f19d9f2c0e3197c7db960fef6f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 7 Apr 2017 17:37:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 7 Apr 2017 17:37:12 -0400    

Click here for diff

on MSVC 2010  
  
Author: Michael Paquier <[email protected]>  

M src/backend/catalog/pg_depend.c

Avoid using a C++ keyword in header file

commit   : 0cb2e51992a7940f9e577a74da250508aedcecf7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 7 Apr 2017 16:32:02 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 7 Apr 2017 16:32:02 -0400    

Click here for diff

per cpluspluscheck  

M src/common/unicode/generate-unicode_norm_table.pl
M src/common/unicode_norm.c
M src/include/common/unicode_norm_table.h

Fix new BRIN desummarize WAL record

commit   : 817cb100136a15796cbd9e70f49d20625108d782    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 7 Apr 2017 16:58:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 7 Apr 2017 16:58:54 -0300    

Click here for diff

The WAL-writing piece was forgetting to set the pages-per-range value.  
Also, fix the declared type of struct member heapBlk, which I mistakenly  
set as OffsetNumber rather than BlockNumber.  
  
Problem was introduced by commit c655899ba9ae (April 1st).  Any system  
that tries to replay the new WAL record written before this fix is  
likely to die on replay and require pg_resetwal.  
  
Reported by Tom Lane.  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/brin/brin_revmap.c
M src/include/access/brin_xlog.h

Use English, instead of internal names, for translatable messages.

commit   : 5c4488478b182983f290a61fc8cf2ec83548622b    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 7 Apr 2017 15:38:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 7 Apr 2017 15:38:46 -0400    

Click here for diff

Discussion: http://postgr.es/m/CA+Tgmobuz2C-YiQ87h8h0gECCV=F+SE=HBNaAU75rR5FEwtEhQ@mail.gmail.com  

M src/backend/utils/mmgr/dsa.c

Add ProcArrayGroupUpdate wait event.

commit   : d4116a771925379c33cf4c6634ca620ed08b551d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 7 Apr 2017 13:41:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 7 Apr 2017 13:41:47 -0400    

Click here for diff

Discussion: http://postgr.es/m/CA+TgmobgWHcXDcChX2+BqJDk2dkPVF85ZrJFhUyHHQmw8diTpA@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/postmaster/pgstat.c
M src/backend/storage/ipc/procarray.c
M src/include/pgstat.h

Ensure that ExecPrepareExprList's result is all in one memory context.

commit   : dbb2a931478a397a2b655eb77e8be8c1ca136f63    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2017 12:54:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2017 12:54:17 -0400    

Click here for diff

Noted by Amit Langote.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c

Remove duplicate assignment.

commit   : 0c732850d22a2dddb8a2ef64aed3c23731488caa    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Apr 2017 19:19:50 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Apr 2017 19:19:50 +0300    

Click here for diff

Harmless, but clearly wrong.  
  
Kyotaro Horiguchi  

M src/backend/utils/mb/Unicode/convutils.pm

Fix planner error (or assert trap) with nested set operations.

commit   : 89deca582a345b9c423bed8ebcf24b6ee81a9953    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2017 12:18:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2017 12:18:38 -0400    

Click here for diff

As reported by Sean Johnston in bug #14614, since 9.6 the planner can fail  
due to trying to look up the referent of a Var with varno 0.  This happens  
because we generate such Vars in generate_append_tlist, for lack of any  
better way to describe the output of a SetOp node.  In typical situations  
nothing really cares about that, but given nested set-operation queries  
we will call estimate_num_groups on the output of the subquery, and that  
wants to know what a Var actually refers to.  That logic used to look at  
subquery->targetList, but in commit 3fc6e2d7f I'd switched it to look at  
subroot->processed_tlist, ie the actual output of the subquery plan not the  
parser's idea of the result.  It seemed like a good idea at the time :-(.  
As a band-aid fix, change it back.  
  
Really we ought to have an honest way of naming the outputs of SetOp steps,  
which suggests that it'd be a good idea for the parser to emit an RTE  
corresponding to each one.  But that's a task for another day, and it  
certainly wouldn't yield a back-patchable fix.  
  
Report: https://postgr.es/m/[email protected]  

M src/backend/optimizer/prep/prepunion.c
M src/test/regress/expected/union.out
M src/test/regress/sql/union.sql

Use SASLprep to normalize passwords for SCRAM authentication.

commit   : 60f11b87a2349985230c08616fa8a34ffde934c8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Apr 2017 14:56:05 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Apr 2017 14:56:05 +0300    

Click here for diff

An important step of SASLprep normalization, is to convert the string to  
Unicode normalization form NFKC. Unicode normalization requires a fairly  
large table of character decompositions, which is generated from data  
published by the Unicode consortium. The script to generate the table is  
put in src/common/unicode, as well test code for the normalization.  
A pre-generated version of the tables is included in src/include/common,  
so you don't need the code in src/common/unicode to build PostgreSQL, only  
if you wish to modify the normalization tables.  
  
The SASLprep implementation depends on the UTF-8 functions from  
src/backend/utils/mb/wchar.c. So to use it, you must also compile and link  
that. That doesn't change anything for the current users of these  
functions, the backend and libpq, as they both already link with wchar.o.  
It would be good to move those functions into a separate file in  
src/commmon, but I'll leave that for another day.  
  
No documentation changes included, because there is no details on the  
SCRAM mechanism in the docs anyway. An overview on that in the protocol  
specification would probably be good, even though SCRAM is documented in  
detail in RFC5802. I'll write that as a separate patch. An important thing  
to mention there is that we apply SASLprep even on invalid UTF-8 strings,  
to support other encodings.  
  
Patch by Michael Paquier and me.  
  
Discussion: https://www.postgresql.org/message-id/CAB7nPqSByyEmAVLtEf1KxTRh=PWNKiWKEKQR=e1yGehz=wbymQ@mail.gmail.com  

M src/backend/libpq/auth-scram.c
M src/common/Makefile
A src/common/saslprep.c
M src/common/scram-common.c
A src/common/unicode/.gitignore
A src/common/unicode/Makefile
A src/common/unicode/README
A src/common/unicode/generate-norm_test_table.pl
A src/common/unicode/generate-unicode_norm_table.pl
A src/common/unicode/norm_test.c
A src/common/unicode_norm.c
A src/include/common/saslprep.h
A src/include/common/unicode_norm.h
A src/include/common/unicode_norm_table.h
M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-auth-scram.c
A src/test/authentication/t/002_saslprep.pl
M src/tools/msvc/Mkvcbuild.pm

Fix typo in comment

commit   : 32e33a7979a10e9fcf2c9b32703838cec1daf674    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 7 Apr 2017 09:30:22 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 7 Apr 2017 09:30:22 +0200    

Click here for diff

Masahiko Sawada  

M src/backend/commands/publicationcmds.c

Remove extraneous comma to satisfy picky compiler

commit   : 88dd4e48315878263bcf27e0337daf2b3c1991b8    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 6 Apr 2017 23:28:14 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 6 Apr 2017 23:28:14 -0400    

Click here for diff

per buildfarm  

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

Make json_populate_record and friends operate recursively

commit   : cf35346e813e5a1373f308d397bb0a8f3f21d530    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 6 Apr 2017 22:11:21 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 6 Apr 2017 22:11:21 -0400    

Click here for diff

With this change array fields are populated from json(b) arrays, and  
composite fields are populated from json(b) objects.  
  
Along the way, some significant code refactoring is done to remove  
redundancy in the way to populate_record[_set] and to_record[_set]  
functions operate, and some significant efficiency gains are made by  
caching tuple descriptors.  
  
Nikita Glukhov, edited some by me.  
  
Reviewed by Aleksander Alekseev and Tom Lane.  

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

Remove use of Jade and DSSSL

commit   : 510074f9f0131a04322d6a3d2a51c87e6db243f9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 6 Apr 2017 22:03:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 6 Apr 2017 22:03:52 -0400    

Click here for diff

All documentation is now built using XSLT.  Remove all references to  
Jade, DSSSL, also JadeTex and some other outdated tooling.  
  
For chunked HTML builds, this changes nothing, but removes the  
transitional "oldhtml" target.  The single-page HTML build is ported  
over to XSLT.  For PDF builds, this removes the JadeTex builds and moves  
the FOP builds in their place.  

M config/docbook.m4
M configure
M configure.in
M doc/src/sgml/.gitignore
M doc/src/sgml/Makefile
M doc/src/sgml/docguide.sgml
M doc/src/sgml/filelist.sgml
D doc/src/sgml/fixrtf
M doc/src/sgml/install-windows.sgml
D doc/src/sgml/jadetex.cfg
M doc/src/sgml/postgres.sgml
A doc/src/sgml/stylesheet-html-common.xsl
A doc/src/sgml/stylesheet-html-nochunk.xsl
D doc/src/sgml/stylesheet.dsl
M doc/src/sgml/stylesheet.xsl
M src/Makefile.global.in

Clean up after insufficiently-researched optimization of tuple conversions.

commit   : 3f902354b08ac788600f0ae54fcbfc1d4e3ea765    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Apr 2017 21:10:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Apr 2017 21:10:09 -0400    

Click here for diff

tupconvert.c's functions formerly considered that an explicit tuple  
conversion was necessary if the input and output tupdescs contained  
different type OIDs.  The point of that was to make sure that a composite  
datum resulting from the conversion would contain the destination rowtype  
OID in its composite-datum header.  However, commit 3838074f8 entirely  
misunderstood what that check was for, thinking that it had something to do  
with presence or absence of an OID column within the tuple.  Removal of the  
check broke the no-op conversion path in ExecEvalConvertRowtype, as  
reported by Ashutosh Bapat.  
  
It turns out that of the dozen or so call sites for tupconvert.c functions,  
ExecEvalConvertRowtype is the only one that cares about the composite-datum  
header fields in the output tuple.  In all the rest, we'd much rather avoid  
an unnecessary conversion whenever the tuples are physically compatible.  
Moreover, the comments in tupconvert.c only promise physical compatibility  
not a metadata match.  So, let's accept the removal of the guarantee about  
the output tuple's rowtype marking, recognizing that this is a API change  
that could conceivably break third-party callers of tupconvert.c.  (So,  
let's remember to mention it in the v10 release notes.)  
  
However, commit 3838074f8 did have a bit of a point here, in that two  
tuples mustn't be considered physically compatible if one has HEAP_HASOID  
set and the other doesn't.  (Some of the callers of tupconvert.c might not  
really care about that, but we can't assume it in general.)  The previous  
check accidentally covered that issue, because no RECORD types ever have  
OIDs, while if two tupdescs have the same named composite type OID then,  
a fortiori, they have the same tdhasoid setting.  If we're removing the  
type OID match check then we'd better include tdhasoid match as part of  
the physical compatibility check.  
  
Without that hack in tupconvert.c, we need ExecEvalConvertRowtype to take  
responsibility for inserting the correct rowtype OID label whenever  
tupconvert.c decides it need not do anything.  This is easily done with  
heap_copy_tuple_as_datum, which will be considerably faster than a tuple  
disassembly and reassembly anyway; so from a performance standpoint this  
change is a win all around compared to what happened in earlier branches.  
It just means a couple more lines of code in ExecEvalConvertRowtype.  
  
Ashutosh Bapat and Tom Lane  
  
Discussion: https://postgr.es/m/CAFjFpRfvHABV6+oVvGcshF8rHn+1LfRUhj7Jz1CDZ4gPUwehBg@mail.gmail.com  

M src/backend/access/common/tupconvert.c
M src/backend/executor/execExprInterp.c
M src/test/regress/expected/rowtypes.out
M src/test/regress/sql/rowtypes.sql

Reset API of clause_selectivity()

commit   : ac2b09508834c9d6b7ec9467e876213b0304c792    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 6 Apr 2017 19:10:51 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 6 Apr 2017 19:10:51 -0400    

Click here for diff

Discussion: https://postgr.es/m/CAKJS1f9yurJQW9pdnzL+rmOtsp2vOytkpXKGnMFJEO-qz5O5eA@mail.gmail.com  

M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/orclauses.c
M src/backend/statistics/dependencies.c
M src/backend/utils/adt/selfuncs.c
M src/include/optimizer/cost.h

Fix the RTE_NAMEDTUPLESTORE case in get_rte_attribute_is_dropped().

commit   : 255efa241f460ee4f4c4c98c8cdd7457807f3af9    
  
author   : Kevin Grittner <[email protected]>    
date     : Thu, 6 Apr 2017 17:32:53 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Thu, 6 Apr 2017 17:32:53 -0500    

Click here for diff

Problems pointed out by Andres Freund and Thomas Munro.  

M src/backend/parser/parse_relation.c

Allow avoiding tuple copy within tuplesort_gettupleslot().

commit   : fa117ee40330db401da776e7b003f047098a7d4c    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2017 14:48:59 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2017 14:48:59 -0700    

Click here for diff

Add a "copy" argument to make it optional to receive a copy of caller  
tuple that is safe to use following a subsequent manipulating of  
tuplesort's state.  This is a performance optimization.  Most existing  
tuplesort_gettupleslot() callers are made to opt out of copying.  
Existing callers that happen to rely on the validity of tuple memory  
beyond subsequent manipulations of the tuplesort request their own  
copy.  
  
This brings tuplesort_gettupleslot() in line with  
tuplestore_gettupleslot().  In the future, a "copy"  
tuplesort_getdatum() argument may be added, that similarly allows  
callers to opt out of receiving their own copy of tuple.  
  
In passing, clarify assumptions that callers of other tuplesort fetch  
routines may make about tuple memory validity, per gripe from Tom  
Lane.  
  
Author: Peter Geoghegan  
Discussion: CAM3SWZQWZZ_N=DmmL7tKy_OUjGH_5mN=N=A6h7kHyyDvEhg2DA@mail.gmail.com  

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

Silence uninitialized variable compiler warning in sepgsql

commit   : af8a94d18d70ca226a12057ad4b3d17f27d8ff13    
  
author   : Joe Conway <[email protected]>    
date     : Thu, 6 Apr 2017 14:28:19 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Thu, 6 Apr 2017 14:28:19 -0700    

Click here for diff

At -Og optimization gcc warns that variable tclass may be used  
uninitialized when relkind == RELKIND_INDEX. Actually that can't  
happen due to an early return, but quiet the compiler by initializing  
tclass to 0.  
  
In passing, use uint16_t consistently for the declaration of tclass.  
  
Complaint and initial patch by Mike Palmiotto. Editorializing by me.  
Probably not worth backpatching given that it is cosmetic, so apply  
to development head only.  
  
Discussion: https://postgr.es/m/flat/623bcaae-112e-ced0-8c22-a84f75ae0c53%40joeconway.com  

M contrib/sepgsql/relation.c

Silence compiler warning in sepgsql

commit   : bd190eae36191a6795c4f0fe95419dbf2953d2b0    
  
author   : Joe Conway <[email protected]>    
date     : Thu, 6 Apr 2017 14:21:25 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Thu, 6 Apr 2017 14:21:25 -0700    

Click here for diff

<selinux/label.h> includes <stdbool.h>, which creates an incompatible  
We don't care if <stdbool.h> redefines "true"/"false"; those are close  
enough.  
  
Complaint and initial patch by Mike Palmiotto. Final approach per  
Tom Lane's suggestion, as discussed on hackers. Backpatching to  
all supported branches.  
  
Discussion: https://postgr.es/m/flat/623bcaae-112e-ced0-8c22-a84f75ae0c53%40joeconway.com  

M contrib/sepgsql/label.c

Fix parallel bitmapscan tests on builds without USE_PREFETCH.

commit   : d611517fc44ebbf7e0d563de6d4cd98fd342a762    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2017 14:21:39 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2017 14:21:39 -0700    

Click here for diff

This was broken in 5a5931533edd2.  

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

Fix BRIN cost estimation

commit   : 7e534adcdc70866e7be74d626b0ed067c890a251    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 6 Apr 2017 17:49:26 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 6 Apr 2017 17:49:26 -0300    

Click here for diff

The original code was overly optimistic about the cost of scanning a  
BRIN index, leading to BRIN indexes being selected when they'd be a  
worse choice than some other index.  This complete rewrite should be  
more accurate.  
  
Author: David Rowley, based on an earlier patch by Emre Hasegeli  
Reviewed-by: Emre Hasegeli  
Discussion: https://postgr.es/m/CAKJS1f9n-Wapop5Xz1dtGdpdqmzeGqQK4sV2MK-zZugfC14Xtw@mail.gmail.com  

M src/backend/access/brin/brin.c
M src/backend/utils/adt/selfuncs.c
M src/include/access/brin.h
M src/test/regress/expected/brin.out
M src/test/regress/sql/brin.sql

Add minimal test for EXPLAIN ANALYZE of parallel query.

commit   : b2ff37d43cc81348fd8e9d9c5fcc9dfadf790763    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2017 13:44:48 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2017 13:44:48 -0700    

Click here for diff

This displays the number of workers launched, thus the test is  
dependant on configuration to some degree.  We'll see whether that  
turns out ot be a problem.  
  
Author: Rafia Sabih  
Discussion: https://postgr.es/m/[email protected]  

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

Increase parallel bitmap scan test coverage.

commit   : 5a5931533edd2b70bde1f069609f58998dd26fef    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2017 13:36:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2017 13:36:54 -0700    

Click here for diff

Author: Dilip Kumar  
Discussion: https://postgr.es/m/[email protected]  

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

Fix logical replication between different encodings

commit   : 6f1b9aaae35bfabe2654a8e44ce226c91e7d8bd9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2017 10:44:23 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2017 10:44:23 -0400    

Click here for diff

When sending a tuple attribute, the previous coding erroneously sent the  
length byte before encoding conversion, which would lead to protocol  
failures on the receiving side if the length did not match the following  
string.  
  
To fix that, use pq_sendcountedtext() for sending tuple attributes,  
which takes care of all of that internally.  To match the API of  
pq_sendcountedtext(), send even text values without a trailing zero byte  
and have the receiving end put it in place instead.  This matches how  
the standard FE/BE protocol behaves.  
  
Reported-by: Kyotaro HORIGUCHI <[email protected]>  

M doc/src/sgml/protocol.sgml
M src/backend/replication/logical/proto.c
A src/test/subscription/t/005_encoding.pl

Mark immutable functions in information schema as parallel safe

commit   : 5f21f5292c0856536ac0724974a8bc6b296b9ef6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2017 12:17:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2017 12:17:03 -0400    

Click here for diff

Also add opr_sanity check that all preloaded immutable functions are  
parallel safe.  (Per discussion, this does not necessarily have to be  
true for all possible such functions, but deviations would be unlikely  
enough that maintaining such a test is reasonable.)  
  
Reported-by: David Rowley <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  

M src/backend/catalog/information_schema.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/opr_sanity.sql

pg_dump: Rename some typedefs to avoid name conflicts

commit   : 4be613f692b8f474d5766627a636e7f838131587    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 30 Aug 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 30 Aug 2016 12:00:00 -0400    

Click here for diff

In struct _archiveHandle, some of the fields have the same name as a  
typedef.  This is kind of confusing, so rename the types so they have  
names distinct from the struct fields.  In C++, the previous coding  
changes the meaning of the typedef in the scope of the struct, causing  
warnings and possibly other problems.  
  
Reviewed-by: Andres Freund <[email protected]>  

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

Clean up psql/describe.c's messy query for extended stats.

commit   : 20c95f27e736837b4af6bef998cb9408d1ad902e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Apr 2017 13:21:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Apr 2017 13:21:40 -0400    

Click here for diff

Remove unnecessary casts, safely schema-qualify the ones that remain,  
lose an unnecessary level of sub-SELECT, reformat for tidiness.  

M src/bin/psql/describe.c

Fix mixup of bool and ternary value

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

Click here for diff

Not currently a problem, but could be with stricter bool behavior under  
stdbool or C++.  
  
Reviewed-by: Andres Freund <[email protected]>  

M src/backend/access/gin/ginscan.c
M src/include/access/gin_private.h

doc: Formatting fix for XSL-FO PDF build

commit   : a071fe87a21920e5c2e79d521d31b2ddaf83875b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 6 Apr 2017 12:27:45 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 6 Apr 2017 12:27:45 -0400    

Click here for diff

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

Fix AclResult vs bool type mix-up

commit   : 301ca0d9a2f82ade11b2e5039d348badd28334cf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 6 Apr 2017 11:31:18 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 6 Apr 2017 11:31:18 -0400    

Click here for diff

Using AclResult as a bool or vice versa works by accident, but it's  
unusual and possibly confusing style, so write it out more explicitly.  

M contrib/pgrowlocks/pgrowlocks.c

Comment fixes for extended statistics

commit   : b1fc51a36ecdf854be9e41ffb99953c40ef96ccf    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 6 Apr 2017 12:27:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 6 Apr 2017 12:27:15 -0300    

Click here for diff

Clean up some code comments in new extended statistics code, from  
7b504eb282.  

M src/backend/optimizer/util/plancat.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/cache/relcache.c
M src/include/nodes/relation.h

Fix compiler warning and add some more comments

commit   : dc0400cc501ebe839c15a387911945d1585e4787    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 6 Apr 2017 11:17:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 6 Apr 2017 11:17:43 -0400    

Click here for diff

M src/backend/commands/tablecmds.c

Remove bogus SCRAM_ITERATION_LEN constant.

commit   : 07044efe00762bdd04c4d392adb8f6425b13369b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Apr 2017 17:41:48 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Apr 2017 17:41:48 +0300    

Click here for diff

It was not used for what the comment claimed, at all. It was actually used  
as the 'base' argument to strtol(), when reading the iteration count. We  
don't need a constant for base-10, so remove it.  

M src/backend/libpq/auth-scram.c
M src/include/common/scram-common.h
M src/interfaces/libpq/fe-auth-scram.c

Always SnapshotResetXmin() during ClearTransaction()

commit   : cd0cebaf7d1ab04427d4045edf7121a8f3753d8b    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 6 Apr 2017 10:30:22 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 6 Apr 2017 10:30:22 -0400    

Click here for diff

Avoid corner cases during 2PC with 6bad580d9e678a0b604883e14d8401d469b06566  

M src/backend/access/transam/xact.c
M src/backend/utils/time/snapmgr.c
M src/include/utils/snapmgr.h

Identity columns

commit   : 3217327053638085d24dd4d276e7c1f7ac2c4c6b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 6 Apr 2017 08:33:16 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 6 Apr 2017 08:33:16 -0400    

Click here for diff

This is the SQL standard-conforming variant of PostgreSQL's serial  
columns.  It fixes a few usability issues that serial columns have:  
  
- CREATE TABLE / LIKE copies default but refers to same sequence  
- cannot add/drop serialness with ALTER TABLE  
- dropping default does not drop sequence  
- need to grant separate privileges to sequence  
- other slight weirdnesses because serial is some kind of special macro  
  
Reviewed-by: Vitaly Burovoy <[email protected]>  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/copy.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/insert.sgml
M src/backend/access/common/tupdesc.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/information_schema.sql
M src/backend/catalog/pg_depend.c
M src/backend/catalog/sql_features.txt
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.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/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/errcodes.txt
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_class.h
M src/include/commands/sequence.h
M src/include/executor/execExpr.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/utils/lsyscache.h
M src/test/regress/expected/create_table_like.out
A src/test/regress/expected/identity.out
M src/test/regress/expected/sequence.out
M src/test/regress/expected/truncate.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/create_table_like.sql
A src/test/regress/sql/identity.sql
M src/test/regress/sql/sequence.sql
M src/test/regress/sql/truncate.sql

Avoid SnapshotResetXmin() during AtEOXact_Snapshot()

commit   : 6bad580d9e678a0b604883e14d8401d469b06566    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 6 Apr 2017 08:31:52 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 6 Apr 2017 08:31:52 -0400    

Click here for diff

For normal commits and aborts we already reset PgXact->xmin,  
so we can simply avoid running SnapshotResetXmin() twice.  
  
During performance tests by Alexander Korotkov, diagnosis  
by Andres Freund showed PgXact array as a bottleneck. After  
manual analysis by me of the code paths that touch those  
memory locations, I was able to identify extraneous code  
in the main transaction commit path.  
  
Avoiding touching highly contented shmem improves concurrent  
performance slightly on all workloads, confirmed by tests  
run by Ashutosh Sharma and Alexander Korotkov.  
  
Simon Riggs  
  
Discussion: CANP8+jJdXE9b+b9F8CQT-LuxxO0PBCB-SZFfMVAdp+akqo4zfg@mail.gmail.com  

M src/backend/access/transam/xact.c
M src/backend/utils/time/snapmgr.c
M src/include/utils/snapmgr.h

Remove dead code and fix comments in fast-path function handling.

commit   : fd01983594b7d2119653428e3b532578008c7065    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Apr 2017 09:09:39 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Apr 2017 09:09:39 +0300    

Click here for diff

HandleFunctionRequest() is no longer responsible for reading the protocol  
message from the client, since commit 2b3a8b20c2. Fix the outdated  
comments.  
  
HandleFunctionRequest() now always returns 0, because the code that used  
to return EOF was moved in 2b3a8b20c2. Therefore, the caller no longer  
needs to check the return value.  
  
Reported by Andres Freund. Backpatch to all supported versions, even though  
this doesn't have any user-visible effect, to make backporting future  
patches in this area easier.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/tcop/fastpath.c
M src/backend/tcop/postgres.c
M src/include/tcop/fastpath.h

Code review for recent slot.c changes.

commit   : 5c21ad07cc06f00f96e9401209a7da839b326d3a    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2017 20:56:35 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2017 20:56:35 -0700    

Click here for diff

M src/backend/replication/slot.c

Fix integer-overflow problems in interval comparison.

commit   : df1a699e5ba3232f373790b2c9485ddf720c4a70    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Apr 2017 23:51:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Apr 2017 23:51:27 -0400    

Click here for diff

When using integer timestamps, the interval-comparison functions tried  
to compute the overall magnitude of an interval as an int64 number of  
microseconds.  As reported by Frazer McLean, this overflows for intervals  
exceeding about 296000 years, which is bad since we nominally allow  
intervals many times larger than that.  That results in wrong comparison  
results, and possibly in corrupted btree indexes for columns containing  
such large interval values.  
  
To fix, compute the magnitude as int128 instead.  Although some compilers  
have native support for int128 calculations, many don't, so create our  
own support functions that can do 128-bit addition and multiplication  
if the compiler support isn't there.  These support functions are designed  
with an eye to allowing the int128 code paths in numeric.c to be rewritten  
for use on all platforms, although this patch doesn't do that, or even  
provide all the int128 primitives that will be needed for it.  
  
Back-patch as far as 9.4.  Earlier releases did not guard against overflow  
of interval values at all (commit 146604ec4 fixed that), so it seems not  
very exciting to worry about overly-large intervals for them.  
  
Before 9.6, we did not assume that unreferenced "static inline" functions  
would not draw compiler warnings, so omit functions not directly referenced  
by timestamp.c, the only present consumer of int128.h.  (We could have  
omitted these functions in HEAD too, but since they were written and  
debugged on the way to the present patch, and they look likely to be needed  
by numeric.c, let's keep them in HEAD.)  I did not bother to try to prevent  
such warnings in a --disable-integer-datetimes build, though.  
  
Before 9.5, configure will never define HAVE_INT128, so the part of  
int128.h that exploits a native int128 implementation is dead code in the  
9.4 branch.  I didn't bother to remove it, thinking that keeping the file  
looking similar in different branches is more useful.  
  
In HEAD only, add a simple test harness for int128.h in src/tools/.  
  
In back branches, this does not change the float-timestamps code path.  
That's not subject to the same kind of overflow risk, since it computes  
the interval magnitude as float8.  (No doubt, when this code was originally  
written, overflow was disregarded for exactly that reason.)  There is a  
precision hazard instead :-(, but we'll avert our eyes from that question,  
since no complaints have been reported and that code's deprecated anyway.  
  
Kyotaro Horiguchi and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/timestamp.c
A src/include/common/int128.h
M src/test/regress/expected/interval.out
M src/test/regress/sql/interval.sql
A src/tools/testint128.c

Reduce lock level for CREATE STATISTICS

commit   : 68ea2b7f9b52d35b5fcd9c8d44d88de5a64be3ba    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 5 Apr 2017 18:22:32 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 5 Apr 2017 18:22:32 -0400    

Click here for diff

In line with other lock reductions related to planning.  
  
Simon Riggs  

M doc/src/sgml/mvcc.sgml
M src/backend/commands/statscmds.c

Collect and use multi-column dependency stats

commit   : 2686ee1b7ccfb9214064d4d2a98ea77382880306    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 5 Apr 2017 18:00:42 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 5 Apr 2017 18:00:42 -0400    

Click here for diff

Follow on patch in the multi-variate statistics patch series.  
  
CREATE STATISTICS s1 WITH (dependencies) ON (a, b) FROM t;  
ANALYZE;  
will collect dependency stats on (a, b) and then use the measured  
dependency in subsequent query planning.  
  
Commit 7b504eb282ca2f5104b5c00b4f05a3ef6bb1385b added  
CREATE STATISTICS with n-distinct coefficients. These are now  
specified using the mutually exclusive option WITH (ndistinct).  
  
Author: Tomas Vondra, David Rowley  
Reviewed-by: Kyotaro HORIGUCHI, Ɓlvaro Herrera, Dean Rasheed, Robert Haas  
and many other comments and contributions  
Discussion: https://postgr.es/m/[email protected]  

M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/planstats.sgml
M doc/src/sgml/ref/create_statistics.sgml
M src/backend/catalog/system_views.sql
M src/backend/commands/statscmds.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/plancat.c
M src/backend/statistics/Makefile
M src/backend/statistics/README
A src/backend/statistics/README.dependencies
A src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/bin/psql/describe.c
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_type.h
M src/include/optimizer/cost.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/stats_ext.sql

Allow --with-wal-segsize=n up to n=1024MB

commit   : 00b6b6feb12cef53737287b67ecef6aff1f1d8ab    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 5 Apr 2017 15:38:17 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 5 Apr 2017 15:38:17 -0400    

Click here for diff

Other part of Beena Emerson's patch to allow testing  

M configure
M configure.in
M doc/src/sgml/installation.sgml

Spelling mistake in comment in utility.c

commit   : ed770c325ca374fee7b3b66f5cb29af1a73a1743    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 5 Apr 2017 14:29:29 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 5 Apr 2017 14:29:29 -0400    

Click here for diff

M src/backend/tcop/utility.c

Fix pageinspect failures on hash indexes.

commit   : 633e15ea0f1bf2e1d70441fe9da8781befebd6e9    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 5 Apr 2017 14:17:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 5 Apr 2017 14:17:23 -0400    

Click here for diff

Make every page in a hash index which isn't all-zeroes have a valid  
special space, so that tools like pageinspect don't error out.  
  
Also, make pageinspect cope with all-zeroes pages, because  
_hash_alloc_buckets can leave behind large numbers of those until  
they're consumed by splits.  
  
Ashutosh Sharma and Robert Haas, reviewed by Amit Kapila.  
Original trouble report from Jeff Janes.  
  
Discussion: http://postgr.es/m/CAMkU=1y6NjKmqbJ8wLMhr=F74WzcMALYWcVFhEpm7i=mV=XsOg@mail.gmail.com  

M contrib/pageinspect/hashfuncs.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c

Use American English in error message

commit   : 6785fbd60ffd82ef825baf6db34bd944f3c7b121    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2017 14:06:15 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2017 14:06:15 -0400    

Click here for diff

All error messages use the American English spelling of recognize,  
apply to the single one not doing so to be consistent.  
  
Author: Daniel Gustafsson <[email protected]>  

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

doc: Remove remark elements

commit   : 63e5d02af33414ab31d0d59e02333083ac696d37    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2017 13:18:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2017 13:18:32 -0400    

Click here for diff

They were not rendered with DSSSL, but now they show up by default using  
XSLT.  Just remove them, since they are not useful.  

M doc/src/sgml/dml.sgml
M doc/src/sgml/ecpg.sgml

hash: Fix write-ahead logging bug.

commit   : 75a1cbdc3cfca1e815da6dfa5d7e96d82a6b0725    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 5 Apr 2017 11:45:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 5 Apr 2017 11:45:35 -0400    

Click here for diff

The size of the data is not the same thing as the size of the size of  
the data.  
  
Reported off-list by Tushar Ahuja.  Fix by Ashutosh Sharma, reviewed  
by Amit Kapila.  
  
Discussion: http://postgr.es/m/CAE9k0PnmPDXfvf8HDObme7q_Ewc4E26ukHXUBPySoOs0ObqqaQ@mail.gmail.com  

M src/backend/access/hash/hash.c

Add isolation test for SERIALIZABLE READ ONLY DEFERRABLE.

commit   : 4deb413813f619b3e859abf435b61efc09cafe09    
  
author   : Kevin Grittner <[email protected]>    
date     : Wed, 5 Apr 2017 10:04:36 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Wed, 5 Apr 2017 10:04:36 -0500    

Click here for diff

This improves code coverage and lays a foundation for testing  
similar issues in a distributed environment.  
  
Author: Thomas Munro <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

A src/test/isolation/expected/read-only-anomaly-2.out
A src/test/isolation/expected/read-only-anomaly-3.out
A src/test/isolation/expected/read-only-anomaly.out
M src/test/isolation/isolation_schedule
M src/test/isolation/isolationtester.c
A src/test/isolation/specs/read-only-anomaly-2.spec
A src/test/isolation/specs/read-only-anomaly-3.spec
A src/test/isolation/specs/read-only-anomaly.spec

commit   : e59b74a3fc524a658172d9ec9f1728da89136bce    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2017 09:03:11 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2017 09:03:11 -0400    

Click here for diff

suggested by Tom Lane  

M contrib/dblink/dblink.c

Capitalize names of PLs consistently

commit   : afd79873a0b151bfbe5312acebfe361da09c11fd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2017 00:38:25 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2017 00:38:25 -0400    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/parallel.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/release-7.4.sgml
M doc/src/sgml/release-8.0.sgml
M doc/src/sgml/release-8.1.sgml
M doc/src/sgml/release-8.2.sgml
M doc/src/sgml/release-8.3.sgml
M doc/src/sgml/release-8.4.sgml
M doc/src/sgml/release-9.4.sgml
M doc/src/sgml/release-old.sgml
M doc/src/sgml/xfunc.sgml
M src/backend/access/transam/README.parallel
M src/backend/executor/spi.c
M src/backend/parser/gram.y
M src/bin/initdb/initdb.c
M src/include/parser/scanner.h
M src/pl/plpgsql/src/Makefile
M src/pl/plpgsql/src/pl_gram.y
M src/pl/tcl/Makefile
M src/pl/tcl/pltcl.c

pageinspect: Add bt_page_items function with bytea argument

commit   : 193f5f9e913f3ead6609cc99be82578e0dedd409    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 4 Apr 2017 23:48:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 4 Apr 2017 23:48:49 -0400    

Click here for diff

Author: Tomas Vondra <[email protected]>  
Reviewed-by: Ashutosh Sharma <[email protected]>  

M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/expected/btree.out
M contrib/pageinspect/pageinspect–1.5–1.6.sql
M contrib/pageinspect/sql/btree.sql
M doc/src/sgml/pageinspect.sgml
M src/include/access/nbtree.h

Follow-on cleanup for the transition table patch.

commit   : 5ebeb579b9b281dba5f8415b2fbda86fdae7b366    
  
author   : Kevin Grittner <[email protected]>    
date     : Tue, 4 Apr 2017 18:36:39 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Tue, 4 Apr 2017 18:36:39 -0500    

Click here for diff

Commit 59702716 added transition table support to PL/pgsql so that  
SQL queries in trigger functions could access those transient  
tables.  In order to provide the same level of support for PL/perl,  
PL/python and PL/tcl, refactor the relevant code into a new  
function SPI_register_trigger_data.  Call the new function in the  
trigger handler of all four PLs, and document it as a public SPI  
function so that authors of out-of-tree PLs can do the same.  
  
Also get rid of a second QueryEnvironment object that was  
maintained by PL/pgsql.  That was previously used to deal with  
cursors, but the same approach wasn't appropriate for PLs that are  
less tangled up with core code.  Instead, have SPI_cursor_open  
install the connection's current QueryEnvironment, as already  
happens for SPI_execute_plan.  
  
While in the docs, remove the note that transition tables were only  
supported in C and PL/pgSQL triggers, and correct some ommissions.  
  
Thomas Munro with some work by Kevin Grittner (mostly docs)  

M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/spi.sgml
M doc/src/sgml/trigger.sgml
M src/backend/executor/spi.c
M src/include/executor/spi.h
M src/pl/plperl/expected/plperl_trigger.out
M src/pl/plperl/plperl.c
M src/pl/plperl/sql/plperl_trigger.sql
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/expected/plpython_trigger.out
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/sql/plpython_trigger.sql
M src/pl/tcl/expected/pltcl_queries.out
M src/pl/tcl/pltcl.c
M src/pl/tcl/sql/pltcl_queries.sql

Make min_wal_size/max_wal_size use MB internally

commit   : 9a3215026bd6955e88bd8c20542cfe6acffdb1c8    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 4 Apr 2017 18:00:01 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 4 Apr 2017 18:00:01 -0400    

Click here for diff

Previously they were defined using multiples of XLogSegSize.  
Remove GUC_UNIT_XSEGS. Introduce GUC_UNIT_MB  
  
Extracted from patch series on XLogSegSize infrastructure.  
  
Beena Emerson  

M src/backend/access/transam/xlog.c
M src/backend/utils/misc/guc.c
M src/include/access/xlog.h
M src/include/utils/guc.h

Fix uninitialized variables in twophase.c

commit   : cd740c0dbfb3038eea2e921e82e2f5345d0718c5    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 4 Apr 2017 17:50:02 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 4 Apr 2017 17:50:02 -0400    

Click here for diff

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

Force synchronous commit in new-ish test_decoding test.

commit   : bae9b8016053c0a434690add7049a9216afef7e2    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2017 14:38:00 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2017 14:38:00 -0700    

Click here for diff

This was missed in a924c327 ff.  

M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/sql/slot.sql

Fix two valgrind issues in slab allocator.

commit   : 490e9a98ff964df95311e2b5a68a15f63bce0cfd    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2017 14:26:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2017 14:26:42 -0700    

Click here for diff

During allocation VALGRIND_MAKE_MEM_DEFINED was called with a pointer  
as size. That kind of works, but makes valgrind exceedingly slow for  
workloads involving the slab allocator.  
  
Secondly there was an access to memory marked as unreachable within  
SlabCheck(). Fix that too.  
  
Author: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/slab.c

Clarify documentation of to_tsvector(json(b))

commit   : e75a78656bcaa3faff6b85891ca69d45dd21023f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 4 Apr 2017 16:50:13 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 4 Apr 2017 16:50:13 -0400    

Click here for diff

Per gripe from Sven R. Kunze  

M doc/src/sgml/func.sgml

Speedup 2PC recovery by skipping two phase state files in normal path

commit   : 728bd991c3c4389fb39c45dcb0fe57e4a1dccd71    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 4 Apr 2017 15:56:56 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 4 Apr 2017 15:56:56 -0400    

Click here for diff

2PC state info held in shmem at PREPARE, then cleaned at COMMIT PREPARED/ABORT PREPARED,  
avoiding writing/fsyncing any state information to disk in the normal path, greatly enhancing replay speed.  
Prepared transactions that live past one checkpoint redo horizon will be written to disk as now.  
Similar conceptually to 978b2f65aa1262eb4ecbf8b3785cb1b9cf4db78e and building upon  
the infrastructure created by that commit.  
  
Authors, in equal measure: Stas Kelvich, Nikhil Sontakke and Michael Paquier  
Discussion: https://postgr.es/m/CAMGcDxf8Bn9ZPBBJZba9wiyQq-Qk5uqq=VjoMnRnW5s+fKST3w@mail.gmail.com  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/include/access/twophase.h

Adjust min/max values when changing sequence type

commit   : 60a0b2ec8943451186dfa22907f88334d97cb2e0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 4 Apr 2017 12:36:15 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 4 Apr 2017 12:36:15 -0400    

Click here for diff

When changing the type of a sequence, adjust the min/max values of the  
sequence if it looks like the previous values were the default values.  
Previously, it would leave the old values in place, requiring manual  
adjustments even in the usual/default cases.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Vitaly Burovoy <[email protected]>  

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

Fix thinko in BitmapAdjustPrefetchIterator.

commit   : a9a7949134189c29a9b38ac7394c53849684fe4d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 4 Apr 2017 09:03:41 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 4 Apr 2017 09:03:41 -0400    

Click here for diff

Dilip Kumar  
  
Discussion: http://postgr.es/m/CAFiTN-uKAvRhWprb0i-U9zFOekgQRRwqjP1wvOBsKZb-UEKbug@mail.gmail.com  

M src/backend/executor/nodeBitmapHeapscan.c

Fix typo

commit   : d1f103c7396b667e64141412a8a0d12a2eef2930    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 4 Apr 2017 09:03:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 4 Apr 2017 09:03:24 -0400    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

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

psql: Add some missing tab completion

commit   : 553c3bef4cb47bdacb65b87c5460a2775f535a2b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 4 Apr 2017 08:58:21 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 4 Apr 2017 08:58:21 -0400    

Click here for diff

Add tab completion for COMMENT/SECURITY LABEL ON  
PUBLICATION/SUBSCRIPTION.  
  
Reported-by: Stephen Frost <[email protected]>  

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

Remove --verbose from PROVE_FLAGS

commit   : e9c81b6016f431af808e4c08191e7aecf034dc80    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 4 Apr 2017 08:42:09 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 4 Apr 2017 08:42:09 -0400    

Click here for diff

Per discussion, the TAP tests are really more verbose than necessary, so  
remove the --verbose flag from PROVE_FLAGS.  Also add comments to let  
folks know how they can enable it if they really wish to, as suggested  
by Craig Ringer.  
  
Author: Michael Paquier, additional comments by me.  
Discussion: https://postgr.es/m/CAMsr%2BYGAzcMDOZ_BirnMCL6Sb%3DMUjP0FRE82YBDSbXcf6pm9Yg%40mail.gmail.com  

M src/Makefile.global.in
M src/test/perl/README

Fix remote position tracking in logical replication

commit   : fe7bbc4ddb82c635ef08b5eadc5ce472ad515996    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 4 Apr 2017 08:24:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 4 Apr 2017 08:24:32 -0400    

Click here for diff

We need to set the origin remote position to end_lsn, not commit_lsn, as  
commit_lsn is the start of commit record, and we use the origin remote  
position as start position when restarting replication stream.  If we'd  
use commit_lsn, we could request data that we already received from the  
remote server after a crash of a downstream server.  
  
Author: Petr Jelinek <[email protected]>  

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

Fix formula in _hash_spareindex.

commit   : b38006ef6d1ba2f56cc4962ed17956b74c9fa0c4    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 4 Apr 2017 07:42:05 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 4 Apr 2017 07:42:05 -0400    

Click here for diff

This was correct in earlier versions of the patch that lead to  
commit ea69a0dead5128c421140dc53fac165ba4af8520, but somehow got  
broken in the last version which I actually committed.  
  
Mithun Cy, per an off-list report from Ashutosh Sharma  
  
Discussion: http://postgr.es/m/CAD__OujbAwNU71v1y-RoQxZ8LZ6-V2UFTkex3v34MK6uZ3Xb5w@mail.gmail.com  

M src/backend/access/hash/hashutil.c

Expand hash indexes more gradually.

commit   : ea69a0dead5128c421140dc53fac165ba4af8520    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 3 Apr 2017 23:46:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 3 Apr 2017 23:46:33 -0400    

Click here for diff

Since hash indexes typically have very few overflow pages, adding a  
new splitpoint essentially doubles the on-disk size of the index,  
which can lead to large and abrupt increases in disk usage (and  
perhaps long delays on occasion).  To mitigate this problem to some  
degree, divide larger splitpoints into four equal phases.  This means  
that, for example, instead of growing from 4GB to 8GB all at once, a  
hash index will now grow from 4GB to 5GB to 6GB to 7GB to 8GB, which  
is perhaps still not as smooth as we'd like but certainly an  
improvement.  
  
This changes the on-disk format of the metapage, so bump HASH_VERSION  
from 2 to 3.  This will force a REINDEX of all existing hash indexes,  
but that's probably a good idea anyway.  First, hash indexes from  
pre-10 versions of PostgreSQL could easily be corrupted, and we don't  
want to confuse corruption carried over from an older release with any  
corruption caused despite the new write-ahead logging in v10.  Second,  
it will let us remove some backward-compatibility code added by commit  
293e24e507838733aba4748b514536af2d39d7f2.  
  
Mithun Cy, reviewed by Amit Kapila, Jesper Pedersen and me.  Regression  
test outputs updated by me.  
  
Discussion: http://postgr.es/m/CAD__OuhG6F1gQLCgMQNnMNgoCvOLQZz9zKYJQNYvYmmJoM42gA@mail.gmail.com  
Discussion: http://postgr.es/m/CA+TgmoYty0jCf-pa+m+vYUJ716+AxM7nv_syvyanyf5O-L_i2A@mail.gmail.com  

M contrib/pageinspect/expected/hash.out
M contrib/pgstattuple/expected/pgstattuple.out
M doc/src/sgml/pageinspect.sgml
M src/backend/access/hash/README
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsort.c
M src/backend/access/hash/hashutil.c
M src/backend/utils/sort/tuplesort.c
M src/include/access/hash.h
M src/include/utils/tuplesort.h

Further corrections and improvements to partitioning documentation.

commit   : 334bf9c77d0630c65d83f59b42b007cf9523cacf    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 3 Apr 2017 23:10:16 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 3 Apr 2017 23:10:16 -0400    

Click here for diff

Amit Langote  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Update comment.

commit   : c8b5c3cb06addfb11d38a85fd8ac7efabb56e811    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 3 Apr 2017 23:07:31 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 3 Apr 2017 23:07:31 -0400    

Click here for diff

Craig Ringer, reviewed by me.  

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

Print new RelOptInfo field top_parent_relids in outfuncs.c

commit   : 7cdf6668cf37f48808604906882f6131d3fef251    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 3 Apr 2017 23:06:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 3 Apr 2017 23:06:36 -0400    

Click here for diff

I intended to include this adjustment in the previous commit  
(7a39b5e4d11229ece930a51fd7cb29e535db44940) but messed up.  

M src/backend/nodes/outfuncs.c

Abstract logic to allow for multiple kinds of child rels.

commit   : 7a39b5e4d11229ece930a51fd7cb29e535db4494    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 3 Apr 2017 22:41:31 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 3 Apr 2017 22:41:31 -0400    

Click here for diff

Currently, the only type of child relation is an "other member rel",  
which is the child of a baserel, but in the future joins and even  
upper relations may have child rels.  To facilitate that, introduce  
macros that test to test for particular RelOptKind values, and use  
them in various places where they help to clarify the sense of a test.  
(For example, a test may allow RELOPT_OTHER_MEMBER_REL either because  
it intends to allow child rels, or because it intends to allow simple  
rels.)  
  
Also, remove find_childrel_top_parent, which will not work for a  
child rel that is not a baserel.  Instead, add a new RelOptInfo  
member top_parent_relids to track the same kind of information in a  
more generic manner.  
  
Ashutosh Bapat, slightly tweaked by me.  Review and testing of the  
patch set from which this was taken by Rajkumar Raghuwanshi and Rafia  
Sabih.  
  
Discussion: http://postgr.es/m/CA+TgmoagTnF2yqR3PT2rv=om=wJiZ4-A+ATwdnriTGku1CLYxA@mail.gmail.com  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/foreign/foreign.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/backend/utils/adt/selfuncs.c
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h

Properly acquire buffer lock for page-at-a-time hash vacuum.

commit   : 93cd7684ee2bba227fa371daa81b88f25456dcb2    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 3 Apr 2017 22:24:17 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 3 Apr 2017 22:24:17 -0400    

Click here for diff

In a couple of places, _hash_kill_items was mistakenly called with  
the buffer lock not held.  Repair.  
  
Ashutosh Sharma, per a report from Andreas Seltenreich  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/access/hash/hash.c

Try and silence spurious Coverity warning.

commit   : f5780935266bd72951c770396f9267366414d1b9    
  
author   : Andrew Gierth <[email protected]>    
date     : Mon, 3 Apr 2017 23:30:24 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Mon, 3 Apr 2017 23:30:24 +0100    

Click here for diff

gset_data (aka gd) in planner.c is always non-null if and only if  
parse->groupingSets is non-null, but Coverity doesn't know that and  
complains.  Feed it an assertion to see if that keeps it happy.  

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

Make header self-contained

commit   : 9fa6e08d4a16f9b0461743cff35781e16308c106    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 3 Apr 2017 16:17:45 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 3 Apr 2017 16:17:45 -0400    

Click here for diff

Add necessary include files for things used in the header.  

M src/include/postmaster/autovacuum.h

Fix whitespace

commit   : 8df9994bc3372fc54214932bfa3a5caa05783ffa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 3 Apr 2017 11:12:48 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 3 Apr 2017 11:12:48 -0400    

Click here for diff

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

Handle change of slot name in logical replication apply

commit   : 1116108c926820030bd18b5dbff9163c14e3ad6d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 3 Apr 2017 11:10:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 3 Apr 2017 11:10:28 -0400    

Click here for diff

Since change of slot name is a supported operation, handle it more  
gracefully, instead of in the this-should-not-happen way.  
  
Author: Petr Jelinek <[email protected]>  

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

doc: Change xref style to number only

commit   : 70da87d334ebe14fbbefe98827df5a8e1400444e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 3 Apr 2017 10:50:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 3 Apr 2017 10:50:32 -0400    

Click here for diff

Change the style of links generated by xrefs to section number only, as  
it was with DSSSL, instead of number and title, as is the default of the  
XSLT stylesheets.  
  
Our documentation is mostly written expecting the old style, so keep  
that for the time being, per discussion.  

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

Remove reinvention of stringify macro.

commit   : cd6baed78150e107eb858dbd53ddf900dd429f50    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Apr 2017 19:19:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Apr 2017 19:19:16 -0400    

Click here for diff

We already have CppAsString2, there's no need for the MSVC support to  
re-invent a macro to do that (and especially not to inject it in as  
ugly a way as this).  
  
Discussion: https://postgr.es/m/CADkLM=c+hm2rc0tkKgC-ZgrLttHT2KkfppE+BC-=i-xj+7V-TQ@mail.gmail.com  

M src/tools/msvc/Solution.pm

Doc: clarify behavior of OT_WHOLE_LINE and OT_FILEPIPE psql slash commands.

commit   : ffac5998b4c18920f86d80f1bddbde9ebcf0a314    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Apr 2017 19:01:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Apr 2017 19:01:53 -0400    

Click here for diff

This is another bit of ancient behavior that was documented poorly (in  
a couple of cases) or not at all (in several others).  
  
Discussion: https://postgr.es/m/[email protected]  

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

Document psql's behavior of recalling the previously executed query.

commit   : 68dba97a4dea5c5c915e31978a475107c17c458d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Apr 2017 18:26:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Apr 2017 18:26:37 -0400    

Click here for diff

Various psql slash commands that normally act on the current query buffer  
will automatically recall and re-use the most recently executed SQL command  
instead, if the current query buffer is empty.  Although this behavior is  
ancient (dating apparently to commit 77a472993), it was documented nowhere  
in the psql reference page.  For that matter, we'd never bothered to define  
the concept of "current query buffer" explicitly.  Fix that.  Do some  
wordsmithing on relevant command descriptions to improve clarity and  
consistency.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix behavior of psql's \p to agree with \g, \w, etc.

commit   : 5dbc5da1187c1ddb6e091047194d364337ebf232    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Apr 2017 16:50:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Apr 2017 16:50:25 -0400    

Click here for diff

In commit e984ef586 I (tgl) simplified the behavior of \p to just print  
the current query buffer; but Daniel VƩritƩ points out that this made it  
inconsistent with the behavior of \g and \w.  It should print the same  
thing \g would execute.  Fix that, and improve related comments.  
  
Daniel VƩritƩ  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix some typos and spelling errors in comments

commit   : 130ae4a5478b3b3965779ece1436fa3611aa957f    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 2 Apr 2017 19:55:28 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 2 Apr 2017 19:55:28 +0200    

Click here for diff

Author: Erik Rijkers  

M src/backend/replication/walsender.c

Allow psql variable substitution to occur in backtick command strings.

commit   : f833c847b8fa4782efab45c8371d3cee64292d9b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Apr 2017 21:44:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Apr 2017 21:44:54 -0400    

Click here for diff

Previously, text between backquotes in a psql metacommand's arguments  
was always passed to the shell literally.  That considerably hobbles  
the usefulness of the feature for scripting, so we'd foreseen for a long  
time that we'd someday want to allow substitution of psql variables into  
the shell command.  IMO the addition of \if metacommands has brought us to  
that point, since \if can greatly benefit from some sort of client-side  
expression evaluation capability, and psql itself is not going to grow any  
such thing in time for v10.  Hence, this patch.  It allows :VARIABLE to be  
replaced by the exact contents of the named variable, while :'VARIABLE'  
is replaced by the variable's contents suitably quoted to become a single  
shell-command argument.  (The quoting rules for that are different from  
those for SQL literals, so this is a bit of an abuse of the :'VARIABLE'  
notation, but I doubt anyone will be confused.)  
  
As with other situations in psql, no substitution occurs if the word  
following a colon is not a known variable name.  That limits the risk of  
compatibility problems for existing psql scripts; but the risk isn't zero,  
so this needs to be called out in the v10 release notes.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/psqlscanslash.l
M src/fe_utils/psqlscan.l
M src/fe_utils/string_utils.c
M src/include/fe_utils/psqlscan.h
M src/include/fe_utils/psqlscan_int.h
M src/include/fe_utils/string_utils.h

Fix two undocumented parameters to functions from ENR patch.

commit   : 41bd155dd656e7f17c02855be7aff234843347cd    
  
author   : Kevin Grittner <[email protected]>    
date     : Sat, 1 Apr 2017 15:21:05 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Sat, 1 Apr 2017 15:21:05 -0500    

Click here for diff

On ProcessUtility document the parameter, to match others.  
  
On CreateCachedPlan drop the queryEnv parameter.  It was not  
referenced within the function, and had been added on the  
assumption that with some unknown future usage of QueryEnvironment  
it might be useful to do something there.  We have avoided other  
"just in case" implementation of unused paramters, so drop it here.  
  
Per gripe from Tom Lane  

M src/backend/commands/prepare.c
M src/backend/executor/spi.c
M src/backend/tcop/postgres.c
M src/backend/tcop/utility.c
M src/backend/utils/cache/plancache.c
M src/include/utils/plancache.h

BRIN de-summarization

commit   : c655899ba9ae2a0d24e99c797167c33e0cfa0820    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 1 Apr 2017 16:10:04 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 1 Apr 2017 16:10:04 -0300    

Click here for diff

When the BRIN summary tuple for a page range becomes too "wide" for the  
values actually stored in the table (because the tuples that were  
present originally are no longer present due to updates or deletes), it  
can be useful to remove the outdated summary tuple, so that a future  
summarization can install a tighter summary.  
  
This commit introduces a SQL-callable interface to do so.  
  
Author: Ɓlvaro Herrera  
Reviewed-by: Eiji Seki  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/brin.sgml
M doc/src/sgml/func.sgml
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/rmgrdesc/brindesc.c
M src/include/access/brin_revmap.h
M src/include/access/brin_xlog.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/brin.out
M src/test/regress/sql/brin.sql

Fix expected output

commit   : 3a82129a40a3a2987356d4051e017fd456876c8d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 1 Apr 2017 16:00:11 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 1 Apr 2017 16:00:11 -0300    

Click here for diff

Previous commit had a thinko in the expected output for new tests.  
  
Per buildfarm  

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

BRIN auto-summarization

commit   : 7526e10224f0792201e99631567bbe44492bbde4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 1 Apr 2017 14:00:53 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 1 Apr 2017 14:00:53 -0300    

Click here for diff

Previously, only VACUUM would cause a page range to get initially  
summarized by BRIN indexes, which for some use cases takes too much time  
since the inserts occur.  To avoid the delay, have brininsert request a  
summarization run for the previous range as soon as the first tuple is  
inserted into the first page of the next range.  Autovacuum is in charge  
of processing these requests, after doing all the regular vacuuming/  
analyzing work on tables.  
  
This doesn't impose any new tasks on autovacuum, because autovacuum was  
already in charge of doing summarizations.  The only actual effect is to  
change the timing, i.e. that it occurs earlier.  For this reason, we  
don't go any great lengths to record these requests very robustly; if  
they are lost because of a server crash or restart, they will happen at  
a later time anyway.  
  
Most of the new code here is in autovacuum, which can now be told about  
"work items" to process.  This can be used for other things such as GIN  
pending list cleaning, perhaps visibility map bit setting, both of which  
are currently invoked during vacuum, but do not really depend on vacuum  
taking place.  
  
The requests are at the page range level, a granularity for which we did  
not have SQL-level access; we only had index-level summarization  
requests via brin_summarize_new_values().  It seems reasonable to add  
SQL-level access to range-level summarization too, so add a function  
brin_summarize_range() to do that.  
  
Authors: Ɓlvaro Herrera, based on sketch from Simon Riggs.  
Reviewed-by: Thomas Munro.  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/brin.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/create_index.sgml
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/common/reloptions.c
M src/backend/postmaster/autovacuum.c
M src/include/access/brin.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/postmaster/autovacuum.h
M src/test/regress/expected/brin.out
M src/test/regress/sql/brin.sql

Write "waiting for checkpoint" on regular progress row

commit   : 7220c7b3e5c847227fbfe53bbaca326044674a6c    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 1 Apr 2017 17:04:14 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 1 Apr 2017 17:04:14 +0200    

Click here for diff

When reporting progress, make the "waiting for checkpoint" test be  
overwritten by the file-based progress once it's completed. This is more  
consistent with how we report the rest of the progress.  
  
Suggested by Jeff Janes  

M src/bin/pg_basebackup/pg_basebackup.c

Try to fix breakage of sepgsql hooks by ENR patch.

commit   : 01fd6f8f2d15a9369768921d6fc95ac481779430    
  
author   : Kevin Grittner <[email protected]>    
date     : Sat, 1 Apr 2017 00:10:12 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Sat, 1 Apr 2017 00:10:12 -0500    

Click here for diff

Turned up by buildfarm animal rhinoceros.  Fixing blind.  Will have  
to wait for next run by rhinoceros to know whether it worked.  

M contrib/sepgsql/hooks.c

Add transition table support to plpgsql.

commit   : 59702716324ab9c07b02fb005dcf14c7f48c4632    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 31 Mar 2017 23:30:08 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 31 Mar 2017 23:30:08 -0500    

Click here for diff

Kevin Grittner and Thomas Munro  
Reviewed by Heikki Linnakangas, David Fetter, and Thomas Munro  
with valuable comments and suggestions from many others  

M doc/src/sgml/ref/create_trigger.sgml
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/test/regress/expected/plpgsql.out
M src/test/regress/expected/triggers.out
M src/test/regress/sql/plpgsql.sql
M src/test/regress/sql/triggers.sql

Add infrastructure to support EphemeralNamedRelation references.

commit   : 18ce3a4ab22d2984f8540ab480979c851dae5338    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 31 Mar 2017 23:17:18 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 31 Mar 2017 23:17:18 -0500    

Click here for diff

A QueryEnvironment concept is added, which allows new types of  
objects to be passed into queries from parsing on through  
execution.  At this point, the only thing implemented is a  
collection of EphemeralNamedRelation objects -- relations which  
can be referenced by name in queries, but do not exist in the  
catalogs.  The only type of ENR implemented is NamedTuplestore, but  
provision is made to add more types fairly easily.  
  
An ENR can carry its own TupleDesc or reference a relation in the  
catalogs by relid.  
  
Although these features can be used without SPI, convenience  
functions are added to SPI so that ENRs can easily be used by code  
run through SPI.  
  
The initial use of all this is going to be transition tables in  
AFTER triggers, but that will be added to each PL as a separate  
commit.  
  
An incidental effect of this patch is to produce a more informative  
error message if an attempt is made to modify the contents of a CTE  
from a referencing DML statement.  No tests previously covered that  
possibility, so one is added.  
  
Kevin Grittner and Thomas Munro  
Reviewed by Heikki Linnakangas, David Fetter, and Thomas Munro  
with valuable comments and suggestions from many others  

M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/spi.sgml
M src/backend/catalog/pg_proc.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/matview.c
M src/backend/commands/prepare.c
M src/backend/commands/schemacmds.c
M src/backend/commands/trigger.c
M src/backend/commands/view.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
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
A src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/spi.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/print.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.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/prep/prepjointree.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/backend/parser/Makefile
M src/backend/parser/analyze.c
M src/backend/parser/parse_clause.c
A src/backend/parser/parse_enr.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/misc/Makefile
A src/backend/utils/misc/queryenvironment.c
M src/backend/utils/sort/tuplestore.c
M src/include/catalog/catversion.h
M src/include/commands/createas.h
M src/include/commands/explain.h
M src/include/commands/prepare.h
M src/include/executor/execdesc.h
A src/include/executor/nodeNamedtuplestorescan.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.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/optimizer/pathnode.h
M src/include/parser/analyze.h
A src/include/parser/parse_enr.h
M src/include/parser/parse_node.h
M src/include/parser/parse_relation.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
A src/include/utils/queryenvironment.h
M src/include/utils/tuplestore.h
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

Avoid GatherMerge crash when there are no workers.

commit   : 25dc142a49c60c3107480c487cd8444dc83f9bdf    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 21:15:05 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 21:15:05 -0400    

Click here for diff

It's unnecessary to return an actual slot when we have no tuple.  
We can just return NULL, which avoids the risk of indexing into an  
array that might not contain any elements.  
  
Rushabh Lathia, per a report from Tomas Vondra  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/executor/nodeGatherMerge.c

Fix parallel query so it doesn't spoil row estimates above Gather.

commit   : 7d8f6986b83c9a56f6ea11c959cdd8f52e1b543d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 21:01:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 21:01:20 -0400    

Click here for diff

Commit 45be99f8cd5d606086e0a458c9c72910ba8a613d removed GatherPath's  
num_workers field, but this is entirely bogus.  Normally, a path's  
parallel_workers flag is supposed to indicate the number of workers  
that it wants, and should be 0 for a non-partial path.  In that  
commit, I mistakenly thought that GatherPath could also use that field  
to indicate the number of workers that it would try to start, but  
that's disastrous, because then it can propagate up to higher nodes in  
the plan tree, which will then get incorrect rowcounts because the  
parallel_workers flag is involved in computing those values.  Repair  
by putting the separate field back.  
  
Report by Tomas Vondra.  Patch by me, reviewed by Amit Kapila.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/relation.h

Don't use bgw_main even to specify in-core bgworker entrypoints.

commit   : 2113ac4cbb12b815804e8873d761cade9ddf49b9    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 20:35:51 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 20:35:51 -0400    

Click here for diff

On EXEC_BACKEND builds, this can fail if ASLR is in use.  
  
Backpatch to 9.5.  On master, completely remove the bgw_main field  
completely, since there is no situation in which it is safe for an  
EXEC_BACKEND build.  On 9.6 and 9.5, leave the field intact to avoid  
breaking things for third-party code that doesn't care about working  
under EXEC_BACKEND.  Prior to 9.5, there are no in-core bgworker  
entrypoints.  
  
Petr Jelinek, reviewed by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/bgworker.sgml
M src/backend/access/transam/parallel.c
M src/backend/postmaster/bgworker.c
M src/backend/replication/logical/launcher.c
M src/include/access/parallel.h
M src/include/postmaster/bgworker.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/worker_spi/worker_spi.c

Fix unstable regression test result.

commit   : c281cd5fe178c946dc23eae4d4642be5ddbe3eb4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Mar 2017 20:29:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Mar 2017 20:29:30 -0400    

Click here for diff

Whoops, missed that same test was made for json as well as jsonb.  

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

Fix unstable regression test result.

commit   : f1a285e21111f4d4d0c3f428ce2b3ae9e7f162c2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Mar 2017 20:24:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Mar 2017 20:24:12 -0400    

Click here for diff

Commit e306df7f9 added a test case that depends on "the" being a  
stop word, which it is not in non-English locales.  Since the  
point of the test is to check stopword behavior, fix by forcibly  
selecting the 'english' configuration.  
  
Per buildfarm.  

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

Fix typos.

commit   : 9a12ad042d26ba085f8ef72d030699b6f3d43b01    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 20:17:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 20:17:47 -0400    

Click here for diff

Brandur Leach  

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

For foreign keys, check REFERENCES privilege only on the referenced table.

commit   : 64d4da511c012faff8ac309595620938a43c6817    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Mar 2017 18:11:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Mar 2017 18:11:25 -0400    

Click here for diff

We were requiring that the user have REFERENCES permission on both the  
referenced and referencing tables --- but this doesn't seem to have any  
support in the SQL standard, which says only that you need REFERENCES  
permission on the referenced table.  And ALTER TABLE ADD FOREIGN KEY has  
already checked that you own the referencing table, so the check could  
only fail if a table owner has revoked his own REFERENCES permission.  
Moreover, the symmetric interpretation of this permission is unintuitive  
and confusing, as per complaint from Paul Jungwirth.  So let's drop the  
referencing-side check.  
  
In passing, do a bit of wordsmithing on the GRANT reference page so that  
all the privilege types are described in similar fashion.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/grant.sgml
M src/backend/commands/tablecmds.c

Improve documentation for table partitioning.

commit   : 8f18a880a5f138d4da94173d15514142331f8de6    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 17:33:34 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 17:33:34 -0400    

Click here for diff

Emphasize the new declarative partitioning more, and compare and  
contrast it more clearly with inheritance-based partitioning.  
  
Amit Langote, reviewed and somewhat revised by me  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Revert "Allow ON CONFLICT .. DO NOTHING on a partitioned table."

commit   : f05230752d53c4aa74cffa9b699983bbb6bcb118    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 16:47:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 16:47:38 -0400    

Click here for diff

This reverts commit 8355a011a0124bdf7ccbada206a967d427039553, which  
turns out to have been a misguided effort.  We can't really support  
this in a partitioning hierarchy after all for exactly the reasons  
stated in the documentation removed by that commit.  It's still  
possible to use ON CONFLICT .. DO NOTHING (or for that matter ON  
CONFLICT .. DO UPDATE) on individual partitions if desired, but  
but to allow this on a partitioned table implies that we have some  
way of evaluating uniqueness across the whole partitioning  
hierarchy, which is false.  
  
Shinoda Noriyoshi noticed that the old code was crashing (which we  
could fix, though not in a nice way) and Amit Langote realized  
that this was indicative of a fundamental problem with the commit  
being reverted here.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml
M src/backend/parser/analyze.c
M src/test/regress/expected/insert_conflict.out
M src/test/regress/sql/insert_conflict.sql

Don't allocate storage for partitioned tables.

commit   : c94e6942cefe7d20c5feed856e27f672734b1e2b    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 16:28:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 16:28:30 -0400    

Click here for diff

Also, don't allow setting reloptions on them, since that would have no  
effect given the lack of storage.  The patch does this by introducing  
a new reloption kind for which there are currently no reloptions -- we  
might have some in the future -- so it adjusts parseRelOptions to  
handle that case correctly.  
  
Bumped catversion.  System catalogs that contained reloptions for  
partitioned tables are no longer valid; plus, there are now fewer  
physical files on disk, which is not technically a catalog change but  
still a good reason to re-initdb.  
  
Amit Langote, reviewed by Maksim Milyutin and Kyotaro Horiguchi and  
revised a bit by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_table.sgml
M src/backend/access/common/reloptions.c
M src/backend/catalog/heap.c
M src/include/access/reloptions.h
M src/include/catalog/catversion.h

postgres_fdw: Teach IMPORT FOREIGN SCHEMA about partitioning.

commit   : f49bcd4ef3e9a75de210357a4d9bbe3e004db956    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 15:01:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 31 Mar 2017 15:01:35 -0400    

Click here for diff

Don't import partitions.  Do import partitioned tables which are  
not themselves partitions.  
  
Report by Stephen Frost.  Design and patch by Michael Paquier,  
reviewed by Amit Langote.  Documentation revised by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Full Text Search support for json and jsonb

commit   : e306df7f9cd6b4433273e006df11bdc966b7079e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 31 Mar 2017 14:26:03 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 31 Mar 2017 14:26:03 -0400    

Click here for diff

The new functions are ts_headline() and to_tsvector.  
  
Dmitry Dolgov, edited and documented by me.  

M doc/src/sgml/func.sgml
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/wparser.c
M src/include/catalog/pg_proc.h
M src/include/tsearch/ts_type.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

Transform or iterate over json(b) string values

commit   : c80b9920fcbcbf75e3d7e8fe092bf6e15d9d40b8    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 31 Mar 2017 14:25:25 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 31 Mar 2017 14:25:25 -0400    

Click here for diff

Dmitry Dolgov, reviewed and lightly edited by me.  

M src/backend/utils/adt/jsonfuncs.c
M src/include/utils/jsonapi.h

Fix typo in comment

commit   : 156d3882f89d2a224029e4c81adacd279eb1cdfc    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 31 Mar 2017 09:00:38 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 31 Mar 2017 09:00:38 +0200    

Click here for diff

Daniel Gustafsson  

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

Fix broken markup.

commit   : ab1e644005b6ef77dada51188d7b92905e2444d7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Mar 2017 17:13:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Mar 2017 17:13:44 -0400    

Click here for diff

Per buildfarm.  

M doc/src/sgml/pgstatstatements.sgml

Fix pgrowlocks minor coding oversight

commit   : ceb3158abe743ddcb213457fc9fcd1a89812194f    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 30 Mar 2017 14:53:07 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 30 Mar 2017 14:53:07 -0400    

Click here for diff

M contrib/pgrowlocks/pgrowlocks.c

Default monitoring roles

commit   : 25fff40798fc4ac11a241bfd9ab0c45c085e2212    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 30 Mar 2017 14:18:53 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 30 Mar 2017 14:18:53 -0400    

Click here for diff

Three nologin roles with non-overlapping privs are created by default  
* pg_read_all_settings - read all GUCs.  
* pg_read_all_stats - pg_stat_*, pg_database_size(), pg_tablespace_size()  
* pg_stat_scan_tables - may lock/scan tables  
  
Top level role - pg_monitor includes all of the above by default, plus others  
  
Author: Dave Page  
Reviewed-by: Stephen Frost, Robert Haas, Peter Eisentraut, Simon Riggs  

M contrib/pg_buffercache/Makefile
A contrib/pg_buffercache/pg_buffercache–1.2–1.3.sql
M contrib/pg_buffercache/pg_buffercache.control
M contrib/pg_freespacemap/Makefile
A contrib/pg_freespacemap/pg_freespacemap–1.1–1.2.sql
M contrib/pg_freespacemap/pg_freespacemap.control
M contrib/pg_stat_statements/Makefile
A contrib/pg_stat_statements/pg_stat_statements–1.4–1.5.sql
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/pg_stat_statements.control
M contrib/pg_visibility/Makefile
A contrib/pg_visibility/pg_visibility–1.1–1.2.sql
M contrib/pg_visibility/pg_visibility.control
M contrib/pgrowlocks/pgrowlocks.c
M contrib/pgstattuple/pgstattuple–1.4–1.5.sql
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/pgfreespacemap.sgml
M doc/src/sgml/pgrowlocks.sgml
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/pgstattuple.sgml
M doc/src/sgml/pgvisibility.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/walreceiver.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/misc/guc.c
M src/include/catalog/pg_authid.h

Support \if ... \elif ... \else ... \endif in psql scripting.

commit   : e984ef5861df4bc9733b36271d05763e82de7c04    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Mar 2017 12:59:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Mar 2017 12:59:11 -0400    

Click here for diff

This patch adds nestable conditional blocks to psql.  The control  
structure feature per se is complete, but the boolean expressions  
understood by \if and \elif are pretty primitive; basically, after  
variable substitution and backtick expansion, the result has to be  
"true" or "false" or one of the other standard spellings of a boolean  
value.  But that's enough for many purposes, since you can always  
do the heavy lifting on the server side; and we can extend it later.  
  
Along the way, pay down some of the technical debt that had built up  
around psql/command.c:  
* Refactor exec_command() into a function per command, instead of  
being a 1500-line monstrosity.  This makes the file noticeably longer  
because of repetitive function header/trailer overhead, but it seems  
much more readable.  
* Teach psql_get_variable() and psqlscanslash.l to suppress variable  
substitution and backtick expansion on the basis of the conditional  
stack state, thereby allowing removal of the OT_NO_EVAL kluge.  
* Fix the no-doubt-once-expedient hack of sometimes silently substituting  
mainloop.c's previous_buf for query_buf when calling HandleSlashCmds.  
(It's a bit remarkable that commands like \r worked at all with that.)  
Recall of a previous query is now done explicitly in the slash commands  
where that should happen.  
  
Corey Huinker, reviewed by Fabien Coelho, further hacking by me  
  
Discussion: https://postgr.es/m/CADkLM=c94OSRTnat=LX0ivNq4pxDNeoomFfYvBKM5N_xfmLtAA@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/Makefile
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.c
A src/bin/psql/conditional.c
A src/bin/psql/conditional.h
M src/bin/psql/copy.c
M src/bin/psql/help.c
M src/bin/psql/mainloop.c
M src/bin/psql/prompt.c
M src/bin/psql/prompt.h
M src/bin/psql/psqlscanslash.h
M src/bin/psql/psqlscanslash.l
M src/bin/psql/startup.c
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Try to fix xml docs build broken in 5ded4bd.

commit   : ffae6733db1f9d4a3a75d737a00ee2a4a3e01849    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 30 Mar 2017 09:41:00 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 30 Mar 2017 09:41:00 -0700    

Click here for diff

Apparently the sgml to xml conversion treats non-closed <para>s  
differently than jade does.  

M doc/src/sgml/xfunc.sgml

Simplify the example of VACUUM in documentation.

commit   : ec19693014ed48fa1d8c7e0ce450795f752c4456    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 31 Mar 2017 01:31:15 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 31 Mar 2017 01:31:15 +0900    

Click here for diff

Previously a detailed activity report by VACUUM VERBOSE ANALYZE was  
described as an example of VACUUM in docs. But it had been obsolete  
for a long time. For example, commit feb4f44d296b88b7f0723f4a4f3945a371276e0b  
updated the content of that activity report in 2003, but we had  
forgotten to update the example.  
  
So basically we need to update the example. But since no one cared  
about the details of VACUUM output and complained about that mistake  
for such long time, per discussion on hackers, we decided to get rid  
of the detailed activity report from the example and simplify it.  
  
Back-patch to all supported versions.  
  
Reported by Masahiko Sawada, patch by me.  
Discussion: https://postgr.es/m/CAD21AoAGA2pB3p-CWmTkxBsbkZS1bcDGBLcYVcvcDxspG_XAfA@mail.gmail.com  

M doc/src/sgml/ref/vacuum.sgml

Remove support for version-0 calling conventions.

commit   : 5ded4bd21403e143dd3eb66b92d52732fdac1945    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 29 Mar 2017 13:16:49 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 29 Mar 2017 13:16:49 -0700    

Click here for diff

The V0 convention is failure prone because we've so far assumed that a  
function is V0 if PG_FUNCTION_INFO_V1 is missing, leading to crashes  
if a function was coded against the V1 interface.  V0 doesn't allow  
proper NULL, SRF and toast handling.  V0 doesn't offer features that  
V1 doesn't.  
  
Thus remove V0 support and obsolete fmgr README contents relating to  
it.  
  
Author: Andres Freund, with contributions by Peter Eisentraut & Craig Ringer  
Reviewed-By: Peter Eisentraut, Craig Ringer  
Discussion: https://postgr.es/m/[email protected]  

M contrib/earthdistance/earthdistance.c
M doc/src/sgml/xfunc.sgml
M src/backend/utils/fmgr/README
M src/backend/utils/fmgr/fmgr.c
M src/include/fmgr.h
M src/test/regress/input/create_function_2.source
M src/test/regress/input/misc.source
M src/test/regress/output/create_function_2.source
M src/test/regress/output/misc.source
M src/test/regress/regress.c

Move contrib/seg to only use V1 calling conventions.

commit   : 389bb2818f404d5b967f21e1ac4f987f894e94bb    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 29 Mar 2017 13:16:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 29 Mar 2017 13:16:30 -0700    

Click here for diff

A later commit will remove V0 support.  
  
Author: Andres Freund, with contributions by Craig Ringer  
Reviewed-By: Peter Eisentraut, Craig Ringer  
Discussion: https://postgr.es/m/[email protected]  

M contrib/seg/seg.c

Implement SortSupport for macaddr data type

commit   : f90d23d0c51895e0d7db7910538e85d3d38691f0    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 29 Mar 2017 23:28:56 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 29 Mar 2017 23:28:56 +0300    

Click here for diff

Introduces a scheme to produce abbreviated keys for the macaddr type.  
Bump catalog version.  
  
Author: Brandur Leach  
Reviewed-by: Julien Rouhaud, Peter Geoghegan  
  
https://commitfest.postgresql.org/13/743/  

M src/backend/utils/adt/mac.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_proc.h

pg_dump: Remove query truncation in error messages

commit   : 5baf869f74d369319042132ef8cc2d8d4f5b71ce    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Mar 2017 15:17:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Mar 2017 15:17:14 -0400    

Click here for diff

Remove the behavior that a query mentioned in an error message would be  
truncated to 128 characters.  The queries that pg_dump runs are often  
longer than that, and this behavior makes analyzing failures harder  
unnecessarily.  
  
Discussion: https://www.postgresql.org/message-id/flat/63201ef9-26fb-3f1f-664d-98531678cebc%402ndquadrant.com  

M src/bin/pg_dump/pg_backup_db.c

commit   : 4fdb8a82e3c6aaf6ca866c92ee066b6bde82c0b8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Mar 2017 14:54:10 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Mar 2017 14:54:10 -0400    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

M src/backend/replication/logical/tablesync.c
M src/include/catalog/pg_subscription_rel.h

Simplify check of modified attributes in heap_update

commit   : 2fd8685e7fd9fddf16f99de1284a787d29781cc8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 29 Mar 2017 12:18:48 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 29 Mar 2017 12:18:48 -0300    

Click here for diff

The old coding was getting more complicated as new things were added,  
and it would be barely tolerable with upcoming WARM updates and other  
future features such as indirect indexes.  The new coding incurs a small  
performance cost in synthetic benchmark cases, and is barely measurable  
in normal cases.  A much larger benefit is expected from WARM, which  
could actually bolt its needs on top of the existing coding, but it is  
much uglier and bug-prone than doing it on this new code.  Additional  
optimization can be applied on top of this, if need be.  
  
Reviewed-by: Pavan Deolasee, Amit Kapila, Mithun CY  
Discussion: https://postgr.es/m/[email protected]  
	https://postgr.es/m/CABOikdMJfz69dBNRTOZcB6s5A0tf8OMCyQVYQyR-WFFdoEwKMQ@mail.gmail.com  

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

Mark more functions parallel-restricted.

commit   : 9a09527164311a5735e4a8a83d376a30427336cc    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Mar 2017 10:59:27 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Mar 2017 10:59:27 -0400    

Click here for diff

Commit 61c2e1a95f94bb904953a6281ce17a18ac38ee6d allowed parallel  
query to be used in more places, revealing via buildfarm member  
mandrill that several functions intended to be called from triggers  
were incorrectly marked parallel-safe rather than parallel-restricted.  
  
Report by Tom Lane.  Patch by Rafia Sabih.  Reviewed by me.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Plug race in dsa_attach.

commit   : fddf45b38097d14301d249fbeebca32e40233bd2    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Mar 2017 09:44:29 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Mar 2017 09:44:29 -0400    

Click here for diff

With sufficiently bad luck, it was possible for a parallel worker to  
attempt attach to a DSA area after all other backends have detached  
from it, which is not legal.  If the worker had waited a little longer  
to get started, the DSM itself would have been destroyed, which is why  
this wasn't noticed before.  
  
Thomas Munro, per a report from Andreas Seltenreich  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/dsa.c

Fix hardcoded typeof check result for Windows

commit   : 3582b223d494cd505c6a22da98bcb49f99196645    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Mar 2017 08:55:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Mar 2017 08:55:34 -0400    

Click here for diff

The test result that I had blindly stipulated didn't work out on the  
build farm, so disable the feature in Windows MSVC for now.  

M src/include/pg_config.h.win32

Fix configure check for typeof

commit   : ddce628971fb611f5ecd49d72e1612f983d99097    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2017 22:28:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2017 22:28:56 -0400    

Click here for diff

M config/c-compiler.m4
M configure

Improve Node vs Expr use a bit

commit   : e0eb5e0aeac7643c10b550e8067182cd08fc59a3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2017 21:55:58 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2017 21:55:58 -0400    

Click here for diff

Author: Mark Dilger <[email protected]>  

M src/backend/catalog/partition.c

Cast result of copyObject() to correct type

commit   : 4cb824699e12c39fad97fb3d9085ced0d14c067c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Mar 2017 15:18:59 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Mar 2017 15:18:59 -0500    

Click here for diff

copyObject() is declared to return void *, which allows easily assigning  
the result independent of the input, but it loses all type checking.  
  
If the compiler supports typeof or something similar, cast the result to  
the input type.  This creates a greater amount of type safety.  In some  
cases, where the result is assigned to a generic type such as Node * or  
Expr *, new casts are now necessary, but in general casts are now  
unnecessary in the normal case and indicate that something unusual is  
happening.  
  
Reviewed-by: Mark Dilger <[email protected]>  

M config/c-compiler.m4
M configure
M configure.in
M src/backend/bootstrap/bootstrap.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/event_trigger.c
M src/backend/commands/prepare.c
M src/backend/commands/view.c
M src/backend/nodes/copyfuncs.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/planagg.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/tlist.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_utilcmd.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/tcop/postgres.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/include/nodes/nodes.h
M src/include/optimizer/tlist.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

doc: Mention --enable-tap-tests in regression test chapter

commit   : 66b764341ba12206f01e2600713bdc3abdb070b3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2017 21:12:30 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2017 21:12:30 -0400    

Click here for diff

Reported-by: Jeff Janes <[email protected]>  

M doc/src/sgml/regress.sgml

Change 'diag' to 'note' in TAP tests

commit   : 2e74e636bd7d90152d596530a17a3d0ff543cc97    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2017 20:38:06 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2017 20:38:06 -0400    

Click here for diff

Reduce noise from TAP tests by changing 'diag' to 'note', so output only  
goes to the test's log file not stdout, unless in verbose mode.  This  
also removes the junk on screen when running the TAP tests in parallel.  
  
Author: Craig Ringer <[email protected]>  

M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/ssl/ServerSetup.pm
M src/test/ssl/t/001_ssltests.pl

Allow DSM segments to be created as pinned

commit   : 767bc028e5f001351feb498acef9a87c123093d6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 24 Mar 2017 19:27:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 24 Mar 2017 19:27:22 -0300    

Click here for diff

dsm_create and dsm_attach assumed that a current resource owner was  
always in place.  Exploration with the API show that this is  
inconvenient: sometimes one must create a dummy resowner, create/attach  
the DSM, only to pin the mapping later, which is wasteful.  Change  
create/attach so that if there is no current resowner, the dsm is  
effectively pinned right from the start.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed by Thomas Munro.  

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

Make new expression eval code reject references to dropped columns.

commit   : 2c4debbd0f018aa7322b622c88424a7f68d3081d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Mar 2017 18:05:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Mar 2017 18:05:03 -0400    

Click here for diff

Formerly, a Var referencing an already-dropped column was allowed and would  
always produce a NULL value.  However, that behavior was implemented in  
slot_getattr which the new expression code doesn't use; thus there is now a  
risk of returning theoretically-deleted data.  We had regression test cases  
that purported to exercise this, but they failed to expose any problem,  
apparently because plpgsql filters the dropped column and produces an  
output tuple that has a NULL there already.  
  
Ideally the DROP or ALTER attempt in these test cases would get rejected  
due to dependency checks; but until that happens, let's modify the behavior  
so that we fail the query during executor start.  This was already true for  
the related case of a column having changed type underneath us, and there's  
no obvious reason why we need to be laxer for dropped columns.  
  
In passing, adjust the error messages in CheckVarSlotCompatibility to  
include the composite type name.  In the cases shown in the regression  
tests this is always just "record", but it should be more useful in  
actual stale-plan cases, where the slot tupdesc would be a table's  
tupdesc directly.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove direct uses of ItemPointer.{ip_blkid,ip_posid}

commit   : ce96ce60ca2293f75f36c3661e4657a3c79ffd61    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 28 Mar 2017 12:52:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 28 Mar 2017 12:52:55 -0300    

Click here for diff

There are no functional changes here; this simply encapsulates knowledge  
of the ItemPointerData struct so that a future patch can change things  
without more breakage.  
  
All direct users of ip_blkid and ip_posid are changed to use existing  
macros ItemPointerGetBlockNumber and ItemPointerGetOffsetNumber  
respectively.  For callers where that's inappropriate (because they  
Assert that the itempointer is is valid-looking), add  
ItemPointerGetBlockNumberNoCheck and ItemPointerGetOffsetNumberNoCheck,  
which lack the assertion but are otherwise identical.  
  
Author: Pavan Deolasee  
Discussion: https://postgr.es/m/CABOikdNnFon4cJiL=h1mZH3bgUeU+sWHuU4Yr8AB=j3A2p1GiA@mail.gmail.com  

M contrib/pageinspect/btreefuncs.c
M contrib/pgstattuple/pgstattuple.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/ginpostinglist.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/page/itemptr.c
M src/backend/utils/adt/tid.c
M src/include/access/gin_private.h
M src/include/access/ginblock.h
M src/include/access/htup_details.h
M src/include/access/nbtree.h
M src/include/storage/itemptr.h

Correct grammar in error message

commit   : a99f77021f0c8c1c221af4e36b64ca43abd04389    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 28 Mar 2017 13:24:39 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 28 Mar 2017 13:24:39 -0400    

Click here for diff

"could not generate" rather than "could not generation"  
from commit 818fd4a67d610991757b610755e3065fb99d80a5  

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

Fix ssl tests

commit   : 967a4b01e3637813365502b46499360b18b86725    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2017 13:22:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2017 13:22:00 -0400    

Click here for diff

facde2a98f0b5f7689b4e30a9e7376e926e733b8 introduced a typo during  
rebasing.  

M src/test/ssl/ServerSetup.pm

Suppress implicit-conversion warnings seen with newer clang versions.

commit   : 8cfeaecfc76a7366b336272bc76e96e09281b133    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Mar 2017 13:16:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Mar 2017 13:16:19 -0400    

Click here for diff

We were assigning values near 255 through "char *" pointers.  On machines  
where char is signed, that's not entirely kosher, and it's reasonable  
for compilers to warn about it.  
  
A better solution would be to change the pointer type to "unsigned char *",  
but that would be vastly more invasive.  For the moment, let's just apply  
this simple backpatchable solution.  
  
Aleksander Alekseev  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/bin/pg_resetwal/pg_resetwal.c

Altering default privileges on schemas

commit   : ab89e465cb2032017c4888399f47a76ac16eaf40    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 28 Mar 2017 18:58:55 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 28 Mar 2017 18:58:55 +0300    

Click here for diff

Extend ALTER DEFAULT PRIVILEGES command to schemas.  
  
Author: Matheus Oliveira  
Reviewed-by: Petr JelĆ­nek, Ashutosh Sharma  
  
https://commitfest.postgresql.org/13/887/  

M doc/src/sgml/ref/alter_default_privileges.sgml
M src/backend/catalog/aclchk.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_namespace.c
M src/backend/parser/gram.y
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/pg_default_acl.h
M src/include/parser/kwlist.h
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

commit   : 85163641f8bdeb7734b37ae67faa224a029afe25    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2017 11:08:38 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2017 11:08:38 -0400    

Click here for diff

The conname variable was not initialized in some code paths, resulting  
in error reports referring to the "unnamed" connection rather than the  
correct connection name.  
  
Author: Rushabh Lathia <[email protected]>  

M contrib/dblink/dblink.c

Cleanup slots during drop database

commit   : ff539da31691f2cd2694360250571c5c5fb7415e    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 28 Mar 2017 10:05:21 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 28 Mar 2017 10:05:21 -0400    

Click here for diff

Automatically drop all logical replication slots associated with a  
database when the database is dropped. Previously we threw an ERROR  
if a slot existed. Now we throw ERROR only if a slot is active in  
the database being dropped.  
  
Craig Ringer  

M doc/src/sgml/func.sgml
M doc/src/sgml/protocol.sgml
M src/backend/commands/dbcommands.c
M src/backend/replication/slot.c
M src/include/replication/slot.h
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl

Fix Perl code which had broken the Windows build

commit   : 4d33a7f2e714848ca7b5b7ef8e244eead078ca13    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2017 09:00:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2017 09:00:59 -0400    

Click here for diff

The previous change wanted to avoid modifying $_ in grep, but the code  
just made the change in a local variable and then lost it.  Rewrite the  
code using a separate map and grep, which is clearer anyway.  
  
Author: Dagfinn Ilmari MannsĆ„ker <[email protected]>  

M src/tools/msvc/vcregress.pl

Show ignored constants as "$N" rather than "?" in pg_stat_statements.

commit   : a6f22e83562d8b78293229587cd3d9430d16d466    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Mar 2017 20:14:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Mar 2017 20:14:36 -0400    

Click here for diff

The trouble with the original choice here is that "?" is a valid (and  
indeed used) operator name, so that you could end up with ambiguous  
statement texts like "SELECT ? ? ?".  With this patch, you instead  
see "SELECT $1 ? $2", which seems significantly more readable.  
The numbers used for this purpose begin after the last actual $N parameter  
in the particular query.  The conflict with external parameters has its own  
potential for confusion of course, but it was agreed to be an improvement  
over the previous behavior.  
  
Lukas Fittl  
  
Discussion: https://postgr.es/m/CAP53PkxeaCuwYmF-A4J5z2-qk5fYFo5_NH3gpXGJJBxv1DMwEw@mail.gmail.com  

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

Fix uninitialized memory propagation mistakes

commit   : 6462238f0d7b7c15eb3f54c2108573cee8fb24ba    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 27 Mar 2017 14:52:19 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 27 Mar 2017 14:52:19 -0300    

Click here for diff

Valgrind complains that some uninitialized bytes are being passed around  
by the extended statistics code since commit 7b504eb282ca2f, as reported  
by Andres Freund.  Silence it.  
  
Tomas Vondra submitted a patch which he verified to fix the complaints  
in his machine; however I messed with it a bit before pushing, so any  
remaining problems are likely my (Ɓlvaro's) fault.  
  
Author: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/statistics/mvdistinct.c
M src/include/statistics/statistics.h

doc: Improve rendering of notes/cautions using XSL-FO

commit   : 6e31c3e13514be4404f716f152ac4c434adad03a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Mar 2017 13:33:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Mar 2017 13:33:36 -0400    

Click here for diff

Center title and put a border around it, like the output that the DSSSL  
version gave.  

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

Still more code review for single-page hash vacuuming.

commit   : c4c51541e22bf7f2da8ecf6986271687b0d7a90e    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2017 12:50:51 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2017 12:50:51 -0400    

Click here for diff

Most seriously, fix use of incorrect block ID, per a report from  
Jeff Janes that it causes a crash and a diagnosis from Amit Kapila.  
  
Improve consistency between the hash and btree versions of this  
code by adding back a PANIC that btree has, and by registering  
data in the xlog record in the same way, per complaints from  
Jeff Janes and Amit Kapila.  
  
Tidy up some minor cosmetic points, per complaints from Amit  
Kapila.  
  
Patch by Ashutosh Sharma, reviewed by Amit Kapila, and tested by  
Jeff Janes.  
  
Discussion: http://postgr.es/m/CAMkU=1w-9Qe=Ff1o6bSaXpNO9wqpo7_9GL8_CVhw4BoVVHasqg@mail.gmail.com  

M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/include/access/hash_xlog.h

Fsync directory after creating or unlinking file.

commit   : 1b02be21f271db6bd3cd43abb23fa596fcb6bac3    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 27 Mar 2017 19:33:01 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 27 Mar 2017 19:33:01 +0300    

Click here for diff

If file was created/deleted just before powerloss it's possible that  
file system will miss that. To prevent it, call fsync() where creating/  
unlinkg file is critical.  
  
Author: Michael Paquier  
Reviewed-by: Ashutosh Bapat, Takayuki Tsunakawa, me  

M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/storage/file/fd.c
M src/include/storage/fd.h

Fix thinko in estimate_num_groups

commit   : 1f171a1803c28d3ae24636c9ca3352ec82c39e5f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 27 Mar 2017 12:52:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 27 Mar 2017 12:52:50 -0300    

Click here for diff

The code for the reworked n-distinct estimation on commit 7b504eb282 was  
written differently in a previous version of the patch, prior to commit;  
on rewriting it, we missed updating an initializer.  This caused the  
code to (mistakenly) apply a fudge factor even in the case where a  
single value is applied, leading to incorrect results.  
  
This means that the 'relvarcount' variable name is now wrong.  Add a  
comment to try and make the situation clearer, and remove an incorrect  
comment I added.  
  
Problem noticed, and code patch, by Tomas Vondra.  Additional commentary  
by Ɓlvaro.  

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

Improve performance of find_all_inheritors()

commit   : 827d6f977940952ebef4bd21fb0f97be4e20c0c4    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 27 Mar 2017 19:07:48 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 27 Mar 2017 19:07:48 +0300    

Click here for diff

Previous coding uses three nested loops which obviously were a pain for  
large number of table's children. Patch replaces inner loop with  
a hashmap.  
  
Author: Aleksander Alekseev  
Reviewed-by: me  
  
https://commitfest.postgresql.org/13/1058/  

M src/backend/catalog/pg_inherits.c

doc: Fix oldhtml/old PDF build again

commit   : 5196f13b2726eeabfe2c8b7a97fc05839766cdce    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Mar 2017 11:57:10 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Mar 2017 11:57:10 -0400    

Click here for diff

Commit e259e1f748c7a6d67e307a90d6c27b8ab8b90df8 was faulty and created  
some broken output.  This one fixes it better.  

M doc/src/sgml/ref/alter_collation.sgml

Rework the stats_ext test

commit   : bed9ef5a16239d91d97a1fa2efd9309c3cbbc4b2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 27 Mar 2017 12:40:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 27 Mar 2017 12:40:42 -0300    

Click here for diff

As suggested by Tom Lane, avoid printing specific estimated cost values,  
because they vary across architectures; instead, verify plan shapes (in  
this case, HashAggregate vs. GroupAggregate), as we do in other planner  
tests.  
  
We can now remove expected/stats_ext_1.out.  
  
Author: Tomas Vondra  

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

PL/Python: Add cursor and execute methods to plan object

commit   : 70ec3f1f8f0b753c38a1a582280a02930d7cac5f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 25 Feb 2017 08:42:25 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 25 Feb 2017 08:42:25 -0500    

Click here for diff

Instead of  
  
    plan = plpy.prepare(...)  
    res = plpy.execute(plan, ...)  
  
you can now write  
  
    plan = plpy.prepare(...)  
    res = plan.execute(...)  
  
or even  
  
    res = plpy.prepare(...).execute(...)  
  
and similarly for the cursor() method.  
  
This is more in object oriented style, and makes the hybrid nature of  
the existing execute() function less confusing.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  

M doc/src/sgml/plpython.sgml
M src/pl/plpython/expected/plpython_spi.out
M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_cursorobject.h
M src/pl/plpython/plpy_planobject.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_spi.h
M src/pl/plpython/sql/plpython_spi.sql

Improve performance of find_tabstat_entry()/get_tabstat_entry()

commit   : 090010f2ec9b1f9ac1124dc628b89586f911b641    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 27 Mar 2017 18:34:42 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 27 Mar 2017 18:34:42 +0300    

Click here for diff

Patch introduces a hash map reloid -> PgStat_TableStatus which improves  
performance in case of large number of tables/partitions.  
  
Author: Aleksander Alekseev  
Reviewed-by: Andres Freund, Anastasia Lubennikova, Tels, me  
  
https://commitfest.postgresql.org/13/1058/  

M src/backend/postmaster/pgstat.c

Improve documentation of how NOT NULL works with partitioning.

commit   : d65561464f45d325e82ad91918bcd4e2881ce567    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2017 11:01:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2017 11:01:33 -0400    

Click here for diff

Amit Langote  
  
Discussion: http://postgr.es/m/[email protected]  

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

Tidy up the CREATE TABLE documentation for partitioning.

commit   : 4785e377f9c3189c06051ece7ebb112220f365f6    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2017 11:00:09 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2017 11:00:09 -0400    

Click here for diff

Remove some <note> tags that make this too "loud".  Fix some typos.  
  
Amit Langote, with a few minor corrections by me  
  
Discussion: http://postgr.es/m/[email protected]  

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

Fix improper NULL handling in list partitioning code.

commit   : 7ecb7143589f38d679bb566311dfa9be1a650fd5    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2017 10:51:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2017 10:51:46 -0400    

Click here for diff

The previous logic was wrong when the value was NULL but there was  
no partition for NULL.  
  
Amit Langote, reviewed by Jeevan Ladhe  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/catalog/partition.c
M src/test/regress/expected/insert.out
M src/test/regress/sql/insert.sql

Allow ON CONFLICT .. DO NOTHING on a partitioned table.

commit   : 8355a011a0124bdf7ccbada206a967d427039553    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2017 10:37:29 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2017 10:37:29 -0400    

Click here for diff

ON CONFLICT .. DO UPDATE still doesn't work, for lack of a way of  
enforcing uniqueness across partitions, but we can still allow this  
case.  
  
Amit Langote, per discussion with Peter Geoghegan.  Additional  
wordsmithing by me.  
  
Discussion: http://postgr.es/m/CAA-aLv7Z4uygtq-Q5CvDi9Y=VZxUyEnuWjL=EwCfOof=L04hgg@mail.gmail.com  

M doc/src/sgml/ddl.sgml
M src/backend/parser/analyze.c
M src/test/regress/expected/insert_conflict.out
M src/test/regress/sql/insert_conflict.sql

Change default of log_directory to 'log'

commit   : 3371e4d9b12455fe1f8d1516d0bd915aab86be17    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Mar 2017 10:34:33 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Mar 2017 10:34:33 -0400    

Click here for diff

The previous default 'pg_log' might have indicated by its "pg_" prefix  
that it is an internal system directory.  The new default is more in  
line with the typical naming of directories with user-facing log files.  
Together with the renaming of pg_clog and pg_xlog, this should clear up  
that difference.  
  
Author: Andreas Karlsson <[email protected]>  

M doc/src/sgml/config.sgml
M doc/src/sgml/file-fdw.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/test/perl/PostgresNode.pm
M src/test/perl/RecursiveCopy.pm

Pass DSA_ALLOC_HUGE when allocating a shared TIDBitmap.

commit   : a171f01501e11a2ef65d437ac2397a0050892d88    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2017 08:30:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2017 08:30:19 -0400    

Click here for diff

When creating an unshared TIDBitmap, we pass MCXT_ALLOC_HUGE to allow  
allocations >1GB, so by analogy we pass DSA_ALLOC_HUGE for a shared  
TIDBitmap.  
  
Bug introduced by commit 98e6e89040a0534ca26914c66cae9dd49ef62ad9.  
Report by Rafia Sabih, fix by Dilip Kumar, adjusted by me.  
  
Discussion: http://postgr.es/m/CAOGQiiPpSnkuKq+oUK_bvQFg2EPGFPN8RwgxTgBa6HU_kQa3EA@mail.gmail.com  

M src/backend/nodes/tidbitmap.c

Clean up Perl code according to perlcritic

commit   : facde2a98f0b5f7689b4e30a9e7376e926e733b8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 26 Mar 2017 22:24:13 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 26 Mar 2017 22:24:13 -0400    

Click here for diff

Fix all perlcritic warnings of severity level 5, except in  
src/backend/utils/Gen_dummy_probes.pl, which is automatically generated.  
  
Reviewed-by: Dagfinn Ilmari MannsĆ„ker <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  

M contrib/intarray/bench/create_test.pl
M doc/src/sgml/generate-errcodes-table.pl
M doc/src/sgml/mk_feature_tables.pl
M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/backend/parser/check_keywords.pl
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/generate-errcodes.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/psql/create_help.pl
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/libpq/test/regress.pl
M src/pl/plperl/plc_perlboot.pl
M src/pl/plperl/plc_trusted.pl
M src/pl/plperl/text2macro.pl
M src/pl/plpgsql/src/generate-plerrcodes.pl
M src/pl/plpython/generate-spiexceptions.pl
M src/pl/tcl/generate-pltclerrcodes.pl
M src/test/locale/sort-test.pl
M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm
M src/test/ssl/ServerSetup.pm
M src/tools/fix-old-flex-code.pl
M src/tools/msvc/Install.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/build.pl
M src/tools/msvc/builddoc.pl
M src/tools/msvc/gendef.pl
M src/tools/msvc/install.pl
M src/tools/msvc/mkvcbuild.pl
M src/tools/msvc/pgbison.pl
M src/tools/msvc/pgflex.pl
M src/tools/msvc/vcregress.pl
M src/tools/pginclude/pgcheckdefines
M src/tools/pgindent/pgindent
M src/tools/version_stamp.pl
M src/tools/win32tzlist.pl

Attempt to stabilize grouping sets regression test plans.

commit   : de4da168d57de812bb30d359394b7913635d21a9    
  
author   : Andrew Gierth <[email protected]>    
date     : Mon, 27 Mar 2017 05:53:26 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Mon, 27 Mar 2017 05:53:26 +0100    

Click here for diff

Per buildfarm members dromedary and arapaima.  

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

Fix a couple of problems in pg_get_statisticsextdef

commit   : 2c3e47527a6f53cd1d98887fdb9e770c118954ca    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 27 Mar 2017 00:53:59 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 27 Mar 2017 00:53:59 -0300    

Click here for diff

There was a thinko whereby we tested the wrong tuple after fetching it  
from cache; avoid that by using generate_relation_name instead, which is  
simpler.  Also, the statistics name was not qualified, so add that.  (It  
could be argued that qualification should be conditional on the schema  
not being on search path.  We can add that later, but at least this form  
is correct.)  
  
Author: David Rowley, Ɓlvaro Herrera  
Discussion: https://postgr.es/m/CAKJS1f8RjLeVZJ2+93pdQGuZJeBF-ifsHaFMR-q-6-Z0qxA8cA@mail.gmail.com  

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

Support hashed aggregation with grouping sets.

commit   : b5635948ab165b6070e7d05d111f966e07570d81    
  
author   : Andrew Gierth <[email protected]>    
date     : Mon, 27 Mar 2017 04:20:54 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Mon, 27 Mar 2017 04:20:54 +0100    

Click here for diff

This extends the Aggregate node with two new features: HashAggregate  
can now run multiple hashtables concurrently, and a new strategy  
MixedAggregate populates hashtables while doing sorted grouping.  
  
The planner will now attempt to save as many sorts as possible when  
planning grouping sets queries, while not exceeding work_mem for the  
estimated combined sizes of all hashtables used.  No SQL-level changes  
are required.  There should be no user-visible impact other than the  
new EXPLAIN output and possible changes to result ordering when ORDER  
BY was not used (which affected a few regression tests).  The  
enable_hashagg option is respected.  
  
Author: Andrew Gierth  
Reviewers: Mark Dilger, Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/commands/explain.c
M src/backend/executor/nodeAgg.c
M src/backend/lib/Makefile
A src/backend/lib/knapsack.c
M src/backend/nodes/bitmapset.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/planner.c
M src/backend/optimizer/util/pathnode.c
A src/include/lib/knapsack.h
M src/include/nodes/bitmapset.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/pathnode.h
M src/test/regress/expected/groupingsets.out
M src/test/regress/expected/tsrf.out
M src/test/regress/sql/groupingsets.sql
M src/test/regress/sql/tsrf.sql

Fix comment.

commit   : f0a6046bcb15c2fe48384ef547df2bfb5d7f0a89    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 26 Mar 2017 22:15:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 26 Mar 2017 22:15:50 -0400    

Click here for diff

Cut-and-paste led to something silly.  
  
Ashutosh Sharma, reviewed by Amit Kapila and by me  
  
Discussion: http://postgr.es/m/CAE9k0PmUbvQSBY7kwN_OkuqBYyHRXBX-c1ZkuAgR5vgF0GeWzQ@mail.gmail.com  

M src/backend/access/hash/hashpage.c

Show more processes in pg_stat_activity.

commit   : fc70a4b0df38bda6a13941f1581f25fbb643c7f3    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 26 Mar 2017 22:02:22 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 26 Mar 2017 22:02:22 -0400    

Click here for diff

Previously, auxiliary processes and background workers not connected  
to a database (such as the logical replication launcher) weren't  
shown.  Include them, so that we can see the associated wait state  
information.  Add a new column to identify the processes type, so that  
people can filter them out easily using SQL if they wish.  
  
Before this patch was written, there was discussion about whether we  
should expose this information in a separate view, so as to avoid  
contaminating pg_stat_activity with things people might not want to  
see.  But putting everything in pg_stat_activity was a more popular  
choice, so that's what the patch does.  
  
Kuntal Ghosh, reviewed by Amit Langote and Michael Paquier.  Some  
revisions and bug fixes by me.  
  
Discussion: http://postgr.es/m/CA+TgmoYES5nhkEGw9nZXU8_FhA8XEm8NTm3-SO+3ML1B81Hkww@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/system_views.sql
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/startup.c
M src/backend/replication/walsender.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/init/postinit.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/pgstat.h
M src/include/storage/proc.h
M src/test/regress/expected/rules.out

Improve performance of ExecEvalWholeRowVar.

commit   : 2f0903ea196503fc8af373a9de46b1e01a23508c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2017 19:14:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2017 19:14:47 -0400    

Click here for diff

In commit b8d7f053c, we needed to fix ExecEvalWholeRowVar to not change  
the state of the slot it's copying.  The initial quick hack at that  
required two rounds of tuple construction, which is not very nice.  
To fix, add another primitive to tuptoaster.c that does precisely what  
we need.  (I initially tried to do this by refactoring one of the  
existing functions into two pieces; but it looked like that might hurt  
performance for the existing case, and the amount of code that could  
be shared is not very large, so I gave up on that.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/tuptoaster.c
M src/backend/executor/execExprInterp.c
M src/include/access/tuptoaster.h

Fix cpluspluscheck warning

commit   : 895f93701fd78b6faab6b437685357298a91dfe3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 26 Mar 2017 18:31:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 26 Mar 2017 18:31:05 -0400    

Click here for diff

Structure tag cannot be the same as a typedef that is a pointer to that  
struct.  

M src/include/utils/pg_locale.h

Use ExecPrepareExpr in place of ExecPrepareCheck where appropriate.

commit   : 9b95f2fa1e2684fa209a3594db2254b8841bf380    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2017 18:14:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2017 18:14:03 -0400    

Click here for diff

Change one more place where ExecInitCheck/ExecPrepareCheck's insistence  
on getting implicit-AND-format quals wasn't really helpful, because the  
caller had to do make_ands_implicit() for no reason that it cared about.  
Using ExecPrepareExpr directly simplifies the code and saves cycles.  
  
The only remaining use of these functions is to process  
resultRelInfo->ri_PartitionCheck quals.  However, implicit-AND format  
does seem to be what we want for that, so leave it alone.  

M src/backend/catalog/partition.c
M src/backend/commands/tablecmds.c

Fix typos in logical replication support for initial data copy.

commit   : 5459cfd3ad52b87a1e2ed293ae55e733c6964715    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2017 17:44:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2017 17:44:35 -0400    

Click here for diff

Fix an incorrect assert condition (noted by Coverity), and spell the new  
name of the function correctly.  Typos introduced in commit 7c4f52409.  
  
Michael Paquier  

M src/backend/replication/logical/snapbuild.c
M src/backend/replication/walsender.c
M src/include/replication/snapbuild.h

Fix unportable disregard of alignment requirements in RADIUS code.

commit   : 4c051c41d63e8462971c13956a38030de9c35c51    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2017 17:35:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2017 17:35:35 -0400    

Click here for diff

The compiler is entitled to store a char[] local variable with no  
particular alignment requirement.  Our RADIUS code cavalierly took such  
a local variable and cast its address to a struct type that does have  
alignment requirements.  On an alignment-picky machine this would lead  
to bus errors.  To fix, declare the local variable honestly, and then  
cast its address to char * for use in the I/O calls.  
  
Given the lack of field complaints, there must be very few if any  
people affected; but nonetheless this is a clear portability issue,  
so back-patch to all supported branches.  
  
Noted while looking at a Coverity complaint in the same code.  

M src/backend/libpq/auth.c

Fix some minor resource leaks in PerformRadiusTransaction().

commit   : 7cbd944662854a0a5264895bcba3ce7f9bfd1c1f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2017 17:02:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2017 17:02:38 -0400    

Click here for diff

Failure to free serveraddrs pointed out by Coverity, failure to close  
socket noted by code-reading.  These bugs seem to be quite old, but  
given the low probability of taking these error-exit paths and the  
minimal consequences of the leaks (since the process would presumably  
exit shortly anyway), it doesn't seem worth back-patching.  
  
Michael Paquier and Tom Lane  

M src/backend/libpq/auth.c

Improve implementation of EEOP_BOOLTEST_* opcodes.

commit   : d77f014efa7eda4357fbc851dbf25c6b256ddf35    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2017 15:57:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2017 15:57:02 -0400    

Click here for diff

Both Andres and I were happy with "*op->resvalue = *op->resvalue;",  
but Coverity isn't; and it has a point, because some compilers might  
not be smart enough to elide that.  So remove it.  In passing, also  
avoid doing unnecessary assignments to *op->resnull when it's already  
known to have the right value.  

M src/backend/executor/execExprInterp.c

doc: Fix oldhtml/old PDF build

commit   : e259e1f748c7a6d67e307a90d6c27b8ab8b90df8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 26 Mar 2017 15:03:27 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 26 Mar 2017 15:03:27 -0400    

Click here for diff

"xref to REFSECT1 unsupported" with the DSSSL stylesheets.  
  
Reported-by: Devrim GĆ¼ndĆ¼z <[email protected]>  

M doc/src/sgml/ref/alter_collation.sgml

doc: Clean up bibliography rendering for XSLT

commit   : d63762452434a3a046e8c7d130d5a77c594176e4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 26 Mar 2017 14:54:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 26 Mar 2017 14:54:56 -0400    

Click here for diff

In the DSSSL stylesheets, we had an extensive customization of the  
bibliography rendering.  Since the bibliography isn't that used much, it  
doesn't seem worth doing an elaborate porting of that to XSLT.  So this  
just moves some things around, removes some unused things, and does some  
minimal XSLT stylesheet customizations to make things look clean.  

M doc/src/sgml/biblio.sgml
M doc/src/sgml/stylesheet-fo.xsl
M doc/src/sgml/stylesheet.xsl

Update some obsolete comments.

commit   : 244dd95ce9d9831f8498f5746860325f7adcecbf    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2017 11:36:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2017 11:36:46 -0400    

Click here for diff

Fix a few stray references to expression eval functions that don't  
exist anymore or don't take the same input representation they used to.  

M src/backend/optimizer/util/clauses.c
M src/backend/utils/cache/relcache.c
M src/pl/plpgsql/src/pl_exec.c

Add missing break

commit   : 6a101b0aed78e09b51e2162e6b68a4aeab52b61e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 26 Mar 2017 11:31:23 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 26 Mar 2017 11:31:23 -0300    

Click here for diff

Noticed by Coverity  

M src/backend/tcop/utility.c

Blindly attempt to fix sepgsql tests #2.

commit   : d253b0f6e3ea829bbc898040477cac6775faab67    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 25 Mar 2017 20:54:23 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 25 Mar 2017 20:54:23 -0700    

Click here for diff

M contrib/sepgsql/expected/alter.out

Blindly attempt to fix sepgsql tests.

commit   : 83bbcb04ab3bce94282907d09f0e152f4ea4050b    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 25 Mar 2017 20:35:55 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 25 Mar 2017 20:35:55 -0700    

Click here for diff

Due to b8d7f053c5c some permission checks are now happening even on  
empty tables, and some of the checks move around.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sepgsql/expected/alter.out
M contrib/sepgsql/expected/ddl.out
M contrib/sepgsql/expected/misc.out

Remove unreachable code in expression evaluation.

commit   : ad46a2aa79f9ee79aecd889d0ace9ecc08dae984    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 25 Mar 2017 15:32:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 25 Mar 2017 15:32:01 -0700    

Click here for diff

The previous code still contained expression evaluation time support  
for CaseExprs without a defresult.  But transformCaseExpr() creates a  
default expression if necessary.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c

git rm execQual.c

commit   : 8acf08c68dd8b9fa1793f6ccf9e216cdec63fb49    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Mar 2017 18:22:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Mar 2017 18:22:16 -0400    

Click here for diff

Should have been in commit b8d7f053c5c2bf2a7e8734fe3327f6a8bc711755,  
but passing the patch back and forth as a patch seems to have dropped  
that metadata.  

D src/backend/executor/execQual.c

Faster expression evaluation and targetlist projection.

commit   : b8d7f053c5c2bf2a7e8734fe3327f6a8bc711755    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 14 Mar 2017 15:45:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 14 Mar 2017 15:45:36 -0700    

Click here for diff

This replaces the old, recursive tree-walk based evaluation, with  
non-recursive, opcode dispatch based, expression evaluation.  
Projection is now implemented as part of expression evaluation.  
  
This both leads to significant performance improvements, and makes  
future just-in-time compilation of expressions easier.  
  
The speed gains primarily come from:  
- non-recursive implementation reduces stack usage / overhead  
- simple sub-expressions are implemented with a single jump, without  
  function calls  
- sharing some state between different sub-expressions  
- reduced amount of indirect/hard to predict memory accesses by laying  
  out operation metadata sequentially; including the avoidance of  
  nearly all of the previously used linked lists  
- more code has been moved to expression initialization, avoiding  
  constant re-checks at evaluation time  
  
Future just-in-time compilation (JIT) has become easier, as  
demonstrated by released patches intended to be merged in a later  
release, for primarily two reasons: Firstly, due to a stricter split  
between expression initialization and evaluation, less code has to be  
handled by the JIT. Secondly, due to the non-recursive nature of the  
generated "instructions", less performance-critical code-paths can  
easily be shared between interpreted and compiled evaluation.  
  
The new framework allows for significant future optimizations. E.g.:  
- basic infrastructure for to later reduce the per executor-startup  
  overhead of expression evaluation, by caching state in prepared  
  statements.  That'd be helpful in OLTPish scenarios where  
  initialization overhead is measurable.  
- optimizing the generated "code". A number of proposals for potential  
  work has already been made.  
- optimizing the interpreter. Similarly a number of proposals have  
  been made here too.  
  
The move of logic into the expression initialization step leads to some  
backward-incompatible changes:  
- Function permission checks are now done during expression  
  initialization, whereas previously they were done during  
  execution. In edge cases this can lead to errors being raised that  
  previously wouldn't have been, e.g. a NULL array being coerced to a  
  different array type previously didn't perform checks.  
- The set of domain constraints to be checked, is now evaluated once  
  during expression initialization, previously it was re-built  
  every time a domain check was evaluated. For normal queries this  
  doesn't change much, but e.g. for plpgsql functions, which caches  
  ExprStates, the old set could stick around longer.  The behavior  
  around might still change.  
  
Author: Andres Freund, with significant changes by Tom Lane,  
	changes by Heikki Linnakangas  
Reviewed-By: Tom Lane, Heikki Linnakangas  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/index.c
M src/backend/catalog/partition.c
M src/backend/catalog/toasting.c
M src/backend/commands/analyze.c
M src/backend/commands/explain.c
M src/backend/commands/indexcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/Makefile
M src/backend/executor/README
A src/backend/executor/execExpr.c
A src/backend/executor/execExprInterp.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execMain.c
M src/backend/executor/execQual.c
A src/backend/executor/execSRF.c
M src/backend/executor/execScan.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/clauses.c
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/typcache.c
A src/include/executor/execExpr.h
M src/include/executor/execdebug.h
M src/include/executor/executor.h
M src/include/executor/nodeSubplan.h
M src/include/fmgr.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/utils/typcache.h
M src/include/utils/xml.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/expected/case.out
M src/test/regress/expected/privileges.out
M src/test/regress/sql/case.sql
M src/test/regress/sql/privileges.sql
M src/tools/pgindent/typedefs.list

Re-adhere to policy of no more than 20 tests per parallel group.

commit   : 7d3957e53ebf26fc8d72dee1dacc2c827cc07caa    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Mar 2017 17:32:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Mar 2017 17:32:13 -0400    

Click here for diff

As explained at the head of parallel_schedule, we place an arbitrary limit  
of 20 test cases per parallel group.  Commit c7a9fa399 overlooked this.  
  
Least messy solution seems to be to move the "comments" test to the next  
group, since it doesn't really belong in a group of datatype tests anyway.  

M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule

Remember to drop roles created by regression tests.

commit   : 2cdc1389a25bc62b36a6f83d5d095acb99e3277c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Mar 2017 17:25:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Mar 2017 17:25:28 -0400    

Click here for diff

Commit e3920ac82 created "regress_subscription_user2" in subscription.sql,  
but forgot to drop it, causing the regression tests to fail if run twice  
without re-initdb'ing.  

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

Add cleanup to new test cases

commit   : cf366e97ff2f74663754085ee2386bbee39b3edf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 25 Mar 2017 11:11:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 25 Mar 2017 11:11:43 -0400    

Click here for diff

M src/test/modules/dummy_seclabel/expected/dummy_seclabel.out
M src/test/modules/dummy_seclabel/sql/dummy_seclabel.sql

Report catalog_xmin separately in hot_standby_feedback

commit   : 5737c12df0581b3298e3e9586bdef170811ce176    
  
author   : Simon Riggs <[email protected]>    
date     : Sat, 25 Mar 2017 14:07:27 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Sat, 25 Mar 2017 14:07:27 +0000    

Click here for diff

If the upstream walsender is using a physical replication slot, store the  
catalog_xmin in the slot's catalog_xmin field. If the upstream doesn't use a  
slot and has only a PGPROC entry behaviour doesn't change, as we store the  
combined xmin and catalog_xmin in the PGPROC entry.  
  
Author: Craig Ringer  

M doc/src/sgml/protocol.sgml
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/procarray.c
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/test/recovery/t/010_logical_decoding_timelines.pl

Add missing break

commit   : 4dd3abe99f5062dbb874fbc8f6bd306b08f702e8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 25 Mar 2017 00:50:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 25 Mar 2017 00:50:05 -0400    

Click here for diff

Reported-by: Mark Kirkwood <[email protected]>  

M src/backend/tcop/utility.c

psql: Add missing schema qualification

commit   : 19f7e1a7f7dfa841d9357be951f7478b3741009e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 25 Mar 2017 00:49:08 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 25 Mar 2017 00:49:08 -0400    

Click here for diff

M src/bin/psql/describe.c

Fix locale pointer use in WIN32 code path

commit   : 066e3a68ae5210a1fb4ac1c19069202615ce4d89    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 25 Mar 2017 00:38:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 25 Mar 2017 00:38:12 -0400    

Click here for diff

Author: David Rowley <[email protected]>  

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

Remove ICU tests from default run

commit   : e148009740f91ecc9555227d0d52ac43df30e6ed    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 25 Mar 2017 00:28:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 25 Mar 2017 00:28:28 -0400    

Click here for diff

These tests require the test database to be in UTF8 encoding.  Until  
there is a better solution, take them out of the default test set and  
treat them like the existing collate.linux.utf8 test, meaning it has to  
be selected manually.  

M doc/src/sgml/regress.sgml
M src/test/regress/GNUmakefile
R100 src/test/regress/expected/collate.icu.out src/test/regress/expected/collate.icu.utf8.out
R100 src/test/regress/sql/collate.icu.sql src/test/regress/sql/collate.icu.utf8.sql

Fix recovery test hang

commit   : cd07f73d3225c092f4cd0e7bf1cab11ac9f8c1f0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 25 Mar 2017 00:10:57 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 25 Mar 2017 00:10:57 -0400    

Click here for diff

The test would hang if a sufficient ~/.psqlrc was present.  Fix by using  
psql -X.  

M src/test/recovery/t/011_crash_recovery.pl

Add COMMENT and SECURITY LABEL support for publications and subscriptions

commit   : 87dee41f3ed6d6c2a93e7ff359776cfe24f145e0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 24 Mar 2017 23:25:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 24 Mar 2017 23:25:24 -0400    

Click here for diff

M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/security_label.sgml
M src/backend/catalog/system_views.sql
M src/backend/parser/gram.y
M src/test/modules/dummy_seclabel/expected/dummy_seclabel.out
M src/test/modules/dummy_seclabel/sql/dummy_seclabel.sql
M src/test/regress/expected/publication.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/subscription.out
M src/test/regress/sql/publication.sql
M src/test/regress/sql/subscription.sql

Make header self-contained

commit   : 7678fe1c6dd532f5f85a768c97b75dc40072c8e4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 24 Mar 2017 23:36:10 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 24 Mar 2017 23:36:10 -0400    

Click here for diff

Add necessary include files for things used in the header.  

M src/include/catalog/pg_subscription_rel.h

Add more subscription DDL tests

commit   : e3920ac823353f200cfecde74076d3d40f79e2b1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 24 Mar 2017 21:48:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 24 Mar 2017 21:48:05 -0400    

Click here for diff

Add more tests for various variants of subscription DDL commands, based  
on code coverage report.  Fix a small bug discovered by that.  

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

Fix typo in comment

commit   : 2e0c919bceae23a9fd52d6dc1c3bf0d74501c14f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 24 Mar 2017 17:20:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 24 Mar 2017 17:20:55 -0300    

Click here for diff

M src/backend/utils/mmgr/dsa.c

Fix stats_ext test in 32 bit machines

commit   : 6e9aaf6e471b446e5ccad6e9e174c3490978ae13    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 24 Mar 2017 16:14:34 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 24 Mar 2017 16:14:34 -0300    

Click here for diff

Because tuple packing is different (because of the MAXALIGN difference),  
the expected costs of a seqscan is different.  
  
The commonly used trick of eliding costs in EXPLAIN output (COSTS OFF)  
would make the tests completely pointless.  Instead, add an alternative  
expected file.  

A src/test/regress/expected/stats_ext_1.out

Check that published table exists on subscriber

commit   : 176cbc2a25a1c0db97ec8977545bb16fe3ea5809    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 24 Mar 2017 14:44:11 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 24 Mar 2017 14:44:11 -0400    

Click here for diff

Author: Petr Jelinek <[email protected]>  

M src/backend/commands/subscriptioncmds.c

Improve access to parallel query from procedural languages.

commit   : 61c2e1a95f94bb904953a6281ce17a18ac38ee6d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 24 Mar 2017 14:46:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 24 Mar 2017 14:46:33 -0400    

Click here for diff

In SQL, the ability to use parallel query was previous contingent on  
fcache->readonly_func, which is only set for non-volatile functions;  
but the volatility of a function has no bearing on whether queries  
inside it can use parallelism.  Remove that condition.  
  
SPI_execute and SPI_execute_with_args always run the plan just once,  
though not necessarily to completion.  Given the changes in commit  
691b8d59281b5177f16fe80858df921f77a8e955, it's sensible to pass  
CURSOR_OPT_PARALLEL_OK here, so do that.  This improves access to  
parallelism for any caller that uses these functions to execute  
queries.  Such callers include plperl, plpython, pltcl, and plpgsql,  
though it's not the case that they all use these functions  
exclusively.  
  
In plpgsql, allow parallel query for plain SELECT queries (as  
opposed to PERFORM, which already worked) and for plain expressions  
(which probably won't go through the executor at all, because they  
will likely be simple expressions, but if they do then this helps).  
  
Rafia Sabih and Robert Haas, reviewed by Dilip Kumar and Amit Kapila  
  
Discussion: http://postgr.es/m/CAOGQiiMfJ+4SQwgG=6CVHWoisiU0+7jtXSuiyXBM3y=A=eJzmg@mail.gmail.com  

M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/pl/plpgsql/src/pl_exec.c

Fix use-after-free bug

commit   : 8082bea2b06eb6bcd6cce4cc7801094c17045b4f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 24 Mar 2017 15:43:03 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 24 Mar 2017 15:43:03 -0300    

Click here for diff

Detected by buildfarm member prion  

M src/backend/commands/statscmds.c

Reverting 42b4b0b2413b9b472aaf2112a3bbfd80a6ab4dc5

commit   : 3428ef79115927c92c6e2ab6f261f5de5dc4e914    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 24 Mar 2017 17:56:17 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 24 Mar 2017 17:56:17 +0000    

Click here for diff

Buildfarm issues and other reported issues  

M src/backend/access/transam/xact.c
M src/backend/utils/time/snapmgr.c
M src/include/utils/snapmgr.h

Make VACUUM VERBOSE report the number of skipped frozen pages.

commit   : 70adf2fbe18f83f34b576ee83f42ea9d28375bf0    
  
author   : Fujii Masao <[email protected]>    
date     : Sat, 25 Mar 2017 02:39:44 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sat, 25 Mar 2017 02:39:44 +0900    

Click here for diff

Previously manual VACUUM did not report the number of skipped frozen  
pages even when VERBOSE option is specified. But this information is  
helpful to monitor the VACUUM activity, and also autovacuum reports that  
number in the log file when the condition of log_autovacuum_min_duration  
is met.  
  
This commit changes VACUUM VERBOSE so that it reports the number  
of frozen pages that it skips.  
  
Author: Masahiko Sawada  
Reviewed-by: Yugo Nagata and Jim Nasby  
  
Discussion: http://postgr.es/m/CAD21AoDZQKCxo0L39Mrq08cONNkXQKXuh=2DP1Q8ebmt35SoaA@mail.gmail.com  

M doc/src/sgml/ref/vacuum.sgml
M src/backend/commands/vacuumlazy.c

Implement multivariate n-distinct coefficients

commit   : 7b504eb282ca2f5104b5c00b4f05a3ef6bb1385b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 24 Mar 2017 14:06:10 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 24 Mar 2017 14:06:10 -0300    

Click here for diff

Add support for explicitly declared statistic objects (CREATE  
STATISTICS), allowing collection of statistics on more complex  
combinations that individual table columns.  Companion commands DROP  
STATISTICS and ALTER STATISTICS ... OWNER TO / SET SCHEMA / RENAME are  
added too.  All this DDL has been designed so that more statistic types  
can be added later on, such as multivariate most-common-values and  
multivariate histograms between columns of a single table, leaving room  
for permitting columns on multiple tables, too, as well as expressions.  
  
This commit only adds support for collection of n-distinct coefficient  
on user-specified sets of columns in a single table.  This is useful to  
estimate number of distinct groups in GROUP BY and DISTINCT clauses;  
estimation errors there can cause over-allocation of memory in hashed  
aggregates, for instance, so it's a worthwhile problem to solve.  A new  
special pseudo-type pg_ndistinct is used.  
  
(num-distinct estimation was deemed sufficiently useful by itself that  
this is worthwhile even if no further statistic types are added  
immediately; so much so that another version of essentially the same  
functionality was submitted by Kyotaro Horiguchi:  
https://postgr.es/m/[email protected]  
though this commit does not use that code.)  
  
Author: Tomas Vondra.  Some code rework by Ɓlvaro.  
Reviewed-by: Dean Rasheed, David Rowley, Kyotaro Horiguchi, Jeff Janes,  
    Ideriha Takeshi  
Discussion: https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/allfiles.sgml
A doc/src/sgml/ref/alter_statistics.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/comment.sgml
A doc/src/sgml/ref/create_statistics.sgml
A doc/src/sgml/ref/drop_statistics.sgml
M doc/src/sgml/reference.sgml
M src/backend/Makefile
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/system_views.sql
M src/backend/commands/Makefile
M src/backend/commands/alter.c
M src/backend/commands/analyze.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
A src/backend/commands/statscmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/gram.y
A src/backend/statistics/Makefile
A src/backend/statistics/README
A src/backend/statistics/extended_stats.c
A src/backend/statistics/mvdistinct.c
M src/backend/tcop/utility.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/cache/syscache.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/heap.h
M src/include/catalog/indexing.h
M src/include/catalog/namespace.h
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_proc.h
A src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_type.h
M src/include/catalog/toasting.h
M src/include/commands/defrem.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/relation.h
A src/include/statistics/extended_stats_internal.h
A src/include/statistics/statistics.h
M src/include/utils/acl.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/syscache.h
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out
A src/test/regress/expected/stats_ext.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/alter_generic.sql
M src/test/regress/sql/object_address.sql
A src/test/regress/sql/stats_ext.sql
M src/test/regress/sql/type_sanity.sql

plpgsql: Don't generate parallel plans for RETURN QUERY.

commit   : f120b614e070aed39586d1443193738a149a90d4    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 24 Mar 2017 12:30:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 24 Mar 2017 12:30:39 -0400    

Click here for diff

Commit 7aea8e4f2daa4b39ca9d1309a0c4aadb0f7ed81b allowed a parallel  
plan to be generated when for a RETURN QUERY or RETURN QUERY EXECUTE  
statement in a PL/pgsql block, but that's a bad idea because plplgsql  
asks the executor for 50 rows at a time.  That means that we'll always  
be running serially a plan that was intended for parallel execution,  
which is not a good idea.  Fix by not requesting a parallel plan from  
the outset.  
  
Per discussion, back-patch to 9.6.  There is a slight risk that, due  
to optimizer error, somebody could have a case where the parallel plan  
executed serially is actually faster than the supposedly-best serial  
plan, but the consensus seems to be that that's not sufficient  
justification for leaving 9.6 unpatched.  
  
Discussion: http://postgr.es/m/CA+TgmoZ_ZuH+auEeeWnmtorPsgc_SmP+XWbDsJ+cWvWBSjNwDQ@mail.gmail.com  
Discussion: http://postgr.es/m/CA+TgmobXEhvHbJtWDuPZM9bVSLiTj-kShxQJ2uM5GPDze9fRYA@mail.gmail.com  

M src/pl/plpgsql/src/pl_exec.c

Add a txid_status function.

commit   : 857ee8e391ff6654ef9dcc5dd8b658d7709d0a3c    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 24 Mar 2017 12:00:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 24 Mar 2017 12:00:53 -0400    

Click here for diff

If your connection to the database server is lost while a COMMIT is  
in progress, it may be difficult to figure out whether the COMMIT was  
successful or not.  This function will tell you, provided that you  
don't wait too long to ask.  It may be useful in other situations,  
too.  
  
Craig Ringer, reviewed by Simon Riggs and by me  
  
Discussion: http://postgr.es/m/CAMsr+YHQiWNEi0daCTboS40T+V5s_+dst3PYv_8v2wNVH+Xx4g@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/txid.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
A src/test/recovery/t/011_crash_recovery.pl
M src/test/regress/expected/txid.out
M src/test/regress/sql/txid.sql

Avoid SnapshotResetXmin() during AtEOXact_Snapshot()

commit   : 42b4b0b2413b9b472aaf2112a3bbfd80a6ab4dc5    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 24 Mar 2017 14:20:59 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 24 Mar 2017 14:20:59 +0000    

Click here for diff

For normal commits and aborts we already reset PgXact->xmin  
Avoiding touching highly contented shmem improves concurrent  
performance.  
  
Simon Riggs  
  
Discussion: CANP8+jJdXE9b+b9F8CQT-LuxxO0PBCB-SZFfMVAdp+akqo4zfg@mail.gmail.com  

M src/backend/access/transam/xact.c
M src/backend/utils/time/snapmgr.c
M src/include/utils/snapmgr.h

Handle empty result set in libpqrcv_exec

commit   : 8398c836892fde2b99139cc4711e57b7e59582b6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 24 Mar 2017 08:41:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 24 Mar 2017 08:41:32 -0400    

Click here for diff

Always return tupleslot and tupledesc from libpqrcv_exec.  This avoids  
requiring callers to handle that separately.  
  
Author: Petr Jelinek <[email protected]>  
Reported-by: Michael Banck <[email protected]>  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Allow SCRAM authentication, when pg_hba.conf says 'md5'.

commit   : 7ac955b34791500069179e1ea986f46d510126d9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 24 Mar 2017 13:32:21 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 24 Mar 2017 13:32:21 +0200    

Click here for diff

If a user has a SCRAM verifier in pg_authid.rolpassword, there's no reason  
we cannot attempt to perform SCRAM authentication instead of MD5. The worst  
that can happen is that the client doesn't support SCRAM, and the  
authentication will fail. But previously, it would fail for sure, because  
we would not even try. SCRAM is strictly more secure than MD5, so there's  
no harm in trying it. This allows for a more graceful transition from MD5  
passwords to SCRAM, as user passwords can be changed to SCRAM verifiers  
incrementally, without changing pg_hba.conf.  
  
Refactor the code in auth.c to support that better. Notably, we now have to  
look up the user's pg_authid entry before sending the password challenge,  
also when performing MD5 authentication. Also simplify the concept of a  
"doomed" authentication. Previously, if a user had a password, but it had  
expired, we still performed SCRAM authentication (but always returned error  
at the end) using the salt and iteration count from the expired password.  
Now we construct a fake salt, like we do when the user doesn't have a  
password or doesn't exist at all. That simplifies get_role_password(), and  
we can don't need to distinguish the  "user has expired password", and  
"user does not exist" cases in auth.c.  
  
On second thoughts, also rename uaSASL to uaSCRAM. It refers to the  
mechanism specified in pg_hba.conf, and while we use SASL for SCRAM  
authentication at the protocol level, the mechanism should be called SCRAM,  
not SASL. As a comparison, we have uaLDAP, even though it looks like the  
plain 'password' authentication at the protocol level.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  
Reviewed-by: Michael Paquier  

M doc/src/sgml/client-auth.sgml
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/include/libpq/crypt.h
M src/include/libpq/hba.h
M src/include/libpq/scram.h
M src/test/authentication/t/001_password.pl

Fix backup canceling

commit   : 78874531baf99769468dedfff19aa7e2068bc5e5    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 24 Mar 2017 13:53:40 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 24 Mar 2017 13:53:40 +0300    

Click here for diff

Assert-enabled build crashes but without asserts it works by wrong way:  
it may not reset forcing full page write and preventing from starting  
exclusive backup with the same name as cancelled.  
Patch replaces pair of booleans  
nonexclusive_backup_running/exclusive_backup_running to single enum to  
correctly describe backup state.  
  
Backpatch to 9.6 where bug was introduced  
  
Reported-by: David Steele  
Authors: Michael Paquier, David Steele  
Reviewed-by: Anastasia Lubennikova  
  
https://commitfest.postgresql.org/13/1068/  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/include/access/xlog.h

Avoid syntax error on platforms that have neither LOCALE_T nor ICU.

commit   : 457a4448732881b5008f7a3bcca76fc299075ac3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Mar 2017 23:18:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Mar 2017 23:18:52 -0400    

Click here for diff

Buildfarm member anole sees this union as empty, and doesn't like it.  

M src/include/utils/pg_locale.h

doc: add missing closing 'sect3' tag for ICU patch

commit   : 218747d2cf3cc1536ff77435e596280e0e739760    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 23 Mar 2017 16:59:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 23 Mar 2017 16:59:24 -0400    

Click here for diff

M doc/src/sgml/charset.sgml

Add ICU_FLAGS to one more place

commit   : 2e0c17dc7809992e37441a4e39072373f5d99e0d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Mar 2017 16:53:10 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Mar 2017 16:53:10 -0400    

Click here for diff

Reported-by: Thomas Munro <[email protected]>  

M src/backend/snowball/Makefile

Fix crash in ICU patch

commit   : 524e0f7ac8e143e377b8acff24796d7e37b3a9b1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Mar 2017 16:31:39 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Mar 2017 16:31:39 -0400    

Click here for diff

This only happened with single-byte encodings.  

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

Fix enum definition.

commit   : c23b186ae9000f66e2abf783fe820913305fb616    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 23 Mar 2017 16:10:43 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 23 Mar 2017 16:10:43 -0400    

Click here for diff

Commit 249cf070e36721a65be74838c53acf8249faf935 assigned to one of  
the labels in the middle the value that should have been assigned  
to the first member of the enum.  Rushabh's patch didn't have that  
defect as submitted, but I managed to mess it up while editing.  
Repair.  

M src/include/pgstat.h

ICU support

commit   : eccfef81e1f73ee41f1d8bfe4fa4e80576945048    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Mar 2017 15:25:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Mar 2017 15:25:34 -0400    

Click here for diff

Add a column collprovider to pg_collation that determines which library  
provides the collation data.  The existing choices are default and libc,  
and this adds an icu choice, which uses the ICU4C library.  
  
The pg_locale_t type is changed to a union that contains the  
provider-specific locale handles.  Users of locale information are  
changed to look into that struct for the appropriate handle to use.  
  
Also add a collversion column that records the version of the collation  
when it is created, and check at run time whether it is still the same.  
This detects potentially incompatible library upgrades that can corrupt  
indexes and other structures.  This is currently only supported by  
ICU-provided collations.  
  
initdb initializes the default collation set as before from the `locale  
-a` output but also adds all available ICU locales with a "-x-icu"  
appended.  
  
Currently, ICU-provided collations can only be explicitly named  
collations.  The global database locales are still always libc-provided.  
  
ICU support is enabled by configure --with-icu.  
  
Reviewed-by: Thomas Munro <[email protected]>  
Reviewed-by: Andreas Karlsson <[email protected]>  

M aclocal.m4
A config/pkg.m4
M configure
M configure.in
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/ref/alter_collation.sgml
M doc/src/sgml/ref/create_collation.sgml
M src/Makefile.global.in
M src/backend/Makefile
M src/backend/catalog/pg_collation.c
M src/backend/commands/collationcmds.c
M src/backend/common.mk
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/regex/regc_pg_locale.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/mb/encnames.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_collation_fn.h
M src/include/catalog/pg_proc.h
M src/include/commands/collationcmds.h
M src/include/mb/pg_wchar.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/pg_config.h.in
M src/include/utils/pg_locale.h
M src/test/regress/GNUmakefile
A src/test/regress/expected/collate.icu.out
M src/test/regress/expected/collate.linux.utf8.out
A src/test/regress/sql/collate.icu.sql
M src/test/regress/sql/collate.linux.utf8.sql

Track the oldest XID that can be safely looked up in CLOG.

commit   : ea42cc18c35381f639d45628d792e790ff39e271    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 23 Mar 2017 14:08:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 23 Mar 2017 14:08:23 -0400    

Click here for diff

This provides infrastructure for looking up arbitrary, user-supplied  
XIDs without a risk of scary-looking failures from within the clog  
module.  Normally, the oldest XID that can be safely looked up in CLOG  
is the same as the oldest XID that can reused without causing  
wraparound, and the latter is already tracked.  However, while  
truncation is in progress, the values are different, so we must  
keep track of them separately.  
  
Craig Ringer, reviewed by Simon Riggs and by me.  
  
Discussion: http://postgr.es/m/CAMsr+YHQiWNEi0daCTboS40T+V5s_+dst3PYv_8v2wNVH+Xx4g@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/transam.c
M src/backend/access/transam/varsup.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/clog.h
M src/include/access/transam.h
M src/include/access/xlog_internal.h

Remove createlang and droplang

commit   : 50c956add83963d7bbb367dd0b879fccddebd623    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Mar 2017 14:16:45 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Mar 2017 14:16:45 -0400    

Click here for diff

They have been deprecated since PostgreSQL 9.1.  
  
Reviewed-by: Magnus Hagander <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  

M doc/src/sgml/installation.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/ref/allfiles.sgml
M doc/src/sgml/ref/create_function.sgml
M doc/src/sgml/ref/create_language.sgml
D doc/src/sgml/ref/createlang.sgml
M doc/src/sgml/ref/drop_language.sgml
D doc/src/sgml/ref/droplang.sgml
M doc/src/sgml/reference.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/xplang.sgml
M src/bin/scripts/.gitignore
M src/bin/scripts/Makefile
D src/bin/scripts/createlang.c
D src/bin/scripts/droplang.c
M src/bin/scripts/nls.mk
D src/bin/scripts/t/030_createlang.pl
D src/bin/scripts/t/060_droplang.pl
M src/tools/msvc/Install.pm

Allow for parallel execution whenever ExecutorRun() is done only once.

commit   : 691b8d59281b5177f16fe80858df921f77a8e955    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 23 Mar 2017 13:05:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 23 Mar 2017 13:05:48 -0400    

Click here for diff

Previously, it was unsafe to execute a plan in parallel if  
ExecutorRun() might be called with a non-zero row count.  However,  
it's quite easy to fix things up so that we can support that case,  
provided that it is known that we will never call ExecutorRun() a  
second time for the same QueryDesc.  Add infrastructure to signal  
this, and cross-checks to make sure that a caller who claims this is  
true doesn't later reneg.  
  
While that pattern never happens with queries received directly from a  
client -- there's no way to know whether multiple Execute messages  
will be sent unless the first one requests all the rows -- it's pretty  
common for queries originating from procedural languages, which often  
limit the result to a single tuple or to a user-specified number of  
tuples.  
  
This commit doesn't actually enable parallelism in any additional  
cases, because currently none of the places that would be able to  
benefit from this infrastructure pass CURSOR_OPT_PARALLEL_OK in the  
first place, but it makes it much more palatable to pass  
CURSOR_OPT_PARALLEL_OK in places where we currently don't, because it  
eliminates some cases where we'd end up having to run the parallel  
plan serially.  
  
Patch by me, based on some ideas from Rafia Sabih and corrected by  
Rafia Sabih based on feedback from Dilip Kumar and myself.  
  
Discussion: http://postgr.es/m/CA+TgmobXEhvHbJtWDuPZM9bVSLiTj-kShxQJ2uM5GPDze9fRYA@mail.gmail.com  

M contrib/auto_explain/auto_explain.c
M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/matview.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/include/executor/execdesc.h
M src/include/executor/executor.h
M src/include/tcop/pquery.h
M src/include/utils/portal.h

Reduce page locking in GIN vacuum

commit   : 218f51584d5a9fcdf702bcc7f54b5b65e255c187    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 23 Mar 2017 19:38:47 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 23 Mar 2017 19:38:47 +0300    

Click here for diff

GIN vacuum during cleaning posting tree can lock this whole tree for a long  
time with by holding LockBufferForCleanup() on root. Patch changes it with  
two ways: first, cleanup lock will be taken only if there is an empty page  
(which should be deleted) and, second, it tries to lock only subtree, not the  
whole posting tree.  
  
Author: Andrey Borodin with minor editorization by me  
Reviewed-by: Jeff Davis, me  
  
https://commitfest.postgresql.org/13/896/  

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

Remove trailing comma from enum definition

commit   : 73561013e5aa44a1669b2cb4351f5e2b29485efb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Mar 2017 11:58:11 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Mar 2017 11:58:11 -0400    

Click here for diff

Author: Petr Jelinek <[email protected]>  

M src/include/replication/walreceiver.h

Assorted compilation and test fixes

commit   : 128e6ee01dc9a8b7b0d3d3c8edc594ca9e51f993    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Mar 2017 11:44:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Mar 2017 11:44:43 -0400    

Click here for diff

related to 7c4f52409a8c7d85ed169bbbc1f6092274d03920, per build farm  
  
Author: Petr Jelinek <[email protected]>  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/include/replication/worker_internal.h

Minor spelling correction in comment Jon Nelson

commit   : 232c532213446701583e015ca55b5afb9c291445    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 23 Mar 2017 15:29:42 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 23 Mar 2017 15:29:42 +0000    

Click here for diff

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

Replication lag tracking for walsenders

commit   : 6912acc04f0bbcfdb799a120618507601e862490    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 23 Mar 2017 14:05:28 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 23 Mar 2017 14:05:28 +0000    

Click here for diff

Adds write_lag, flush_lag and replay_lag cols to pg_stat_replication.  
  
Implements a lag tracker module that reports the lag times based upon  
measurements of the time taken for recent WAL to be written, flushed and  
replayed and for the sender to hear about it. These times  
represent the commit lag that was (or would have been) introduced by each  
synchronous commit level, if the remote server was configured as a  
synchronous standby.  For an asynchronous standby, the replay_lag column  
approximates the delay before recent transactions became visible to queries.  
If the standby server has entirely caught up with the sending server and  
there is no more WAL activity, the most recently measured lag times will  
continue to be displayed for a short time and then show NULL.  
  
Physical replication lag tracking is automatic. Logical replication tracking  
is possible but is the responsibility of the logical decoding plugin.  
Tracking is a private module operating within each walsender individually,  
with values reported to shared memory. Module not used outside of walsender.  
  
Design and code is good enough now to commit - kudos to the author.  
In many ways a difficult topic, with important and subtle behaviour so this  
shoudl be expected to generate discussion and multiple open items: Test now!  
  
Author: Thomas Munro, following designs by Fujii Masao and Simon Riggs  
Review: Simon Riggs, Ian Barwick and Craig Ringer  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xlog.c
M src/backend/catalog/system_views.sql
M src/backend/replication/walsender.c
M src/include/catalog/pg_proc.h
M src/include/replication/logical.h
M src/include/replication/walsender_private.h
M src/test/regress/expected/rules.out

Logical replication support for initial data copy

commit   : 7c4f52409a8c7d85ed169bbbc1f6092274d03920    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Mar 2017 08:36:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Mar 2017 08:36:36 -0400    

Click here for diff

Add functionality for a new subscription to copy the initial data in the  
tables and then sync with the ongoing apply process.  
  
For the copying, add a new internal COPY option to have the COPY source  
data provided by a callback function.  The initial data copy works on  
the subscriber by receiving COPY data from the publisher and then  
providing it locally into a COPY that writes to the destination table.  
  
A WAL receiver can now execute full SQL commands.  This is used here to  
obtain information about tables and publications.  
  
Several new options were added to CREATE and ALTER SUBSCRIPTION to  
control whether and when initial table syncing happens.  
  
Change pg_dump option --no-create-subscription-slots to  
--no-subscription-connect and use the new CREATE SUBSCRIPTION  
... NOCONNECT option for that.  
  
Author: Petr Jelinek <[email protected]>  
Tested-by: Erik Rijkers <[email protected]>  

M contrib/file_fdw/file_fdw.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/pg_dump.sgml
M src/backend/catalog/Makefile
M src/backend/catalog/heap.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/copy.c
M src/backend/commands/subscriptioncmds.c
M src/backend/parser/gram.y
M src/backend/postmaster/pgstat.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/Makefile
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/snapbuild.c
A src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/walsender.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/misc.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/misc/guc.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/catversion.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_proc.h
A src/include/catalog/pg_subscription_rel.h
M src/include/commands/copy.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/replnodes.h
M src/include/parser/kwlist.h
M src/include/pgstat.h
M src/include/replication/logical.h
M src/include/replication/logicallauncher.h
M src/include/replication/snapbuild.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/worker_internal.h
M src/include/utils/syscache.h
M src/test/regress/expected/object_address.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/subscription.out
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/subscription.sql
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
A src/test/subscription/t/004_sync.pl

Fix grammar in comment

commit   : 707576b571f05ec5b89adb65964d55f3ccccbd1b    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 23 Mar 2017 10:14:42 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 23 Mar 2017 10:14:42 +0100    

Click here for diff

Author: Emil Iggland  

M src/backend/commands/publicationcmds.c

Expose waitforarchive option through pg_stop_backup()

commit   : 017e4f2588a7fc6f2d1fbb6fff8afa1ff6e31f2b    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 22 Mar 2017 23:44:58 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 22 Mar 2017 23:44:58 -0400    

Click here for diff

Internally, we have supported the option to either wait for all of the  
WAL associated with a backup to be archived, or to return immediately.  
This option is useful to users of pg_stop_backup() as well, when they  
are reading the stop backup record position and checking that the WAL  
they need has been archived independently.  
  
This patch adds an additional, optional, argument to pg_stop_backup()  
which allows the user to indicate if they wish to wait for the WAL to be  
archived or not.  The default matches current behavior, which is to  
wait.  
  
Author: David Steele, with some minor changes, doc updates by me.  
Reviewed by: Takayuki Tsunakawa, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/backup.sgml
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/include/catalog/catversion.h
M src/include/catalog/pg_proc.h

doc: Improve CREATE PUBLICATION examples

commit   : cbf7ed51b8c0c3e506b91765769f76d5c2e1e9ac    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Mar 2017 15:26:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Mar 2017 15:26:59 -0400    

Click here for diff

M doc/src/sgml/ref/create_publication.sgml

doc: Fix logical replication setup instructions

commit   : b9418911900ff5b68a5457b1542668077664e897    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Mar 2017 15:26:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Mar 2017 15:26:04 -0400    

Click here for diff

The pg_hba.conf rules were changed in  
8df9bd0b445f9bd6134915d4417efde6e85e3add.  

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

doc: Markup and formatting improvements

commit   : a2760915b3a88f8e1b447dd5343549a1ebbb0f78    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Mar 2017 15:11:13 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Mar 2017 15:11:13 -0400    

Click here for diff

M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/drop_subscription.sgml

Fix wrong costing of Sort under Gather Merge.

commit   : dc02c7bca4dccf7de278cdc6b3325a829e75b252    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 22 Mar 2017 14:42:03 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 22 Mar 2017 14:42:03 -0400    

Click here for diff

There's no mechanism for such a sort to become a top-N sort, so we  
should pass -1 rather than limit_tuples to cost_sort().  
  
Rushabh Lathia, per a report from Mithun Cy  
  
Discussion: http://postgr.es/m/CAGPqQf1akRcSgC9=6iwx=sEPap9UvPpHJLzg8_N+OuHdb6fL+g@mail.gmail.com  

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

Support multiple RADIUS servers

commit   : 6b76f1bb58f53aec25cfec76391270ea36ad1170    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 22 Mar 2017 17:55:16 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 22 Mar 2017 17:55:16 +0100    

Click here for diff

This changes all the RADIUS related parameters (radiusserver,  
radiussecret, radiusport, radiusidentifier) to be plural and to accept a  
comma separated list of servers, which will be tried in order.  
  
Reviewed by Adam Brightwell  

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

Correct erroneous comment in GetOldestXmin()

commit   : c137c68ea6bfe860c3e5f4edee7031e136ba4f0c    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 22 Mar 2017 16:58:12 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 22 Mar 2017 16:58:12 +0000    

Click here for diff

Craig Ringer  

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

Refactor GetOldestXmin() to use flags

commit   : af4b1a0869bd3bb52e5f662e4491554b7f611489    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 22 Mar 2017 16:51:01 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 22 Mar 2017 16:51:01 +0000    

Click here for diff

Replace ignoreVacuum parameter with more flexible flags.  
  
Author: Eiji Seki  
Review: Haribabu Kommi  

M contrib/pg_visibility/pg_visibility.c
M contrib/pgstattuple/pgstatapprox.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/index.c
M src/backend/commands/analyze.c
M src/backend/commands/vacuum.c
M src/backend/replication/walreceiver.c
M src/backend/storage/ipc/procarray.c
M src/include/storage/proc.h
M src/include/storage/procarray.h

Assign AccessExclusiveLocks against subxacts in Hot Standby

commit   : 49bff5300d527f28c7670cdfad9e4a1b8f5ccdea    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 22 Mar 2017 16:37:28 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 22 Mar 2017 16:37:28 +0000    

Click here for diff

Previously AELs were registered against the top-level xid, which could  
cause locks to be held much longer than necessary in some cases during  
Hot Standby replay. We now record locks directly against their appropriate  
xids. Requires few code changes because original code allowed for this  
situation but didnā€™t fully implement it.  
  
Discussion: CAKJS1f9vJ841HY=wonnLVbfkTWGYWdPN72VMxnArcGCjF3SywA@mail.gmail.com  
  
Author: Simon Riggs and David Rowley  

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

Change logical replication pg_hba.conf use

commit   : 8df9bd0b445f9bd6134915d4417efde6e85e3add    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Feb 2017 16:50:29 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Feb 2017 16:50:29 -0500    

Click here for diff

Logical replication no longer uses the "replication" keyword.  It just  
matches database entries in the normal way.  The "replication" keyword  
now only applies to physical replication.  
  
Reviewed-by: Petr Jelinek <[email protected]>  

M doc/src/sgml/client-auth.sgml
M doc/src/sgml/logical-replication.sgml
M src/backend/libpq/hba.c

Refine rules for altering publication owner

commit   : 4cfc9484d4effb0a3aa2c8742bdef0c2bc7a3ca5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Feb 2017 08:57:45 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Feb 2017 08:57:45 -0500    

Click here for diff

Previously, the new owner had to be a superuser.  The new rules are more  
refined similar to other objects.  
  
Reviewed-by: Petr Jelinek <[email protected]>  

M doc/src/sgml/ref/alter_publication.sgml
M src/backend/commands/publicationcmds.c
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Sync pg_dump and pg_dumpall output

commit   : 96a7128b7b4c9ce4fb51df8c8b216dfab6340766    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 22 Mar 2017 10:00:30 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 22 Mar 2017 10:00:30 -0400    

Click here for diff

Before exiting any files are fsync'ed. A --no-sync option is also  
provided for a faster exit if desired.  
  
Michael Paquier.  
  
Reviewed by Albe Laurenz  
  
Discussion: https://postgr.es/m/CAB7nPqS1uZ=Ov+UruW6jr3vB-S_DLVMPc0dQpV-fTDjmm0ZQMg@mail.gmail.com  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_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_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/common/file_utils.c
M src/include/common/file_utils.h

Improve performance of replay of AccessExclusiveLocks

commit   : 9b013dc238cefa2860b384a3fa016ad1ceb062e4    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 22 Mar 2017 13:09:36 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 22 Mar 2017 13:09:36 +0000    

Click here for diff

A hot standby replica keeps a list of Access Exclusive locks for a top  
level transaction. These locks are released when the top level transaction  
ends. Searching of this list is O(N^2), and each transaction had to pay the  
price of searching this list for locks, even if it didn't take any AE  
locks itself.  
  
This patch optimizes this case by having the master server track which  
transactions took AE locks, and passes that along to the standby server in  
the commit/abort record. This allows the standby to only try to release  
locks for transactions which actually took any, avoiding the majority of  
the performance issue.  
  
Refactor MyXactAccessedTempRel into MyXactFlags to allow minimal additional  
cruft with this.  
  
Analysis and initial patch by David Rowley  
Author: David Rowley and Simon Riggs  

M src/backend/access/heap/heapam.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/commands/tablecmds.c
M src/backend/storage/ipc/standby.c
M src/include/access/xact.h

Teach xlogreader to follow timeline switches

commit   : 1148e22a82edc96172fc78855da392b6f0015c88    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 22 Mar 2017 07:05:12 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 22 Mar 2017 07:05:12 +0000    

Click here for diff

Uses page-based mechanism to ensure weā€™re using the correct timeline.  
  
Tests are included to exercise the functionality using a cold disk-level copy  
of the master that's started up as a replica with slots intact, but the  
intended use of the functionality is with later features.  
  
Craig Ringer, reviewed by Simon Riggs and Andres Freund  

M src/backend/access/transam/xlogutils.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/walsender.c
M src/include/access/xlogreader.h
M src/include/access/xlogutils.h
M src/test/recovery/Makefile
A src/test/recovery/t/010_logical_decoding_timelines.pl

Avoid Perl warning

commit   : 9ca2dd578db4086ae8a6eb6fd82ac376b7b2804e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Mar 2017 00:18:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Mar 2017 00:18:49 -0400    

Click here for diff

Perl versions before 5.12 would warn "Use of implicit split to @_ is  
deprecated".  
  
Author: Jeff Janes <[email protected]>  

M src/test/recovery/t/006_logical_decoding.pl

pg_dump: Only dump publications when dumping everything

commit   : 05227e0c345247c9e9ff91445850f414e2b0bb70    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Mar 2017 23:19:09 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Mar 2017 23:19:09 -0400    

Click here for diff

Don't dump publications with pg_dump -t or similar cases that select  
specific groups of objects.  
  
Author: Petr Jelinek <[email protected]>  

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

doc: Update tool sets documentation for modern FreeBSD

commit   : 9212810c4f4a596fc398644e96925a8a0f0332e8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Mar 2017 22:09:40 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Mar 2017 22:09:40 -0400    

Click here for diff

For several operating systems, we give handy package manager one-liners  
to install all the requirements for building our documentation.  All  
current production FreeBSD releases have a friendly new package manager  
a bit like apt/yum, so give a one line command here.  Also, add a brief  
note about gmake vs make in the doc subdirectory.  
  
Author: Thomas Munro <[email protected]>  

M doc/src/sgml/docguide.sgml

Document btree_gin support for enums

commit   : 80275561fffb58e48da2d3fd72b72a3bfbee8669    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 21 Mar 2017 11:11:42 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 21 Mar 2017 11:11:42 -0400    

Click here for diff

M doc/src/sgml/btree-gin.sgml

Add btree_gin support for enum types

commit   : 4ad0f88c443ca60de9b65cd0afd794fb80b10d86    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 21 Mar 2017 11:04:17 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 21 Mar 2017 11:04:17 -0400    

Click here for diff

Reviewed by Tom Lane and Anastasia Lubennikova  
  
Discussion:  http://postgr.es/m/[email protected]  

M contrib/btree_gin/Makefile
A contrib/btree_gin/btree_gin–1.1–1.2.sql
M contrib/btree_gin/btree_gin.c
M contrib/btree_gin/btree_gin.control
A contrib/btree_gin/expected/enum.out
A contrib/btree_gin/sql/enum.sql

Add btree_gist support for enum types.

commit   : f7946a92b689199cba64e7406a1c12d12637168a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 21 Mar 2017 10:19:03 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 21 Mar 2017 10:19:03 -0400    

Click here for diff

This will allow enums to be used in exclusion constraints.  
  
The code uses the new CallerFInfoFunctionCall infrastructure in fmgr,  
and the support for it added to btree_gist in commit 393bb504d7.  
  
Reviewed by Tom Lane and Anastasia Lubennikova  
  
Discussion:  http://postgr.es/m/[email protected]  

M contrib/btree_gist/Makefile
A contrib/btree_gist/btree_enum.c
A contrib/btree_gist/btree_gist–1.4–1.5.sql
M contrib/btree_gist/btree_gist.control
M contrib/btree_gist/btree_gist.h
M contrib/btree_gist/btree_utils_num.c
A contrib/btree_gist/data/enum.data
A contrib/btree_gist/expected/enum.out
A contrib/btree_gist/sql/enum.sql
M doc/src/sgml/btree-gist.sgml

Use CallerFInfoFunctionCall with btree_gist for varlena types

commit   : 65a9138b9b66b2c915619344ca56f4f0d531ada7    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 21 Mar 2017 09:53:35 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 21 Mar 2017 09:53:35 -0400    

Click here for diff

Follow up to commit 393bb504d7 which did this for numeric types.  

M contrib/btree_gist/btree_bit.c
M contrib/btree_gist/btree_bytea.c
M contrib/btree_gist/btree_numeric.c
M contrib/btree_gist/btree_text.c
M contrib/btree_gist/btree_utils_var.c
M contrib/btree_gist/btree_utils_var.h

Use CallerFInfoFunctionCall with btree_gist for numeric types

commit   : 4b1c68d63e8651094cfe0631682acd999652ea70    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 21 Mar 2017 09:12:46 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 21 Mar 2017 09:12:46 -0400    

Click here for diff

None of the existing types actually need to use this mechanism, but this  
will allow support for enum types which will need it. A separate patch  
will adjust the varlena types support for consistency.  
  
Reviewed by Tom Lane and Anastasia Lubennikova  
  
Discussion:  http://postgr.es/m/[email protected]  

M contrib/btree_gist/btree_cash.c
M contrib/btree_gist/btree_date.c
M contrib/btree_gist/btree_float4.c
M contrib/btree_gist/btree_float8.c
M contrib/btree_gist/btree_inet.c
M contrib/btree_gist/btree_int2.c
M contrib/btree_gist/btree_int4.c
M contrib/btree_gist/btree_int8.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_macaddr.c
M contrib/btree_gist/btree_macaddr8.c
M contrib/btree_gist/btree_oid.c
M contrib/btree_gist/btree_time.c
M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_utils_num.c
M contrib/btree_gist/btree_utils_num.h
M contrib/btree_gist/btree_uuid.c

Add a pg_recvlogical wrapper to PostgresNode

commit   : eb2a6131beccaad2b39629191508062b70d3a1c6    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 21 Mar 2017 14:04:49 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 21 Mar 2017 14:04:49 +0000    

Click here for diff

Allows testing of logical decoding using SQL interface and/or pg_recvlogical  
Most logical decoding tests are in contrib/test_decoding. This module  
is for work that doesn't fit well there, like where server restarts  
are required.  
  
Craig Ringer  

M src/test/perl/PostgresNode.pm
M src/test/recovery/t/006_logical_decoding.pl

Don't scan partitioned tables.

commit   : d3cc37f1d801a6b5cad9bf179274a8d767f1ee50    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 21 Mar 2017 09:48:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 21 Mar 2017 09:48:04 -0400    

Click here for diff

Partitioned tables do not contain any data; only their unpartitioned  
descendents need to be scanned.  However, the partitioned tables still  
need to be locked, even though they're not scanned.  To make that  
work, Append and MergeAppend relations now need to carry a list of  
(unscanned) partitioned relations that must be locked, and InitPlan  
must lock all partitioned result relations.  
  
Aside from the obvious advantage of avoiding some work at execution  
time, this has two other advantages.  First, it may improve the  
planner's decision-making in some cases since the empty relation  
might throw things off.  Second, it paves the way to getting rid of  
the storage for partitioned tables altogether.  
  
Amit Langote, reviewed by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeModifyTable.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/backend/utils/cache/plancache.c
M src/include/executor/executor.h
M src/include/nodes/nodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/planner.h
M src/test/regress/expected/inherit.out
M src/test/regress/expected/tablesample.out
M src/test/regress/sql/inherit.sql

Fix support for some operators (&<, &>, $<|, |&>) in box operator class of SP-GiST.

commit   : d5286aa905c9173b3fc4f911682089149bd3caef    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 21 Mar 2017 16:23:10 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 21 Mar 2017 16:23:10 +0300    

Click here for diff

Bug exists since initial commit of box opclass for SP-GiST,  
so backpath to 9.6  
  
Author: Nikita Glukhov with minor editorization of tests by me  
Reviewed-by: Kyotaro Horiguchi, Anastasia Lubennikova  
  
https://commitfest.postgresql.org/13/981/  

M src/backend/utils/adt/geo_spgist.c
M src/test/regress/expected/box.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/box.sql

Add a direct function call mechanism using the caller's context.

commit   : 29bf5016835a2c2c23786f7cda347716c083d95f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 21 Mar 2017 08:57:46 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 21 Mar 2017 08:57:46 -0400    

Click here for diff

The current DirectFunctionCall functions use NULL as the flinfo in  
initializing the FunctionCallInfoData for the call. That means the  
called function has no fn_mcxt or fn_extra to work with, and attempting  
to do so will result in an access violation. These functions instead use  
the provided flinfo, which will usually be the caller's own flinfo. The  
caller needs to ensure that it doesn't use the fn_extra in way that is  
incompatible with the way the called function will use it. The called  
function should not rely on anything else in the provided context, as it  
will be relevant to the caller, not the callee.  
  
Original code from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Improve markup

commit   : 010505546a343820f291e0e298673108e436c696    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Mar 2017 08:33:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Mar 2017 08:33:32 -0400    

Click here for diff

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

doc: clarify that function "ownership" that controls permission

commit   : 17fa3e834f288a2a8f0b3927d3f7f02451126686    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 20 Mar 2017 22:33:26 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 20 Mar 2017 22:33:26 -0400    

Click here for diff

It used to say the creation user.  
  
Reported-by: Nathan Wagner  

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

doc: adjust 'Infinity' example to include minus

commit   : 692ed0567d0a17013b8bc631ad6cab29470a944d    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 20 Mar 2017 22:22:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 20 Mar 2017 22:22:11 -0400    

Click here for diff

This clarifies that quoted infinity values must have the negative signs  
inside single quotes.  
  
Reported-by: Don Morrison  

M doc/src/sgml/datatype.sgml

Add missing support for new node fields

commit   : 8bc40533d61da972df63c0960965044dc485b147    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 20 Mar 2017 21:50:53 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 20 Mar 2017 21:50:53 -0400    

Click here for diff

Commit b6fb534f added two new node fields but neglected to add copy and  
comparison support for them, Mea culpa, should have checked for that.  
  
per buildfarm animals with -DCOPY_PARSE_PLAN_TREES  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c

doc: improve createdb example

commit   : c709b113e8f5433ea2a66b2fb08d9324dd596642    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 20 Mar 2017 21:23:56 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 20 Mar 2017 21:23:56 -0400    

Click here for diff

The previous example could error out due to encoding mismatches;  use  
-T/template instead.  
  
Reported-by: Jason O'Donnell  

M doc/src/sgml/ref/createdb.sgml

Force the regression databases to have bytea_output set to hex

commit   : aa740b59a6841d29a0ce0206e61e99ba9531eba4    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 20 Mar 2017 18:12:24 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 20 Mar 2017 18:12:24 -0400    

Click here for diff

Even if the installation defaults to escape output, this makes  
pg_regress make the setting hex, so that installcheck tests can pass in  
such a setting.  
  
Jeff Janes.  
  
Discussion: http://postgr.es/m/CAMkU=1xivkTNeyCfzhwdHJ+VH5qpU+4gsipRNuEUbyQf+KN3Kw@mail.gmail.com  

M src/test/regress/pg_regress.c

Add IF NOT EXISTS for CREATE SERVER and CREATE USER MAPPING

commit   : b6fb534f10e1dea17dc5641f44cc651b8d60d8f0    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 20 Mar 2017 16:40:45 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 20 Mar 2017 16:40:45 -0400    

Click here for diff

There is still some inconsistency with the error messages surrounding  
foreign servers. Some use the word "foreign" and some don't. My  
inclination is to remove all such uses of "foreign" on the basis that  
the  CREATE/ALTER/DROP SERVER commands don't use the word. However, that  
is left for another day. In this patch I have kept to the existing usage  
in the affected commands, which omits "foreign".  
  
Anastasia Lubennikova, reviewed by Arthur Zakirov and Ashtosh Bapat.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_server.sgml
M doc/src/sgml/ref/create_user_mapping.sgml
M src/backend/commands/foreigncmds.c
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h
M src/test/regress/expected/foreign_data.out
M src/test/regress/sql/foreign_data.sql

Use a consistent error message style for user mappings.

commit   : 839cb0649a9f595a8534cdf14afbe89efb1757b1    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 20 Mar 2017 16:01:45 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 20 Mar 2017 16:01:45 -0400    

Click here for diff

User mappings are essentially anonymous, so messages referring to "user  
mapping foo on server bar" are wrong, and inconsistent with other error  
messages referring to user mappings. To be consistent with existing use,  
use "user mapping for foo on server bar" instead.  
  
I dropped the noise word "user" from the original suggestion to be  
consistent with other uses.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/commands/foreigncmds.c
M src/test/regress/expected/foreign_data.out

Another fix for single-page hash index vacuum.

commit   : 9abbf4727de746222ad8fc15b17348065389ae43    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 20 Mar 2017 15:55:27 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 20 Mar 2017 15:55:27 -0400    

Click here for diff

The WAL consistency checking code needed to be updated for the new  
page status bit, but that didn't get done previously.  
  
Ashutosh Sharma, reviewed by Amit Kapila  
  
Discussion: http://postgr.es/m/CAA4eK1LP_oz4EfMen14OjJuzN5CqPdfRkFFuA-MfkcfeE8zGyg@mail.gmail.com  

M src/backend/access/hash/hash_xlog.c

Fixes for single-page hash index vacuum.

commit   : 953477ca3526e28f9aeeb41d23b16eed0084c7d2    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 20 Mar 2017 15:49:09 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 20 Mar 2017 15:49:09 -0400    

Click here for diff

Clear LH_PAGE_HAS_DEAD_TUPLES during replay, similar to what gets done  
for btree.  Update hashdesc.c for xl_hash_vacuum_one_page.  
  
Oversights in commit 6977b8b7f4dfb40896ff5e2175cad7fdbda862eb spotted  
by Amit Kapila.  Patch by Ashutosh Sharma.  
  
Bump WAL version.  The original patch to make hash indexes write-ahead  
logged probably should have done this, and the single page vacuuming  
patch probably should have done it again, but better late than never.  
  
Discussion: http://postgr.es/m/CAA4eK1Kd=mJ9xreovcsh0qMiAj-QqCphHVQ_Lfau1DR9oVjASQ@mail.gmail.com  

M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/include/access/hash_xlog.h
M src/include/access/xlog_internal.h

Add configure test to see if the C compiler has gcc-style computed gotos.

commit   : bc18126a6bcb85b51dc082c3ef4417dc016ebd9c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Mar 2017 13:35:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Mar 2017 13:35:21 -0400    

Click here for diff

We'll need this for the upcoming patch to speed up expression evaluation.  
Might as well push it now to see if it behaves sanely in the buildfarm.  
  
Andres Freund  
  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Add .gitignore for src/test/authentication/tmp_check.

commit   : 14a72525d2cf88a024ade4c10944c7abb900dda9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 20 Mar 2017 18:27:36 +0100    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 20 Mar 2017 18:27:36 +0100    

Click here for diff

Michael Paquier  
  
Discussion: https://www.postgresql.org/message-id/CAB7nPqRZ_LNTCJ7gGjE_SpRanGoALfTgsxdauNsKq%2BLBRH9fxg%40mail.gmail.com  

A src/test/authentication/.gitignore

Add missed "make clean" logic in src/interfaces/libpq/Makefile.

commit   : 59bfb190f7a8c377a94822ffd4276fcb09650ff7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Mar 2017 12:51:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Mar 2017 12:51:45 -0400    

Click here for diff

Commit 818fd4a67 missed cleaning up the symlinks it added for various .c  
files imported from src/port and src/common.  Neatnik-ishly make the  
file lists in the "clean" target look exactly like the earlier lists of  
what to symlink in.  

M src/interfaces/libpq/Makefile

Improve regression test coverage for TID scanning.

commit   : be6c3d19fd454359f05176eb1add82d4fc6e7758    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Mar 2017 12:30:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Mar 2017 12:30:08 -0400    

Click here for diff

TidScan plan nodes were not systematically tested before.  These additions  
raise the LOC coverage number for the basic regression tests from 52% to  
92% in nodeTidscan.c, and from 60% to 93% in tidpath.c.  
  
Andres Freund, tweaked a bit by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Revert unintentional change in increasing usage count during pin of buffers, this makes buffer access strategy have no effect. Change was a part of commit 48354581a49c30f5757c203415aa8412d85b0f70 during 9.6 release cycle, so backpath to 9.6

commit   : 9cf6033281fdaf938b826545a643f951086d8671    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 20 Mar 2017 18:48:46 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 20 Mar 2017 18:48:46 +0300    

Click here for diff

Reported-by: Jim Nasby  
Author: Alexander Korotkov  
Reviewed-by: Jim Nasby, Andres Freund  
  
https://commitfest.postgresql.org/13/1029/  

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

commit   : de34123834c3fa465b97f65ded171888edbfbccf    
  
author   : Stephen Frost <[email protected]>    
date     : Sun, 19 Mar 2017 16:56:14 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sun, 19 Mar 2017 16:56:14 -0400    

Click here for diff

Not every platform supports non-default collations, as pointed out by  
the buildfarm, so skip collation-related regression tests in pg_dump  
when they aren't supported.  

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

Update obsolete comment

commit   : 839da3c7d9b76b178910ce2999f7cbbdf6e91f70    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 19 Mar 2017 17:06:44 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 19 Mar 2017 17:06:44 +0100    

Click here for diff

Commit ff27db5d changed this function to no longer return the start  
position, but forgot the comment.  

M src/bin/pg_basebackup/streamutil.c

doc: Fix a few typos and awkward links

commit   : 767ce36ff36747e334ce3e163d57d5376403db37    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 18 Mar 2017 23:43:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 18 Mar 2017 23:43:47 -0400    

Click here for diff

M doc/src/sgml/backup.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/protocol.sgml

Avoid use of already-closed relcache entry.

commit   : e3044f6184beac395e88b4e1230e6c9d449db7f2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Mar 2017 18:43:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Mar 2017 18:43:06 -0400    

Click here for diff

Oversight in commit 17f8ffa1e.  Per buildfarm member prion.  

M src/backend/commands/matview.c

Fix REFRESH MATERIALIZED VIEW to report activity to the stats collector.

commit   : 17f8ffa1e331cd0d95a3c4ccec66ea83d8b893c5    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Mar 2017 17:49:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Mar 2017 17:49:06 -0400    

Click here for diff

The non-concurrent code path for REFRESH MATERIALIZED VIEW failed to  
report its updates to the stats collector.  This is bad since it means  
auto-analyze doesn't know there's any work to be done.  Adjust it to  
report the refresh as a table truncate followed by insertion of an  
appropriate number of rows.  
  
Since a matview could contain more than INT_MAX rows, change the  
signature of pgstat_count_heap_insert() to accept an int64 rowcount.  
(The accumulator it's adding into is already int64, but existing  
callers could not insert more than a small number of rows at once,  
so the argument had been declared just "int n".)  
  
This is surely a bug fix, but changing pgstat_count_heap_insert()'s API  
seems too risky for the back branches.  Given the lack of previous  
complaints, I'm not sure it's a big enough problem to justify a kluge  
solution that would avoid that.  So, no back-patch, at least for now.  
  
Jim Mlodgenski, adjusted a bit by me  
  
Discussion: https://postgr.es/m/CAB_5SRchSz7-WmdO5szdiknG8Oj_GGqJytrk1KRd11yhcMs1KQ@mail.gmail.com  

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

doc: Improve wording

commit   : 27f1f585fd7ee749cacd3de8c2c77a457ef4c288    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 18 Mar 2017 17:40:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 18 Mar 2017 17:40:47 -0400    

Click here for diff

Link to CREATE and ALTER ROLE consistently, instead of mixing CREATE  
USER and ALTER ROLE.  

M doc/src/sgml/config.sgml

doc: Add markup

commit   : a72188a35bbd71a8cc29f10eab27d4140d296b9d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 18 Mar 2017 14:41:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 18 Mar 2017 14:41:47 -0400    

Click here for diff

M doc/src/sgml/installation.sgml

doc: Update compatibility claim

commit   : 5e86bb51eaeeb5c70f64102f46c4431cb12999e9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 18 Mar 2017 14:25:41 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 18 Mar 2017 14:25:41 -0400    

Click here for diff

Update outdated claim that TRUNCATE is a PostgreSQL extension.  
  
Add cross-links between DELETE and TRUNCATE references pages.  

M doc/src/sgml/ref/delete.sgml
M doc/src/sgml/ref/truncate.sgml

doc: Tweak reference page header style

commit   : cb5fa4130ed5bdd37a51ce8cade3c2a2461097b9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 18 Mar 2017 14:17:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 18 Mar 2017 14:17:28 -0400    

Click here for diff

Change the header style of references pages in HTML and PDF output to be  
more like the old style under DSSSL.  In particular, the page should  
start with a header containing the command name, instead of just "Name".  

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

Adjust number of tests for pg_dump 001_basic.pl

commit   : 805e8bc7029b6eb19f0ca3a68051cfda5bd07ef3    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 18 Mar 2017 13:53:29 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 18 Mar 2017 13:53:29 -0400    

Click here for diff

When removing a test, need to make sure the count of tests is adjusted  
when it isn't calculated.  

M src/bin/pg_dump/t/001_basic.pl

pg_dump: Remove "option requires an argument -- j" test

commit   : 5abda5a3e9e7f2a472ccbb1b8389d9166d4a9eca    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 18 Mar 2017 13:46:45 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 18 Mar 2017 13:46:45 -0400    

Click here for diff

This is really testing getopt more than pg_dump, and what getopt returns  
exactly appears to differ based on platform, so remove this test.  
  
Per buildfarm.  

M src/bin/pg_dump/t/001_basic.pl

Improve pg_dump regression tests and code coverage

commit   : 31a8b77a9244a0883e1968adcff9b6038e575d77    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 18 Mar 2017 13:18:24 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 18 Mar 2017 13:18:24 -0400    

Click here for diff

These improvements bring the lines-of-code coverage of pg_dump.c up to  
87.7% (at least using LCOV 1.12, 1.11 seems to differ slightly).  Nearly  
every function is covered, three of the four which aren't are only  
called when talking to older PG instances.  
  
There is more which can, and should, be done here to improve the  
coverage but it's past time to see what the buildfarm thinks of this.  
  
What has been added:  
  
- Coverage for many more command-line options  
- Use command_fails_like instead of command_exit_is  
- Operator classes, operator families  
- Text search configuration, templates, parsers, dictionaries  
- FDWs, servers, foreign tables  
- Materialized views  
- Improved Publications / Subscriptions test (though this needs work,  
  see PG10 open items and tests marked with XXX in 002_pg_dump.pl)  
- Unlogged tables  
- Partitioned tables  
- Additional ACL testing for various object types  
  
There is room for improvement, specifically:  
  
- Various type-based option (alignment, storage, etc)  
- Composite type collation  
- Extra Procedural language functions (inline, validator)  
- Different function options (SRF, Transform, config, security definer,  
  cost, leakproof)  
- OpClass options (default, storage, order by, recheck)  
- OpFamily options (order by, recheck)  
- Aggregate functions (combinefunc, serialfunc, deserialfunc, etc)  
- Text Search parser 'headline'  
- Text Search template 'init'  
- FDW options (handler, validator, options)  
- Server options (type, version, options)  
- User mapping options  
- Default ACLs for sequences, types  
- Security labels  
- View circular dependencies (last function that needs coverage)  
- Toast table autovacuum options  
- Replica identity options  
- Independent indexes (plus marking them as clustered on)  
- Deferrable / initially deferred constraints  
- Independent domain constraints  
  
There's bits of extension pg_dump'ing also not covered, but those will  
need to go into test_pg_dump (such as having a filter for config  
tables).  
  
Last, but not least, this approximately halves the number of tests run  
with 'ok()' by removing the ok()-based checking of if all runs are  
covered by each test.  Instead, 002_pg_dump.pl will just exit out in  
such a case (with a message in the log file).  In general, when adding  
tests, cover all runs unless there is a very good reason not to (such as  
adding a 'catch-all' case).  With these changes, the resulting output  
and number of "tests" run is actually reduced.  

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

doc: Correct row count in table

commit   : 164bdbe9c2412d90b62d6f145a43f9e41a90003b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 18 Mar 2017 09:42:26 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 18 Mar 2017 09:42:26 -0400    

Click here for diff

The incorrect count causes FOP to error out.  

M doc/src/sgml/monitoring.sgml

Create and use wait events for read, write, and fsync operations.

commit   : 249cf070e36721a65be74838c53acf8249faf935    
  
author   : Robert Haas <[email protected]>    
date     : Sat, 18 Mar 2017 07:43:01 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Sat, 18 Mar 2017 07:43:01 -0400    

Click here for diff

Previous commits, notably 53be0b1add7064ca5db3cd884302dfc3268d884e and  
6f3bd98ebfc008cbd676da777bb0b2376c4c4bfa, made it possible to see from  
pg_stat_activity when a backend was stuck waiting for another backend,  
but it's also fairly common for a backend to be stuck waiting for an  
I/O.  Add wait events for those operations, too.  
  
Rushabh Lathia, with further hacking by me.  Reviewed and tested by  
Michael Paquier, Amit Kapila, Rajkumar Raghuwanshi, and Rahila Syed.  
  
Discussion: http://postgr.es/m/CAGPqQf0LsYHXREPAZqYGVkDqHSyjf=KsD=k0GTVPAuzyThh-VQ@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogutils.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/replication/walsender.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/smgr/md.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/init/miscinit.c
M src/include/pgstat.h
M src/include/storage/fd.h

Fix schedule of ecpg test files to only try two-phase commit test when possible.

commit   : 928250aef5f8363825acbf58540328089c26b0d4    
  
author   : Michael Meskes <[email protected]>    
date     : Sat, 18 Mar 2017 10:35:14 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Sat, 18 Mar 2017 10:35:14 +0100    

Click here for diff

M src/interfaces/ecpg/test/Makefile
M src/interfaces/ecpg/test/ecpg_schedule

Fix WaitEventSetWait() to handle write-ready waits properly on Windows.

commit   : f7819baa618c528f60e266874051563ecfe08207    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Mar 2017 14:58:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Mar 2017 14:58:06 -0400    

Click here for diff

Windows apparently will not detect socket write-ready events unless a  
preceding send attempt returned WSAEWOULDBLOCK.  In many usage patterns  
that's satisfied by the caller of WaitEvenSetWait(), but not always.  
  
Apply the same solution that we already had in pgwin32_select(), namely to  
perform a dummy WSASend() call with len=0.  This will return WSAEWOULDBLOCK  
if there's no buffer space (even though it could legitimately do nothing  
and report success, which makes me a bit nervous about this solution;  
but since it's been working fine in libpq, let's roll with it).  
  
In passing, improve the comments about this in pgwin32_select(), and remove  
duplicated code there.  
  
Back-patch to 9.6 where WaitEventSetWait() was introduced.  We might need  
to back-patch something similar into predecessor code.  But given the lack  
of complaints so far, it's not clear that the case ever gets exercised  
in the back branches, so I'm not going to expend effort on it right now.  
  
This should resolve recurring failures on buildfarm member bowerbird,  
which has been failing since 1e8a85009 went in.  
  
Diagnosis and patch by Petr Jelinek, cosmetic adjustments by me.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/win32/socket.c
M src/backend/storage/ipc/latch.c

pageinspect: Add page_checksum function

commit   : fef2bcdcba0888c95ddf2a7535179c3b9a6a2f0e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Mar 2017 09:49:10 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Mar 2017 09:49:10 -0400    

Click here for diff

Author: Tomas Vondra <[email protected]>  
Reviewed-by: Ashutosh Sharma <[email protected]>  

M contrib/pageinspect/expected/page.out
M contrib/pageinspect/pageinspect–1.5–1.6.sql
M contrib/pageinspect/rawpage.c
M contrib/pageinspect/sql/page.sql
M doc/src/sgml/pageinspect.sgml

Repair test for vacuum reltuples fix.

commit   : 64ae420b275a82534732aafd9d550b9982ca0a5d    
  
author   : Andrew Gierth <[email protected]>    
date     : Fri, 17 Mar 2017 14:35:54 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Fri, 17 Mar 2017 14:35:54 +0000    

Click here for diff

Concurrent auto-analyze could be holding a snapshot, affecting the  
removal of deleted row versions.  Remove the deletion to avoid this  
happening.  Per buildfarm.  
  
In passing, make the test independent of assumptions of physical row  
order, just out of sheer paranoia.  

M src/test/isolation/expected/vacuum-reltuples.out
M src/test/isolation/specs/vacuum-reltuples.spec

Rename "pg_clog" directory to "pg_xact".

commit   : 88e66d193fbaf756b3cc9bf94cad116aacbb355b    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 17 Mar 2017 09:46:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 17 Mar 2017 09:46:58 -0400    

Click here for diff

Names containing the letters "log" sometimes confuse users into  
believing that only non-critical data is present.  It is hoped  
this renaming will discourage ill-considered removals of transaction  
status data.  
  
Michael Paquier  
  
Discussion: http://postgr.es/m/CA+Tgmoa9xFQyjRZupbdEFuwUerFTvC6HjZq1ud6GYragGDFFgA@mail.gmail.com  

M doc/src/sgml/backup.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/ref/pg_resetwal.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/storage.sgml
M doc/src/sgml/wal.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/transam/README
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/transam.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/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/backend/storage/buffer/README
M src/backend/storage/ipc/procarray.c
M src/backend/utils/time/tqual.c
M src/bin/initdb/initdb.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/include/access/slru.h

Remove dead link.

commit   : bd9028b824c9c5f97795bb6b7b6f5ce38eb69f98    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 17 Mar 2017 09:32:34 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 17 Mar 2017 09:32:34 -0400    

Click here for diff

David Christensen  
  
Discussion: http://postgr.es/m/[email protected]  

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

pageinspect: Add test for page_header function

commit   : a02731cb10535a6d5f66447295e7b8e22807f471    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Mar 2017 09:23:39 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Mar 2017 09:23:39 -0400    

Click here for diff

M contrib/pageinspect/expected/page.out
M contrib/pageinspect/sql/page.sql

Add TAP tests for password-based authentication methods.

commit   : aa7464d949bf69ce1e8697f77400ff6b7ebb2d18    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 17 Mar 2017 11:34:16 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 17 Mar 2017 11:34:16 +0200    

Click here for diff

Tests all combinations of users with MD5, plaintext and SCRAM verifiers  
stored in pg_authid, with plain 'password', 'md5' and 'scram'  
authentication methods.  
  
Michael Paquier  

M src/test/Makefile
M src/test/README
A src/test/authentication/Makefile
A src/test/authentication/README
A src/test/authentication/t/001_password.pl

Allow plaintext 'password' authentication when user has a SCRAM verifier.

commit   : c6305a9c572aaf3509ea90eec5127340dab89546    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 17 Mar 2017 11:33:27 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 17 Mar 2017 11:33:27 +0200    

Click here for diff

Oversight in the main SCRAM patch.  

M src/backend/libpq/auth-scram.c
M src/backend/libpq/crypt.c
M src/include/libpq/scram.h

Fix and simplify check for whether we're running as Windows service.

commit   : ff30aec759bdc4de78912d91f650ec8fd95ff6bc    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 17 Mar 2017 11:14:01 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 17 Mar 2017 11:14:01 +0200    

Click here for diff

If the process token contains SECURITY_SERVICE_RID, but it has been  
disabled by the SE_GROUP_USE_FOR_DENY_ONLY attribute, win32_is_service()  
would incorrectly report that we're running as a service. That situation  
arises, e.g. if postmaster is launched with a restricted security token,  
with the "Log in as Service" privilege explicitly removed.  
  
Replace the broken code with CheckProcessTokenMembership(), which does  
this correctly. Also replace similar code in win32_is_admin(), even  
though it got this right, for simplicity and consistency.  
  
Per bug #13755, reported by Breen Hagan. Back-patch to all supported  
versions. Patch by Takayuki Tsunakawa, reviewed by Michael Paquier.  
  
Discussion: https://www.postgresql.org/message-id/20151104062315.2745.67143%40wrigleys.postgresql.org  

M src/port/win32security.c

Fix grammar.

commit   : b4ff8609dbad541d287b332846442b076a25a6df    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 16 Mar 2017 20:29:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 16 Mar 2017 20:29:11 -0400    

Click here for diff

This would have ben grammatical if the closing tag name were actually  
part of the output, but of course it's not.  

M doc/src/sgml/func.sgml

psql: Add completion for \help DROP|ALTER

commit   : d7d77f3825122bde55be9e06f6c4851028b99795    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 16 Mar 2017 18:54:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 16 Mar 2017 18:54:28 -0400    

Click here for diff

While \help CREATE would complete usefully, \help DROP or \help ALTER  
did not complete anything.  
  
Expand the list of things after CREATE and DROP to cover ALTER as well,  
and use that for the ALTER completion.  Also make minor tweaks to that  
list.  
  
Also add support for completing \help on multiword commands like CREATE  
TEXT SEARCH ...  
  
Author: Andreas Karlsson <[email protected]>  

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

Avoid having vacuum set reltuples to 0 on non-empty relations in the presence of page pins, which leads to serious estimation errors in the planner. This particularly affects small heavily-accessed tables, especially where locking (e.g. from FK constraints) forces frequent vacuums for mxid cleanup.

commit   : 1914c5ea7daaaaba4420f65c991256af5d4a9813    
  
author   : Andrew Gierth <[email protected]>    
date     : Thu, 16 Mar 2017 22:28:03 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Thu, 16 Mar 2017 22:28:03 +0000    

Click here for diff

Fix by keeping separate track of pages whose live tuples were actually  
counted vs. pages that were only scanned for freezing purposes.  Thus,  
reltuples can only be set to 0 if all pages of the relation were  
actually counted.  
  
Backpatch to all supported versions.  
  
Per bug #14057 from Nicolas Baccelli, analyzed by me.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/vacuumlazy.c
A src/test/isolation/expected/vacuum-reltuples.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/vacuum-reltuples.spec

Avoid access to uninitialized memory in shared tidbitmap iteration.

commit   : 80824ddda30154d56c9f40fe47dd1900d44ced32    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 16 Mar 2017 15:07:26 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 16 Mar 2017 15:07:26 -0400    

Click here for diff

Primarily, this didn't work correctly when the tidbitmap ended up  
empty.  
  
Dilip Kumar, per a report from Emre Hasegeli  
  
Discussion: http://postgr.es/m/CAFiTN-ujHFKb8WSLhK54rfqQT3r2yiPQOyeBrCDsA4p9Fwp_jw@mail.gmail.com  

M src/backend/nodes/tidbitmap.c

Add pg_ls_logdir() and pg_ls_waldir() functions.

commit   : befd73c50f11a6c6a6719dae20f0de7b7585bef4    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 16 Mar 2017 15:05:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 16 Mar 2017 15:05:02 -0400    

Click here for diff

These functions are intended to be used by monitoring tools, and,  
unlike pg_ls_dir(), access to them can be granted to non-superusers,  
so that those monitoring tools can observe the principle of least  
privilege.  
  
Dave Page, revised by me, and also reviewed a bit by Thomas Munro.  
  
Discussion: http://postgr.es/m/CA+OCxow-X=D2fWdKy+HP+vQ1LtrgbsYQ=CshzZBqyFT5jOYrFw@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/adt/genfile.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h

postgres_fdw: Push down FULL JOINs with restriction clauses.

commit   : b30fb56b07a885f3476fe05920249f4832ca8da5    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 16 Mar 2017 13:34:59 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 16 Mar 2017 13:34:59 -0400    

Click here for diff

The previous deparsing logic wasn't smart enough to produce subqueries  
when deparsing; make it smart enough to do that.  However, we only do  
it that way when necessary, because it generates more complicated SQL  
which will be harder for any humans reading the queries to understand.  
  
Etsuro Fujita, reviewed by Ashutosh Bapat  
  
Discussion: http://postgr.es/m/[email protected]  

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

Fix ancient get_object_address_opf_member bug

commit   : a3eac988c26706059ae74c740a1abcb588449abe    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 16 Mar 2017 12:51:08 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 16 Mar 2017 12:51:08 -0300    

Click here for diff

The original coding was trying to use a TypeName as a string Value,  
which doesn't work; an oversight in my commit a61fd533.  Repair.  
  
Also, make sure we cover the broken case in the relevant test script.  
  
Backpatch to 9.5.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/object_address.out
M src/test/regress/sql/object_address.sql

Be more careful about signed vs. unsigned char

commit   : cccbddeb1483b85f1853a29dc3b6464647b91eee    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 16 Mar 2017 00:13:37 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 16 Mar 2017 00:13:37 -0400    

Click here for diff

The buildfarm has reminded me that not all systems consider char to be  
signed and we need to be explicit.  Adjust the various bits of mac8.c  
for what we intend, mostly using casts to unsigned char as suggested by  
Tom, and adjust the tests for valid input accordingly.  Explicitly make  
the hexlookup table signed as it's useful to use -1 there to indicate an  
invalid value.  

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

Clean up overly paranoid checks in mac8.c

commit   : 7821f7229c6e149046ee0dd8cab57928c4f86a37    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 15 Mar 2017 23:23:28 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 15 Mar 2017 23:23:28 -0400    

Click here for diff

Andres' compiler points out, quite correctly, that there's no need for  
some of the overly paranoid checks which were put into mac8.c.  Remove  
those, as they're useless, add some comments and make a few other minor  
improvements- reduce the size of hexlookup by making it a char array  
instead of an int array, and pass in the ptr location directly instead  
of making hex2_to_uchar re-calculate the location based off the offset  
every time.  

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

Port single-page btree vacuum logic to hash indexes.

commit   : 6977b8b7f4dfb40896ff5e2175cad7fdbda862eb    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Mar 2017 22:18:56 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Mar 2017 22:18:56 -0400    

Click here for diff

This is advantageous for hash indexes for the same reasons it's good  
for btrees: it accelerates space recycling, reducing bloat.  
  
Ashutosh Sharma, reviewed by Amit Kapila and by me.  A bit of  
additional hacking by me.  
  
Discussion: http://postgr.es/m/CAE9k0PkRSyzx8dOnokEpUi2A-RFZK72WN0h9DEMv_ut9q6bPRw@mail.gmail.com  

M src/backend/access/hash/README
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashsort.c
M src/backend/access/hash/hashutil.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/include/access/hash.h
M src/include/access/hash_xlog.h

Specify bindir in pg_isolation_regress_installcheck.

commit   : 2038bf41c963f9ec626f7f8f1f03f0471d063b6d    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 15 Mar 2017 19:03:29 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 15 Mar 2017 19:03:29 -0700    

Click here for diff

It appears dcae5faccab64776376d3 forgot to add it to  
pg_isolation_regress_installcheck, while it was added to  
pg_regress_installcheck.  It seems to so far have escaped notice,  
because buildfarm animals requiring it, didn't actually use  
pg_isolation_regress_installcheck anywhere - that changed with  
60f826c5e6244, triggering failures on narwhal and frogmouth.  
  
I've decided to not, for now at least, backpatch this, because the  
relevant invocations look quite different in the back branches.  Seems  
quite possible that we'll want to backport 60f826c5e6244 as a whole if  
it proves stable.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in

Simplify publication/subscription tests a bit

commit   : bd1827c7c961568eabe850df254c60d175bec195    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Mar 2017 16:52:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Mar 2017 16:52:12 -0400    

Click here for diff

After testing RENAME TO, rename the object back.  This reduces the merge  
mess when subsequent patches add test cases before or after the rename  
test.  

M src/test/regress/expected/publication.out
M src/test/regress/expected/subscription.out
M src/test/regress/sql/publication.sql
M src/test/regress/sql/subscription.sql

Fix typo

commit   : f2a9998fb34c768d8870bd34daa4c298999fee00    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Mar 2017 16:27:07 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Mar 2017 16:27:07 -0400    

Click here for diff

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

Add more documentation and tests for publications

commit   : e76db009f079ece9408e37336887bc6457cc1fc6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Mar 2017 13:52:07 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Mar 2017 13:52:07 -0400    

Click here for diff

Add/correct documentation and add some tests related to how access  
control around adding tables to publications works.  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/create_publication.sgml
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Rewrite async-connection loop in libpqwalreceiver.c, once again.

commit   : b5dd50f2c0ad8edcc3145aabe18788d448bf940d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Mar 2017 13:26:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Mar 2017 13:26:26 -0400    

Click here for diff

The original coding in commit 1e8a85009 didn't use PQconnectPoll per  
spec, and while the rewrite in e434ad39a is closer, it still doesn't  
guarantee to wait until the socket is read-ready or write-ready (as  
appropriate) before calling PQconnectPoll.  It's not clear whether  
that omission is causing the continuing failures on buildfarm member  
bowerbird; but given the lack of other explanations meeting the  
available facts, let's tighten that up and see what happens.  
  
An independent issue in the same loop was that it had a race condition  
whereby it could clear the process's latch without having serviced an  
interrupt request, causing failure to respond to a cancel while waiting  
for connection (the very problem 1e8a85009 was meant to fix).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Fix failure to use clamp_row_est() for parallel joins.

commit   : 1ea60ad602f9e97246958b721c8fa7c713aa86eb    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Mar 2017 12:28:54 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Mar 2017 12:28:54 -0400    

Click here for diff

Commit 0c2070cefa0e5d097b715c9a3b9b5499470019aa neglected to use  
clamp_row_est() where it should have done so.  
  
Patch by me.  Report by Amit Kapila.  
  
Discussion: http://postgr.es/m/CAA4eK1KPm8RYa1Kun3ZmQj9pb723b-EFN70j47Pid1vn3ByquA@mail.gmail.com  

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

Bump catversion for MACADDR8

commit   : c5832346625af4193b1242e57e7d13e66a220b38    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 15 Mar 2017 11:19:39 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 15 Mar 2017 11:19:39 -0400    

Click here for diff

Pointed out by Robert.  

M src/include/catalog/catversion.h

Add support for EUI-64 MAC addresses as macaddr8

commit   : c7a9fa399d557c6366222e90b35db31e45d25678    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 15 Mar 2017 11:16:25 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 15 Mar 2017 11:16:25 -0400    

Click here for diff

This adds in support for EUI-64 MAC addresses by adding a new data type  
called 'macaddr8' (using our usual convention of indicating the number  
of bytes stored).  
  
This was largely a copy-and-paste from the macaddr data type, with  
appropriate adjustments for having 8 bytes instead of 6 and adding  
support for converting a provided EUI-48 (6 byte format) to the EUI-64  
format.  Conversion from EUI-48 to EUI-64 inserts FFFE as the 4th and  
5th bytes but does not perform the IPv6 modified EUI-64 action of  
flipping the 7th bit, but we add a function to perform that specific  
action for the user as it may be commonly done by users who wish to  
calculate their IPv6 address based on their network prefix and 48-bit  
MAC address.  
  
Author: Haribabu Kommi, with a good bit of rework of macaddr8_in by me.  
Reviewed by: Vitaly Burovoy, Kuntal Ghosh  
  
Discussion: https://postgr.es/m/CAJrrPGcUi8ZH+KkK+=TctNQ+EfkeCEHtMU_yo1mvX8hsk_ghNQ@mail.gmail.com  

M contrib/btree_gin/Makefile
A contrib/btree_gin/btree_gin–1.0–1.1.sql
M contrib/btree_gin/btree_gin.c
M contrib/btree_gin/btree_gin.control
A contrib/btree_gin/expected/macaddr8.out
A contrib/btree_gin/sql/macaddr8.sql
M contrib/btree_gist/Makefile
A contrib/btree_gist/btree_gist–1.3–1.4.sql
M contrib/btree_gist/btree_gist.control
M contrib/btree_gist/btree_gist.h
A contrib/btree_gist/btree_macaddr8.c
A contrib/btree_gist/expected/macaddr8.out
A contrib/btree_gist/sql/macaddr8.sql
M doc/src/sgml/brin.sgml
M doc/src/sgml/btree-gin.sgml
M doc/src/sgml/btree-gist.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml
M src/backend/utils/adt/Makefile
M src/backend/utils/adt/mac.c
A src/backend/utils/adt/mac8.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/selfuncs.c
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_type.h
M src/include/utils/inet.h
A src/test/regress/expected/macaddr8.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/macaddr8.sql

Add a regression test for snapshot too old with hash indexes.

commit   : 42bdaebf161841c8e248b197b7319779b8730323    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Mar 2017 10:46:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Mar 2017 10:46:13 -0400    

Click here for diff

Amit Kapila, but I changed the comment not to be a copy-and-paste of  
an existing one, and instead referred to it.  
  
Discussion: http://postgr.es/m/CAA4eK1K0UJswCRf81WwJFO4H=+ZvbmKTNhAps-NkdmHRsq1GnQ@mail.gmail.com  

M src/test/modules/snapshot_too_old/Makefile
A src/test/modules/snapshot_too_old/expected/sto_using_hash_index.out
A src/test/modules/snapshot_too_old/specs/sto_using_hash_index.spec

Fix MB regression tests for WAL-logging of hash indexes.

commit   : d8f356e1bd3382308b32eed01394879e20eb5158    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Mar 2017 07:25:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Mar 2017 07:25:36 -0400    

Click here for diff

Thomas Munro noted that these files still contained the now-removed  
deprecation message in the expected output.  
  
Patch by Amit Kapila  
  
Discussion: http://postgr.es/m/CAEepm=16HW_C+MBA27aOV9t4tQBU-vf1BT_yhRUTWZVMd9bq8A@mail.gmail.com  

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

Cosmetic fixes for hash index write-ahead logging.

commit   : f7b711c8bcef46c67dc5345b983752ac833e51ad    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Mar 2017 07:21:17 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Mar 2017 07:21:17 -0400    

Click here for diff

Amit Kapila.  One of these was reported by Tom Lane.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/access/hash/README
M src/backend/access/hash/hashpage.c

Allow referring to functions without arguments when unique

commit   : aefeb68741fb9456f14b4d690b0c646e532fea6b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Mar 2017 23:58:48 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Mar 2017 23:58:48 -0500    

Click here for diff

In DDL commands referring to an existing function, allow omitting the  
argument list if the function name is unique in its schema, per SQL  
standard.  
  
This uses the same logic that the regproc type uses for finding  
functions by name only.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/ref/alter_extension.sgml
M doc/src/sgml/ref/alter_function.sgml
M doc/src/sgml/ref/alter_opfamily.sgml
M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/create_cast.sgml
M doc/src/sgml/ref/create_transform.sgml
M doc/src/sgml/ref/drop_function.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/revoke.sgml
M doc/src/sgml/ref/security_label.sgml
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_func.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/create_function_3.out
M src/test/regress/sql/create_function_3.sql

doc: Remove useless elements in bibliography

commit   : 3f6ea5fc8d9c6d7c85827c87a717be0016d06b89    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Mar 2017 23:30:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Mar 2017 23:30:01 -0400    

Click here for diff

Under DSSSL, bibliodiv/para elements didn't show up, but under XSLT they  
do, but they are kind of useless here, so remove them.  

M doc/src/sgml/biblio.sgml

doc: Fix TOC generation for refentries

commit   : 0c068205df5299fa41bce8ac33acdc9cfa5e7c6a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Mar 2017 23:12:18 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Mar 2017 23:12:18 -0400    

Click here for diff

The XSLT stylesheets by default don't show refentries inside sections in  
table of contents, which for our documentation leads to some regressions  
compared to the DSSSL output.  For example, in the SPI chapter, which is  
mostly refentries, you don't get any usable table of contents.  Tweak  
things so it's mostly back to what it was before.  

M doc/src/sgml/stylesheet.xsl

Improve grammar / fix typos in snapbuild.c.

commit   : 61d0c320b55902d321e69de2ec4e9a355959ea2c    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 14 Mar 2017 17:04:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 14 Mar 2017 17:04:36 -0700    

Click here for diff

Author: Erik Rijkers  
Discussion: https://postgr.es/m/[email protected]  

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

Some preliminary refactoring towards partitionwise join.

commit   : c44c47a773bd9073012935a29b0264d95920412c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 18:20:17 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 18:20:17 -0400    

Click here for diff

Partitionwise join proposes add a concept of child join relations,  
which will have the same relationship with join relations as "other  
member" relations do with base relations.  These relations will need  
some but not all of the handling that we currently have for join  
relations, and some but not all of the handling that we currently have  
for appendrels, since they are a mix of the two.  Refactor a little  
bit so that the necessary bits of logic are exposed as separate  
functions.  
  
Ashutosh Bapat, reviewed and tested by Rajkumar Raghuwanshi and  
by me.  
  
Discussion: http://postgr.es/m/CAFjFpRfqotRR6cM3sooBHMHEVdkFfAZ6PyYg4GRZsoMuW08HjQ@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/util/relnode.c

Improve isolation tests infrastructure.

commit   : 60f826c5e62446d211e15ae31710562a26afc442    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 14 Mar 2017 15:56:17 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 14 Mar 2017 15:56:17 -0700    

Click here for diff

Previously if a directory had both isolationtester and plain  
regression tests, they couldn't be run in parallel, because they'd  
access the same files/directories.  That, so far, only affected  
contrib/test_decoding.  
  
Rather than fix that locally in contrib/test_decoding, improve  
pg_regress_isolation_[install]check to use separate resources from  
plain regression tests.  
  
That requires a minor change in pg_regress, namely that the  
--outputdir is created if not already existing, that seems like good  
idea anyway.  
  
Use the improved helpers even where previously not used.  
  
Author: Tom Lane and Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/.gitignore
M contrib/test_decoding/Makefile
M src/Makefile.global.in
M src/test/isolation/.gitignore
M src/test/isolation/Makefile
M src/test/modules/snapshot_too_old/.gitignore
M src/test/modules/snapshot_too_old/Makefile
M src/test/regress/pg_regress.c

Add option to control snapshot export to CREATE_REPLICATION_SLOT

commit   : eb4da3e3807d2054bb05c3eb201cb9a363682f09    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Mar 2017 17:13:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Mar 2017 17:13:56 -0400    

Click here for diff

We used to export snapshots unconditionally in CREATE_REPLICATION_SLOT  
in the replication protocol, but several upcoming patches want more  
control over what happens.  
  
Suppress snapshot export in pg_recvlogical, which neither needs nor can  
use the exported snapshot.  Since snapshot exporting can fail this  
improves reliability.  
  
This also paves the way for allowing the creation of replication slots  
on standbys, which cannot export snapshots because they cannot allocate  
new XIDs.  
  
Author: Petr Jelinek <[email protected]>  

M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/protocol.sgml
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/walsender.c
M src/bin/pg_basebackup/streamutil.c
M src/include/nodes/replnodes.h
M src/include/replication/walreceiver.h

amcheck: Harden tests against concurrent autovacuums.

commit   : 71504026556fc1494c9a7045aad9645f7d9e4cdf    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 14 Mar 2017 13:07:38 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 14 Mar 2017 13:07:38 -0700    

Click here for diff

The previous coding of the test was vulnerable against autovacuum  
triggering work on one of the tables in check_btree.sql.  
  
For the purpose of the test it's entirely sufficient to check for  
locks taken by the current process, so add an appropriate restriction.  
While touching the test, expand it to also check for locks on the  
underlying relations, rather than just the indexes.  
  
Reported-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

hash: Support WAL consistency checking.

commit   : bb4a39637ac6155b4ed5a9f83d17921fb57400b6    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 14:58:56 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 14:58:56 -0400    

Click here for diff

Kuntal Ghosh, reviewed by Amit Kapila and Ashutosh Sharma, with  
a few tweaks by me.  
  
Discussion: http://postgr.es/m/CAGz5QCJLERUn_zoO0eDv6_Y_d0o4tNTMPeR7ivTLBg4rUrJdwg@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/access/hash/hash_xlog.c
M src/include/access/hash_xlog.h
M src/include/access/rmgrlist.h

Fix regression in parallel planning against inheritance tables.

commit   : 2609e91fcf9dcf36af40cd0c5b755dccf6057df6    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 14:33:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 14:33:14 -0400    

Click here for diff

Commit 51ee6f3160d2e1515ed6197594bda67eb99dc2cc accidentally changed  
the behavior around inheritance hierarchies; before, we always  
considered parallel paths even for very small inheritance children,  
because otherwise an inheritance hierarchy with even one small child  
wouldn't be eligible for parallelism.  That exception was inadverently  
removed; put it back.  
  
In passing, also adjust the degree-of-parallelism comptuation for  
index-only scans not to consider the number of heap pages fetched.  
Otherwise, we'll avoid parallel index-only scans on tables that are  
mostly all-visible, which isn't especially logical.  
  
Robert Haas and Amit Kapila, per a report from Ashutosh Sharma.  
  
Discussion: http://postgr.es/m/CAE9k0PmgSoOHRd60SHu09aRVTHRSs8s6pmyhJKWHxWw9C_x+XA@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/include/optimizer/paths.h

hash: Add write-ahead logging support.

commit   : c11453ce0aeaa377cbbcc9a3fc418acb94629330    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 13:27:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 13:27:02 -0400    

Click here for diff

The warning about hash indexes not being write-ahead logged and their  
use being discouraged has been removed.  "snapshot too old" is now  
supported for tables with hash indexes.  Most importantly, barring  
bugs, hash indexes will now be crash-safe and usable on standbys.  
  
This commit doesn't yet add WAL consistency checking for hash  
indexes, as we now have for other index types; a separate patch has  
been submitted to cure that lack.  
  
Amit Kapila, reviewed and slightly modified by me.  The larger patch  
series of which this is a part has been reviewed and tested by Ɓlvaro  
Herrera, Ashutosh Sharma, Mark Kirkwood, Jeff Janes, and Jesper  
Pedersen.  
  
Discussion: http://postgr.es/m/CAA4eK1JOBX=YU33631Qh-XivYXtPSALh514+jR8XeD7v+K3r_Q@mail.gmail.com  

M contrib/pageinspect/expected/hash.out
M contrib/pgstattuple/expected/pgstattuple.out
M doc/src/sgml/backup.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/ref/create_index.sgml
M src/backend/access/hash/Makefile
M src/backend/access/hash/README
M src/backend/access/hash/hash.c
A src/backend/access/hash/hash_xlog.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/rmgrdesc/hashdesc.c
M src/backend/commands/indexcmds.c
M src/backend/utils/cache/relcache.c
M src/include/access/hash_xlog.h
M src/test/regress/expected/create_index.out
M src/test/regress/expected/enum.out
M src/test/regress/expected/hash_index.out
M src/test/regress/expected/macaddr.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/expected/uuid.out

Include port number when logging successful binding to a TCP port.

commit   : 2b32ac2a59df18246c3b79e96a209bfdb39bb918    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Mar 2017 13:18:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Mar 2017 13:18:27 -0400    

Click here for diff

Per suggestion from Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/pqcomm.c

ecpg: Improve some variable names

commit   : 100871c2d10f1aca80824a979d926c96db3a0af2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Mar 2017 12:39:37 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Mar 2017 12:39:37 -0400    

Click here for diff

based on patch from Josh Soref <[email protected]>  

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

Spelling fixes

commit   : a47b38c9ee4960556b0edb76a42171bd281cc1cf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Mar 2017 12:57:10 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Mar 2017 12:57:10 -0400    

Click here for diff

From: Josh Soref <[email protected]>  

M contrib/ltree/ltxtquery_io.c
M doc/src/sgml/biblio.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/release-8.4.sgml
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
M doc/src/sgml/release-9.6.sgml
M doc/src/sgml/release-old.sgml
M src/backend/access/transam/xlog.c
M src/backend/executor/nodeAgg.c
M src/backend/optimizer/geqo/geqo_erx.c
M src/backend/port/dynloader/linux.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walreceiverfuncs.c
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/include/access/xlog_internal.h
M src/interfaces/libpq/bcc32.mak
M src/test/regress/expected/tsdicts.out
M src/test/regress/sql/tsdicts.sql

Spelling fixes in code comments

commit   : f97a028d8ee3e7d64a93285707af94b612c47651    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Mar 2017 11:38:30 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Mar 2017 11:38:30 -0400    

Click here for diff

From: Josh Soref <[email protected]>  

M contrib/pgcrypto/crypt-des.c
M contrib/spi/timetravel.c
M src/backend/access/transam/twophase.c
M src/backend/commands/copy.c
M src/backend/commands/tablecmds.c
M src/backend/foreign/foreign.c
M src/backend/optimizer/plan/createplan.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_param.c
M src/backend/regex/regc_pg_locale.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/lock.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/error/elog.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/hash/dynahash.c
M src/backend/utils/misc/README
M src/bin/pg_dump/parallel.c
M src/fe_utils/string_utils.c
M src/include/utils/jsonapi.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/pl/plperl/ppport.h
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/plpy_typeio.c
M src/test/regress/expected/errors.out
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/errors.sql
M src/test/regress/sql/groupingsets.sql

Make logging about multixact wraparound protection less chatty.

commit   : 5ed6fff6b729c3cce55d4abc8f695da93aa40a0d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Mar 2017 12:47:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Mar 2017 12:47:46 -0400    

Click here for diff

The original messaging design, introduced in commit 068cfadf9, seems too  
chatty now that some time has elapsed since the bug fix; most installations  
will be in good shape and don't really need a reminder about this on every  
postmaster start.  
  
Hence, arrange to suppress the "wraparound protections are now enabled"  
message during startup (specifically, during the TrimMultiXact() call).  
The message will still appear if protection becomes effective at some  
later point.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Update .gitignore

commit   : c6c099d31abd5ae22265787d4ab5fc9b3f563c87    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 12:17:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 12:17:44 -0400    

Click here for diff

Commit 42fcad68a9c0e0ebecf6842888723cad1f9d5be2 failed to do this.  
  
Michael Paquier  
  
Discussion: http://postgr.es/m/CAB7nPqTXK9Qn8TmonPf29jNXGw_CA3fTDaRfgnbHCFYr-Tx6qw@mail.gmail.com  

M src/interfaces/ecpg/test/sql/.gitignore

Fix failure to mark init buffers as BM_PERMANENT.

commit   : 87f99820349bbb020d1d65dd739a910c6f9c813b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 11:51:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 11:51:11 -0400    

Click here for diff

This could result in corruption of the init fork of an unlogged index  
if the ambuildempty routine for that index used shared buffers to  
create the init fork, which was true for brin, gin, gist, and hash  
indexes.  
  
Patch by me, based on an earlier patch by Michael Paquier, who also  
reviewed this one.  This also incorporates an idea from Artur  
Zakirov.  
  
Discussion: http://postgr.es/m/CACYUyc8yccE4xfxhqxfh_Mh38j7dRFuxfaK1p6dSNAEUakxUyQ@mail.gmail.com  

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

doc: Fix synopsis

commit   : 37289ffdbfc7319a3cdb271b11227bf682f76d90    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Mar 2017 11:19:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Mar 2017 11:19:12 -0400    

Click here for diff

M doc/src/sgml/ref/drop_subscription.sgml

Update overlooked comment for Gather Merge.

commit   : a82178020de2c4b3576d0a079e11a431e382e4de    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 07:52:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 07:52:11 -0400    

Click here for diff

Commit 355d3993c53ed62c5b53d020648e4fbcfbf5f155 probably should have  
done this, but nobody noticed that it was needed.  

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

Remove some bogus logic from create_gather_merge_plan.

commit   : bce352fb46196340749cf907f3168b5f63969329    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 07:28:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Mar 2017 07:28:35 -0400    

Click here for diff

This logic was adapated from create_merge_append_plan, but the two  
cases aren't really analogous, because create_merge_append_plan is not  
projection-capable and must therefore have a tlist identical to that  
of the underlying paths.  Overwriting the tlist of Gather Merge with  
whatever the underlying plan happens to produce is no good at all.  
  
Patch by me, reviewed by Rushabh Lathia, who also reported the issue  
and made an initial attempt at a fix.  
  
Discussion: http://postgr.es/m/CA+Tgmob_-oHEOBfT9S25bjqokdqv8e8xEmh9zOY+3MPr_LmuhA@mail.gmail.com  

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

Fix busted markup.

commit   : 0c87cd003d9966fcb19d6998ccf90d3276b08e0c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Mar 2017 19:06:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Mar 2017 19:06:28 -0400    

Click here for diff

Oversight in commit 9ca5c8721.  Per buildfarm.  

M doc/src/sgml/ecpg.sgml

Silence unused variable compiler warning

commit   : a9c074ba7ec2827832c2f5e2fa0de16bf4851b9b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 13 Mar 2017 18:54:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 13 Mar 2017 18:54:35 -0300    

Click here for diff

Fallout from fcec6caafa2: mark a variable in  
set_tablefunc_size_estimates as used for asserts only.  
  
Also, the planner_rte_fetch() call is pointless with assertions  
disabled, so enclose it in a USE_ASSERT_CHECKING #ifdef; fix the same  
problem in set_subquery_size_estimates().  
  
First problem noted by David Rowley, whose compiler is noisier than mine  
in this regard.  

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

Add a "void *" passthrough pointer for psqlscan.l's callback functions.

commit   : 895e36bb3f36fdb7ec8e573be1a20d104fac820b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Mar 2017 17:14:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Mar 2017 17:14:46 -0400    

Click here for diff

The immediate motivation for this is to provide clean infrastructure  
for the proposed \if...\endif patch for psql; but it seems like a good  
thing to have even if that patch doesn't get in.  Previously the callback  
functions could only make use of application-global state, which is a  
pretty severe handicap.  
  
For the moment, the pointer is only passed through to the get_variable  
callback function.  I considered also passing it to the write_error  
callback, but for now let's not.  Neither psql nor pgbench has a use  
for that, and in the case of psql we'd have to invent a separate wrapper  
function because we would certainly not want to change the signature of  
psql_error().  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/psqlscanslash.l
M src/fe_utils/psqlscan.l
M src/include/fe_utils/psqlscan.h
M src/include/fe_utils/psqlscan_int.h

Remove unnecessary dependency on statement_timeout in prepared_xacts test.

commit   : 1c7a66a8e9378aeb092d7ed26890134d17fdd691    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Mar 2017 16:46:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Mar 2017 16:46:32 -0400    

Click here for diff

Rather than waiting around for statement_timeout to expire, we can just  
try to take the table's lock in nowait mode.  This saves some fraction  
under 4 seconds when running this test with prepared xacts available,  
and it guards against timeout-expired-anyway failures on very slow  
machines when prepared xacts are not available, as seen in a recent  
failure on axolotl for instance.  
  
This approach could fail if autovacuum were to take an exclusive lock  
on the test table concurrently, but there's no reason for it to do so.  
  
Since the main point here is to improve stability in the buildfarm,  
back-patch to all supported branches.  

M src/test/regress/expected/prepared_xacts.out
M src/test/regress/expected/prepared_xacts_1.out
M src/test/regress/sql/prepared_xacts.sql

Document two phase commit commands in ecpg docu.

commit   : 9ca5c8721dfa2413e910531373395c6e18062ddf    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 13 Mar 2017 20:48:29 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 13 Mar 2017 20:48:29 +0100    

Click here for diff

Patch by Masahiko Sawada  

M doc/src/sgml/ecpg.sgml

Add test case for two phase commit. Also by Masahiko Sawada.

commit   : 42fcad68a9c0e0ebecf6842888723cad1f9d5be2    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 13 Mar 2017 20:47:27 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 13 Mar 2017 20:47:27 +0100    

Click here for diff

M src/interfaces/ecpg/test/ecpg_schedule
A src/interfaces/ecpg/test/expected/sql-twophase.c
A src/interfaces/ecpg/test/expected/sql-twophase.stderr
A src/interfaces/ecpg/test/expected/sql-twophase.stdout
M src/interfaces/ecpg/test/sql/Makefile
A src/interfaces/ecpg/test/sql/twophase.pgc

Ecpg should support COMMIT PREPARED and ROLLBACK PREPARED.

commit   : 43c79c7d68044cb804ddf8f549dfc4cb895f8542    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 13 Mar 2017 20:44:13 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 13 Mar 2017 20:44:13 +0100    

Click here for diff

The problem was that "begin transaction" was issued automatically  
before executing COMMIT/ROLLBACK PREPARED if not in auto commit. This fix by  
Masahiko Sawada fixes this.  

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

Include array size in forward declaration.

commit   : dd12bef58ccee3596066cda9ded4fc6b3399d3ba    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 13 Mar 2017 21:53:38 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 13 Mar 2017 21:53:38 +0200    

Click here for diff

Some compilers require it. At least Visual Studio, according to the  
buildfarm, and gcc with the -pedantic flag.  

M src/backend/utils/mb/Unicode/big5_to_utf8.map
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/mb/Unicode/euc_cn_to_utf8.map
M src/backend/utils/mb/Unicode/euc_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/euc_jp_to_utf8.map
M src/backend/utils/mb/Unicode/euc_kr_to_utf8.map
M src/backend/utils/mb/Unicode/euc_tw_to_utf8.map
M src/backend/utils/mb/Unicode/gb18030_to_utf8.map
M src/backend/utils/mb/Unicode/gbk_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_10_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_13_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_14_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_15_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_16_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_2_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_3_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_4_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_5_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_6_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_7_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_8_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_9_to_utf8.map
M src/backend/utils/mb/Unicode/johab_to_utf8.map
M src/backend/utils/mb/Unicode/koi8r_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/uhc_to_utf8.map
M src/backend/utils/mb/Unicode/utf8_to_big5.map
M src/backend/utils/mb/Unicode/utf8_to_euc_cn.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jis_2004.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jp.map
M src/backend/utils/mb/Unicode/utf8_to_euc_kr.map
M src/backend/utils/mb/Unicode/utf8_to_euc_tw.map
M src/backend/utils/mb/Unicode/utf8_to_gb18030.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_johab.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_sjis.map
M src/backend/utils/mb/Unicode/utf8_to_uhc.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

Fix compiler warning

commit   : 57488c1ce32181730a2724ceaad973c9bc2d7c3a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2017 15:44:50 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2017 15:44:50 -0400    

Click here for diff

From: David Rowley <[email protected]>  

M contrib/dblink/dblink.c

Change xlog to WAL in some error messages

commit   : 1e6de941e38fde512cadf33e55e644492f12abd1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2017 15:40:16 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2017 15:40:16 -0400    

Click here for diff

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/utils/misc/guc.c

Use radix tree for character encoding conversions.

commit   : aeed17d00037950a16cc5ebad5b5592e5fa1ad0f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 13 Mar 2017 20:46:39 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 13 Mar 2017 20:46:39 +0200    

Click here for diff

Replace the mapping tables used to convert between UTF-8 and other  
character encodings with new radix tree-based maps. Looking up an entry in  
a radix tree is much faster than a binary search in the old maps. As a  
bonus, the radix tree representation is also more compact, making the  
binaries slightly smaller.  
  
The "combined" maps work the same as before, with binary search. They are  
much smaller than the main tables, so it doesn't matter so much. However,  
the "combined" maps are now stored in the same .map files as the main  
tables. This seems more clear, since they're always used together, and  
generated from the same source files.  
  
Patch by Kyotaro Horiguchi, with lot of hacking by me at various stages.  
Reviewed by Michael Paquier and Daniel Gustafsson.  
  
Discussion: https://www.postgresql.org/message-id/20170306.171609.204324917.horiguchi.kyotaro%40lab.ntt.co.jp  

M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/big5_to_utf8.map
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/mb/Unicode/euc_cn_to_utf8.map
M src/backend/utils/mb/Unicode/euc_jis_2004_to_utf8.map
D src/backend/utils/mb/Unicode/euc_jis_2004_to_utf8_combined.map
M src/backend/utils/mb/Unicode/euc_jp_to_utf8.map
M src/backend/utils/mb/Unicode/euc_kr_to_utf8.map
M src/backend/utils/mb/Unicode/euc_tw_to_utf8.map
M src/backend/utils/mb/Unicode/gb18030_to_utf8.map
M src/backend/utils/mb/Unicode/gbk_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_10_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_13_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_14_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_15_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_16_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_2_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_3_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_4_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_5_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_6_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_7_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_8_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_9_to_utf8.map
M src/backend/utils/mb/Unicode/johab_to_utf8.map
M src/backend/utils/mb/Unicode/koi8r_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
D src/backend/utils/mb/Unicode/shift_jis_2004_to_utf8_combined.map
M src/backend/utils/mb/Unicode/sjis_to_utf8.map
M src/backend/utils/mb/Unicode/uhc_to_utf8.map
M src/backend/utils/mb/Unicode/utf8_to_big5.map
M src/backend/utils/mb/Unicode/utf8_to_euc_cn.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jis_2004.map
D src/backend/utils/mb/Unicode/utf8_to_euc_jis_2004_combined.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jp.map
M src/backend/utils/mb/Unicode/utf8_to_euc_kr.map
M src/backend/utils/mb/Unicode/utf8_to_euc_tw.map
M src/backend/utils/mb/Unicode/utf8_to_gb18030.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_johab.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
D src/backend/utils/mb/Unicode/utf8_to_shift_jis_2004_combined.map
M src/backend/utils/mb/Unicode/utf8_to_sjis.map
M src/backend/utils/mb/Unicode/utf8_to_uhc.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
M src/backend/utils/mb/conv.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_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/include/mb/pg_wchar.h

Remove obsolete references to JIS0201.TXT JIS0208.TXT.

commit   : 84892692fdedb753cfdd9a63b318b47ec640915f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 13 Mar 2017 19:04:45 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 13 Mar 2017 19:04:45 +0200    

Click here for diff

We don't use those files anymore, since commit 1de9cc0dcc.  

M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/convutils.pm

initdb: Re-add translatable string that got lost

commit   : d69fae203c8223c45ae1201acce46e8beb0eb6ee    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2017 09:10:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2017 09:10:49 -0400    

Click here for diff

M src/bin/initdb/initdb.c

Fix typo in comment

commit   : 1bfebffe81d02e6124fc604ae4293c6487ef7e83    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 13 Mar 2017 12:10:54 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 13 Mar 2017 12:10:54 +0100    

Click here for diff

Masahiko Sawada  

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

Use wrappers of PG_DETOAST_DATUM_PACKED() more.

commit   : 3a0d473192b2045cbaf997df8437e7762d34f3ba    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 12 Mar 2017 19:35:34 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 12 Mar 2017 19:35:34 -0400    

Click here for diff

This makes almost all core code follow the policy introduced in the  
previous commit.  Specific decisions:  
  
- Text search support functions with char* and length arguments, such as  
  prsstart and lexize, may receive unaligned strings.  I doubt  
  maintainers of non-core text search code will notice.  
  
- Use plain VARDATA() on values detoasted or synthesized earlier in the  
  same function.  Use VARDATA_ANY() on varlenas sourced outside the  
  function, even if they happen to always have four-byte headers.  As an  
  exception, retain the universal practice of using VARDATA() on return  
  values of SendFunctionCall().  
  
- Retain PG_GETARG_BYTEA_P() in pageinspect.  (Page images are too large  
  for a one-byte header, so this misses no optimization.)  Sites that do  
  not call get_page_from_raw() typically need the four-byte alignment.  
  
- For now, do not change btree_gist.  Its use of four-byte headers in  
  memory is partly entangled with storage of 4-byte headers inside  
  GBT_VARKEY, on disk.  
  
- For now, do not change gtrgm_consistent() or gtrgm_distance().  They  
  incorporate the varlena header into a cache, and there are multiple  
  credible implementation strategies to consider.  

M contrib/adminpack/adminpack.c
M contrib/dblink/dblink.c
M contrib/fuzzystrmatch/dmetaphone.c
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/intarray/_int_op.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/rawpage.c
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_trgm/trgm_gin.c
M contrib/pg_trgm/trgm_gist.c
M contrib/pg_trgm/trgm_op.c
M contrib/pgcrypto/pgcrypto.c
M contrib/pgcrypto/pgp-pgsql.c
M contrib/pgrowlocks/pgrowlocks.c
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/pgstattuple.c
M contrib/sepgsql/label.c
M contrib/spi/autoinc.c
M contrib/sslinfo/sslinfo.c
M contrib/unaccent/unaccent.c
M contrib/uuid-ossp/uuid-ossp.c
M contrib/xml2/xpath.c
M contrib/xml2/xslt_proc.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/commands/extension.c
M src/backend/commands/sequence.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/executor/execQual.c
M src/backend/libpq/be-fsstubs.c
M src/backend/replication/logical/origin.c
M src/backend/tsearch/dict.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/wparser.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/quote.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/regproc.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/tsquery_rewrite.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/xml.c
M src/backend/utils/misc/rls.c
M src/pl/plperl/Util.xs
M src/pl/plpython/plpy_typeio.c

Recommend wrappers of PG_DETOAST_DATUM_PACKED().

commit   : 9d7726c2ba06b932f791f2d0cc5acf73cc0b4dca    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 12 Mar 2017 19:35:33 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 12 Mar 2017 19:35:33 -0400    

Click here for diff

When commit 3e23b68dac006e8deb0afa327e855258df8de064 introduced  
single-byte varlena headers, its fmgr.h changes presented  
PG_GETARG_TEXT_PP() and PG_GETARG_TEXT_P() as equals.  Its postgres.h  
changes presented PG_DETOAST_DATUM_PACKED() and VARDATA_ANY() as the  
exceptional case.  Now, instead, firmly recommend PG_GETARG_TEXT_PP()  
over PG_GETARG_TEXT_P(); likewise for other ...PP() macros.  This shaves  
cycles and invites consistency of style.  

M doc/src/sgml/xfunc.sgml
M src/include/c.h
M src/include/fmgr.h
M src/include/postgres.h
M src/include/utils/inet.h
M src/tutorial/funcs_new.c

Fix pg_file_write() error handling.

commit   : 944a026b4ec252667f275768ba4dcd53ae3bb07e    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 12 Mar 2017 19:35:31 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 12 Mar 2017 19:35:31 -0400    

Click here for diff

Detect fclose() failures; given "ln -s /dev/full $PGDATA/devfull",  
"pg_file_write('devfull', 'x', true)" now fails as it should.  Don't  
leak a stream when fwrite() fails.  Remove a born-ineffective test that  
aimed to skip zero-length writes.  Back-patch to 9.2 (all supported  
versions).  

M contrib/adminpack/adminpack.c

Assume deconstruct_array() outputs are untoasted.

commit   : 2fd26b23b662dcb0cf649e983a58581cb911fc4b    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 12 Mar 2017 19:35:31 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 12 Mar 2017 19:35:31 -0400    

Click here for diff

In functions that issue a deconstruct_array() call, consistently use  
plain VARSIZE()/VARDATA() on the array elements.  Prior practice was  
divided between those and VARSIZE_ANY_EXHDR()/VARDATA_ANY().  

M contrib/hstore/hstore_io.c
M src/backend/access/common/reloptions.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/tsvector_op.c

Fix comment about length of text, bytea, etc.

commit   : 9e0926468a1c41a31c09785787a737311dcd92c1    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 12 Mar 2017 19:35:30 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 12 Mar 2017 19:35:30 -0400    

Click here for diff

When commit 3e23b68dac006e8deb0afa327e855258df8de064 introduced  
single-byte varlena headers, it rendered this comment incomplete.  

M src/include/c.h

Add "break"s to make it clearer what will happen in a nested switch.

commit   : 766f7fd613adbceaf1b40803793e10dc487f8596    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Mar 2017 16:01:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Mar 2017 16:01:33 -0400    

Click here for diff

This could only matter if the guessed_type variable had a value that wasn't  
a member of the PasswordType enum; but just in case, let's be sure that  
control falls out to reach the elog(ERROR) at the end of the function.  
Per gripe from Coverity.  

M src/backend/libpq/crypt.c

Fix typo in initdb's SCRAM password processing.

commit   : 835cc1136745e8cf02d3d0231b5b7c7a543df5df    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Mar 2017 15:57:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Mar 2017 15:57:03 -0400    

Click here for diff

Noted by Coverity (a rather impressive catch).  
  
Michael Paquier  

M src/bin/initdb/initdb.c

Remove dead code in nodeGatherMerge.c.

commit   : 5d3f7c57ab9c9e2f074ad29d619056570fc5c51e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Mar 2017 15:52:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Mar 2017 15:52:50 -0400    

Click here for diff

Coverity noted that the last line of gather_merge_getnext() was  
unreachable, since each arm of the preceding "if" ends in a "return".  
Drop it as an oversight.  In passing, improve some nearby comments.  

M src/backend/executor/nodeGatherMerge.c

Improve expression evaluation test coverage.

commit   : ce38949ba23ab311f274aa4196be09d18d30e5a6    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 11 Mar 2017 15:36:50 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 11 Mar 2017 15:36:50 -0800    

Click here for diff

Upcoming patches are revamping expression evaluation significantly. It  
therefore seems prudent to try to ensure that the coverage of the  
existing evaluation code is high.  
  
This commit adds coverage for the cases that can reasonably be  
tested. There's still a bunch of unreachable error messages and such,  
but otherwise this achieves nearly full regression test coverage (with  
the exception of the unused GetAttributeByNum/GetAttributeByName).  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execQual.c
M src/test/regress/expected/arrays.out
M src/test/regress/expected/boolean.out
M src/test/regress/expected/case.out
A src/test/regress/expected/expressions.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rowtypes.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/arrays.sql
M src/test/regress/sql/boolean.sql
M src/test/regress/sql/case.sql
A src/test/regress/sql/expressions.sql
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/rowtypes.sql

Fix ancient connection leak in dblink

commit   : cd1e23e93bc12b7d084dc2acf9f80e9ea1f1e6de    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 11 Mar 2017 13:32:18 -0800    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 11 Mar 2017 13:32:18 -0800    

Click here for diff

When using unnamed connections with dblink, every time a new  
connection is made, the old one is leaked. Fix that.  
  
This has been an issue probably since dblink was first committed.  
Someone complained almost ten years ago, but apparently I decided  
not to pursue it at the time, and neither did anyone else, so it  
slipped between the cracks. Now that someone else has complained,  
fix in all supported branches.  
  
Discussion: (orig) https://postgr.es/m/flat/F680AB59-6D6F-4026-9599-1BE28880273D%40decibel.org#[email protected]  
Discussion: (new) https://postgr.es/m/flat/0A3221C70F24FB45833433255569204D1F6ADF8C@G01JPEXMBYT05  
Reported by: Jim Nasby and Takayuki Tsunakawa  

M contrib/dblink/dblink.c

Add a "subtransaction" command to PL/Tcl.

commit   : b58fd4a9cab21e9d937a4e369bab31b3a5d24710    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Mar 2017 14:37:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Mar 2017 14:37:05 -0500    

Click here for diff

This allows rolling back the effects of some SPI commands without  
having to fail the entire PL/Tcl function.  
  
Victor Wagner, reviewed by Pavel Stehule  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pltcl.sgml
M src/pl/tcl/Makefile
A src/pl/tcl/expected/pltcl_subxact.out
M src/pl/tcl/pltcl.c
A src/pl/tcl/sql/pltcl_subxact.sql

Improve postmaster's logging of listen socket creation.

commit   : f9dfa5c9776649f769d537dd0923003b35f128de    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Mar 2017 16:32:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Mar 2017 16:32:18 -0500    

Click here for diff

When one of the kernel calls in the socket()/bind()/listen() sequence  
fails, include the specific address we're trying to bind to in the log  
message.  This greatly eases debugging of network misconfigurations.  
  
Also, after successfully setting up a listen socket, report its address  
in the log, to ease verification that the expected addresses were bound.  
There was some debate about whether to print this message at LOG level or  
only DEBUG1, but the majority of votes were for the former.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/runtime.sgml
M src/backend/libpq/pqcomm.c

pg_dump: Fix dumping of publications

commit   : de75281637b762b4ccfb776366c44251e6864d0a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2017 15:31:47 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2017 15:31:47 -0500    

Click here for diff

Dumping a publication with more than one table crashed pg_dump.  
  
patch by Amit Langote <[email protected]>, test by me  

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

Reduce log verbosity of startup/shutdown for launcher subprocesses.

commit   : 6ec4c8584c45ee784a95e02c40bb643430dee32a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Mar 2017 15:18:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Mar 2017 15:18:38 -0500    

Click here for diff

There's no really good reason why the autovacuum launcher and logical  
replication launcher should announce themselves at startup and shutdown  
by default.  Users don't care that those processes exist, and it's  
inconsistent that those background processes announce themselves while  
others don't.  So, reduce those messages from LOG to DEBUG1 level.  
  
I was sorely tempted to reduce the "starting logical replication worker  
for subscription ..." message to DEBUG1 as well, but forebore for now.  
Those processes might possibly be of direct interest to users, at least  
until logical replication is a lot better shaken out than it is today.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Revert "Use group updates when setting transaction status in clog."

commit   : 390811750d1647ed81a462da3af7f1fd66166e95    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 10 Mar 2017 14:49:56 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 10 Mar 2017 14:49:56 -0500    

Click here for diff

This reverts commit ccce90b398673d55b0387b3de66639b1b30d451b.  This  
optimization is unsafe, at least, of rollbacks and rollbacks to  
savepoints, but I'm concerned there may be other problematic cases as  
well.  Therefore, I've decided to revert this pending further  
investigation.  

M src/backend/access/transam/clog.c
M src/backend/access/transam/twophase.c
M src/backend/storage/lmgr/proc.c
M src/include/access/twophase.h
M src/include/storage/proc.h

Enable 64 bit atomics on ARM64.

commit   : f8f1430ae709c0018a217c77893754f38b3c5b93    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 10 Mar 2017 11:14:06 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 10 Mar 2017 11:14:06 -0800    

Click here for diff

Previously they were disabled due to performance concerns on 32bit  
arm, where 64bit atomics are often implemented via kernel traps.  
  
Author: Roman Shaposhnik  
Discussion: http://postgr.es/m/CA+ULb+uErkFuXUCCXWHYvnV5KnAyjGUzzRcPA-M0cgO+Hm4RSA@mail.gmail.com  

M src/include/port/atomics/arch-arm.h

Sanitize newlines in object names in "pg_restore -l" output.

commit   : f39ddd843667c68f760cb4cf23c89c1f1d9aebb8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Mar 2017 14:15:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Mar 2017 14:15:09 -0500    

Click here for diff

Commits 89e0bac86 et al replaced newlines with spaces in object names  
printed in SQL comments, but we neglected to consider that the same  
names are also printed by "pg_restore -l", and a newline would render  
the output unparseable by "pg_restore -L".  Apply the same replacement  
in "-l" output.  Since "pg_restore -L" doesn't actually examine any  
object names, only the dump ID field that starts each line, this is  
enough to fix things for its purposes.  
  
The previous fix was treated as a security issue, and we might have  
done that here as well, except that the issue was reported publicly  
to start with.  Anyway it's hard to see how this could be exploited  
for SQL injection; "pg_restore -L" doesn't do much with the file  
except parse it for leading integers.  
  
Per bug #14587 from Milos Urbanek.  Back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_backup_archiver.c

Change the relkind for partitioned tables from 'P' to 'p'.

commit   : 8b358b42f8eb6156a82ac9a41fc4e8335c8dc37a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Mar 2017 13:15:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Mar 2017 13:15:47 -0500    

Click here for diff

Seven of the eight other relkind codes are lower-case, so it wasn't  
consistent for this one to be upper-case.  Fix it while we still can.  
  
Historical notes: the reason for the lone exception, i.e. sequences being  
'S', is that 's' was once used for "special" relations.  Also, at one time  
the partitioned-tables patch used both 'P' and 'p', but that got changed,  
leaving only a surprising choice behind.  
  
This also fixes a couple little bits of technical debt, such as  
type_sanity.sql not knowing that 'm' is a legal value for relkind.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/information_schema.sql
M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/include/catalog/pg_class.h
M src/test/regress/expected/create_table.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/sanity_check.sql
M src/test/regress/sql/type_sanity.sql

Un-break things on IPv6-less platforms.

commit   : a83e4b4f31c7afa5f7360086ebb1916cc99a4dbe    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Mar 2017 12:17:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Mar 2017 12:17:56 -0500    

Click here for diff

Commit be37c2120 forgot to teach initdb about commenting out the IPv6  
replication entry that it caused to exist in pg_hba.conf.sample.  
Per buildfarm.  

M src/bin/initdb/initdb.c

Improve gitignore file

commit   : 07a61e16703b5f90650d509e29a724c68efd79ab    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2017 10:16:04 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2017 10:16:04 -0500    

Click here for diff

One file was listed under a wrong comment.  

M doc/src/sgml/.gitignore

commit   : 22ef6b041a554b7536edb3a79e0b9d5d8403f432    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2017 09:59:10 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2017 09:59:10 -0500    

Click here for diff

For consistency with other code and to avoid wasting some small amount  
of memory.  
  
From: Tsunakawa, Takayuki <[email protected]>  

M contrib/dblink/dblink.c

commit   : acaf7ccb94a3916ea83712671a3563f0eb595558    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 25 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 25 Dec 2016 12:00:00 -0500    

Click here for diff

Also remove some unused code and the no longer useful dblink.h file.  
  
Reviewed-by: Tsunakawa, Takayuki <[email protected]>  

M contrib/dblink/dblink.c
D contrib/dblink/dblink.h

Fix a potential double-free in ecpg.

commit   : d1ca82d0a226f22438a1cf4ba0ed3460e6db692b    
  
author   : Michael Meskes <[email protected]>    
date     : Fri, 10 Mar 2017 10:32:41 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Fri, 10 Mar 2017 10:32:41 +0100    

Click here for diff

M src/interfaces/ecpg/preproc/pgc.l

Fix hard-coded relkind constants in assorted other files.

commit   : 9c2635e26f6f4e34b3b606c0fc79d0e111953a74    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 23:36:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 23:36:44 -0500    

Click here for diff

Although it's reasonable to expect that most of these constants will  
never change, that does not make it good programming style to hard-code  
the value rather than using the RELKIND_FOO macros.  
  
I think I've now gotten all the hard-coded references in C code.  
Unfortunately there's no equally convenient way to parameterize  
SQL files ...  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/oid2name/oid2name.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/vacuumlo/vacuumlo.c
M src/backend/utils/adt/xml.c
M src/tools/findoidjoins/findoidjoins.c

amcheck: editorialize variable name & comment.

commit   : fcd8d25d38b5f42ec4ae77a673813c2dc279ccf7    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 9 Mar 2017 20:01:37 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 9 Mar 2017 20:01:37 -0800    

Click here for diff

No exclusive lock is taken anymore...  

M contrib/amcheck/verify_nbtree.c

contrib/amcheck needs RecentGlobalXmin to be PGDLLIMPORT'ified.

commit   : 56018bf26eec1a0b4bf20303c98065a8eb1b0c5d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 22:55:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 22:55:46 -0500    

Click here for diff

Per buildfarm.  Maybe some of the other xmin variables in snapmgr.h  
ought to get this too, but for the moment I'm just interested in  
un-breaking the buildfarm.  

M src/include/utils/snapmgr.h

Add .gitignore to contrib/amcheck.

commit   : 574268e37b3b7b3449eb0034013443d88f4bd320    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 22:45:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 22:45:24 -0500    

Click here for diff

Oversight in commit 3717dc149.  

A contrib/amcheck/.gitignore

Fix hard-coded relkind constants in assorted src/bin files.

commit   : fcd778eb703c154c0fbba249e17c21b7ae4de19b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 22:42:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 22:42:16 -0500    

Click here for diff

Although it's reasonable to expect that most of these constants will  
never change, that does not make it good programming style to hard-code  
the value rather than using the RELKIND_FOO macros.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/version.c
M src/bin/psql/command.c
M src/bin/psql/tab-complete.c
M src/bin/scripts/vacuumdb.c

Fix portability problem in Catalog.pm.

commit   : 15bb93e28e49fdf4f28d509c07d1527886acb3e2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 20:45:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 20:45:52 -0500    

Click here for diff

Commit 7666e73a2 introduced a dependency on filehandles' input_line_number  
method, but apparently that's a Perl neologism.  Use $. instead, which  
works at least back to Perl 5.10, and hopefully back to 5.8.  
  
Jeff Janes  
  
Discussion: https://postgr.es/m/CAMkU=1wuQW=xVfu-14A4VCvxO0ohkD3m9vk6HOj_dprQoKNAQw@mail.gmail.com  

M src/backend/catalog/Catalog.pm

Fix hard-coded relkind constants in psql/describe.c.

commit   : 395bfaae8e786eb17fc9dd79e4636f97c9d9b820    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 20:42:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 20:42:42 -0500    

Click here for diff

Although it's reasonable to expect that most of these constants will  
never change, that does not make it good programming style to hard-code  
the value rather than using the RELKIND_FOO macros.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

pgstattuple: Fix typo partitiond -> partitioned

commit   : 90e91e242fe99582b6d2dc18177e79d99c91695d    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 9 Mar 2017 20:06:11 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 9 Mar 2017 20:06:11 -0500    

Click here for diff

Pointed out by Michael Paquier  

M contrib/pgstattuple/expected/pgstattuple.out
M contrib/pgstattuple/sql/pgstattuple.sql

Add amcheck extension to contrib.

commit   : 3717dc149ecf44b8be95350a68605ba7299474fd    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 9 Mar 2017 15:50:40 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 9 Mar 2017 15:50:40 -0800    

Click here for diff

This is the beginning of a collection of SQL-callable functions to  
verify the integrity of data files.  For now it only contains code to  
verify B-Tree indexes.  
  
This adds two SQL-callable functions, validating B-Tree consistency to  
a varying degree.  Check the, extensive, docs for details.  
  
The goal is to later extend the coverage of the module to further  
access methods, possibly including the heap.  Once checks for  
additional access methods exist, we'll likely add some "dispatch"  
functions that cover multiple access methods.  
  
Author: Peter Geoghegan, editorialized by Andres Freund  
Reviewed-By: Andres Freund, Tomas Vondra, Thomas Munro,  
   Anastasia Lubennikova, Robert Haas, Amit Langote  
Discussion: CAM3SWZQzLMhMwmBqjzK+pRKXrNUZ4w90wYMUWfkeV8mZ3Debvw@mail.gmail.com  

M contrib/Makefile
A contrib/amcheck/Makefile
A contrib/amcheck/amcheck–1.0.sql
A contrib/amcheck/amcheck.control
A contrib/amcheck/expected/check.out
A contrib/amcheck/expected/check_btree.out
A contrib/amcheck/sql/check.sql
A contrib/amcheck/sql/check_btree.sql
A contrib/amcheck/verify_nbtree.c
A doc/src/sgml/amcheck.sgml
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
M src/tools/pgindent/typedefs.list

Fix hard-coded relkind constants in pg_dump.c.

commit   : fe797b4a6a69ec0c9bf6ff992eac20c4084fda41    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 19:18:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 19:18:57 -0500    

Click here for diff

Although it's reasonable to expect that most of these constants will  
never change, that does not make it good programming style to hard-code  
the value rather than using the RELKIND_FOO macros.  There were only  
a few such violations, and all relatively new AFAICT.  
  
Existing style is mostly to inject relkind values into constructed  
query strings using %c.  I did not bother to touch places that did it  
like that, but really a better technique is to stringify the RELKIND  
macro, at least in places where you'd want single quotes around the  
code character.  That avoids any runtime effort and keeps the RELKIND  
symbol close to where it's used.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Make CppAsString2() more visible in c.h.

commit   : 9cfc4deeb9e6bd8162bd85dce5809d4d7aea2b66    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 18:54:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 18:54:45 -0500    

Click here for diff

For some reason this standard C string-processing hack was buried in an  
NLS-related section of c.h.  Put it beside CppAsString() so that people  
are more likely to find it and not be tempted to reinvent local copies,  
as I nearly did.  And provide a more helpful comment, too.  

M src/include/c.h

Throw an error if a DATA() line contains wrong # of attributes.

commit   : 7666e73a2e9e0e91a9f3b246a4299b44daadcbf8    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Mar 2017 18:17:58 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Mar 2017 18:17:58 -0500    

Click here for diff

David Christensen, reviewed by Dagfinn Ilmari MannsƄker  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/catalog/Catalog.pm

Use group updates when setting transaction status in clog.

commit   : ccce90b398673d55b0387b3de66639b1b30d451b    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Mar 2017 17:44:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Mar 2017 17:44:52 -0500    

Click here for diff

Commit 0e141c0fbb211bdd23783afa731e3eef95c9ad7a introduced a mechanism  
to reduce contention on ProcArrayLock by having a single process clear  
XIDs in the procArray on behalf of multiple processes, reducing the  
need to hand the lock around.  Use a similar mechanism to reduce  
contention on CLogControlLock.  Testing shows that this very  
significantly reduces the amount of time waiting for CLogControlLock  
on high-concurrency pgbench tests run on a large multi-socket  
machines; whether that translates into a TPS improvement depends on  
how much of that contention is simply shifted to some other lock,  
particularly WALWriteLock.  
  
Amit Kapila, with some cosmetic changes by me.  Extensively reviewed,  
tested, and benchmarked over a period of about 15 months by Simon  
Riggs, Robert Haas, Andres Freund, Jesper Pedersen, and especially by  
Tomas Vondra and Dilip Kumar.  
  
Discussion: http://postgr.es/m/CAA4eK1L_snxM_JcrzEstNq9P66++F4kKFce=1r5+D1vzPofdtg@mail.gmail.com  
Discussion: http://postgr.es/m/CAA4eK1LyR2A+m=RBSZ6rcPEwJ=rVi1ADPSndXHZdjn56yqO6Vg@mail.gmail.com  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/access/transam/clog.c
M src/backend/access/transam/twophase.c
M src/backend/storage/lmgr/proc.c
M src/include/access/twophase.h
M src/include/storage/proc.h

Fix timestamptz regression test to still work with latest IANA zone data.

commit   : f077e1b2e374fadc443b6aa9fa54ad9bb6f908c7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 17:20:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2017 17:20:11 -0500    

Click here for diff

The IANA timezone crew continues to chip away at their project of removing  
timezone abbreviations that have no real-world currency from their  
database.  The tzdata2017a update removes all such abbreviations for  
South American zones, as well as much of the Pacific.  This breaks some  
test cases in timestamptz.sql that were expecting America/Santiago and  
America/Caracas to have non-numeric abbreviations.  
  
The test cases involving America/Santiago seem to have selected that  
zone more or less at random, so just replace it with America/New_York,  
which is of similar longitude.  The cases involving America/Caracas are  
harder since they were chosen to test a time-varying zone abbreviation  
around a point where it changed meaning in the backwards direction.  
Fortunately, Europe/Moscow has a similar case in 2014, and the MSK/MSD  
abbreviations are well enough attested that IANA seems unlikely to  
decide to remove them from the database in future.  
  
With these changes, this regression test should pass when using any IANA  
zone database from 2015 or later.  One could wish that there were a few  
years more daylight on how out-of-date your zone database can be ... but  
really the --with-system-tzdata option is only meant for use on platforms  
where the zone database is kept up-to-date pretty faithfully, so I do not  
think this is a big objection.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add relkind checks to certain contrib modules

commit   : c08d82f38ebf763b79bd43ae34b7310ee47aaacd    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 9 Mar 2017 16:34:25 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 9 Mar 2017 16:34:25 -0500    

Click here for diff

The contrib extensions pageinspect, pg_visibility and pgstattuple only  
work against regular relations which have storage.  They don't work  
against foreign tables, partitioned (parent) tables, views, et al.  
  
Add checks to the user-callable functions to return a useful error  
message to the user if they mistakenly pass an invalid relation to a  
function which doesn't accept that kind of relation.  
  
In passing, improve some of the existing checks to use ereport() instead  
of elog(), add a function to consolidate common checks where  
appropriate, and add some regression tests.  
  
Author: Amit Langote, with various changes by me  
Reviewed by: Michael Paquier and Corey Huinker  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/expected/page.out
M contrib/pageinspect/rawpage.c
M contrib/pageinspect/sql/page.sql
A contrib/pg_visibility/.gitignore
M contrib/pg_visibility/Makefile
A contrib/pg_visibility/expected/pg_visibility.out
M contrib/pg_visibility/pg_visibility.c
A contrib/pg_visibility/sql/pg_visibility.sql
M contrib/pgstattuple/expected/pgstattuple.out
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/pgstattuple.c
M contrib/pgstattuple/sql/pgstattuple.sql

Document lack of validation when attaching foreign partitions.

commit   : b54aad8e34bd6299093e965c50f4a23da96d7cc3    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Mar 2017 13:09:48 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Mar 2017 13:09:48 -0500    

Click here for diff

Ashutosh Bapat, revised a bit by me.  
  
Discussion: http://postgr.es/m/CAFjFpRdLaCa-1wJase0=YWG5o3cJnbuUt_vrqm2TDBKM_vQ_oA@mail.gmail.com  

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

Document some new parallel query capabilities.

commit   : 054637d2e08cda6a096f48cc99696136a06f4ef5    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Mar 2017 13:02:34 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Mar 2017 13:02:34 -0500    

Click here for diff

This updates the text for parallel index scan, parallel index-only  
scan, parallel bitmap heap scan, and parallel merge join.  It also  
expands the discussion of parallel joins slightly.  
  
Discussion: http://postgr.es/m/CA+TgmoZnCUoM31w3w7JSakVQJQOtcuTyX=HLUr-X1rto2=2bjw@mail.gmail.com  

M doc/src/sgml/parallel.sgml

Fix bug in parallel tidbitmap iteration.

commit   : 6a468c343b31aabead7d3a5e11079bfcddbfd667    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Mar 2017 12:13:48 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Mar 2017 12:13:48 -0500    

Click here for diff

Avoid computing idxpages[istate->spageptr] until after checking  
that istate->spageptr is a legal index.  
  
Dilip Kumar, per a report from David Rowley  
  
Discussion: http://postgr.es/m/CAKJS1f8OtrHE+-P+=E=4ycnL29e9idZKuaTQ6o2MbhvGN9D8ig@mail.gmail.com  

M src/backend/nodes/tidbitmap.c

Fix a couple of planner bugs in Gather Merge.

commit   : 0ee92e1c9b570f90d043e5b033a19b67497ea1f6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Mar 2017 12:05:54 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Mar 2017 12:05:54 -0500    

Click here for diff

Neha Sharma reported these to Rushabh Lathia just after I commit  
355d3993c53ed62c5b53d020648e4fbcfbf5f155 went in.  The patch is  
Rushabh's, with input from me.  

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

Use SQL standard error code for nextval

commit   : cd603a4d6b5381cb28e993c6219037c2582100c9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 Feb 2017 15:14:14 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 Feb 2017 15:14:14 -0500    

Click here for diff

M src/backend/commands/sequence.c
M src/backend/utils/errcodes.txt

Enable replication connections by default in pg_hba.conf

commit   : be37c2120a2a88e5ba852d42952c77b6bf5d5271    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Mar 2017 08:27:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Mar 2017 08:27:16 -0500    

Click here for diff

initdb now initializes a pg_hba.conf that allows replication connections  
from the local host, same as it does for regular connections.  The  
connecting user still needs to have the REPLICATION attribute or be a  
superuser.  
  
The intent is to allow pg_basebackup from the local host to succeed  
without requiring additional configuration.  
  
Michael Paquier <[email protected]> and me  

M doc/src/sgml/ref/initdb.sgml
M src/backend/libpq/pg_hba.conf.sample
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/test/perl/PostgresNode.pm

Add a Gather Merge executor node.

commit   : 355d3993c53ed62c5b53d020648e4fbcfbf5f155    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Mar 2017 07:40:36 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Mar 2017 07:40:36 -0500    

Click here for diff

Like Gather, we spawn multiple workers and run the same plan in each  
one; however, Gather Merge is used when each worker produces the same  
output ordering and we want to preserve that output ordering while  
merging together the streams of tuples from various workers.  (In a  
way, Gather Merge is like a hybrid of Gather and MergeAppend.)  
  
This works out to a win if it saves us from having to perform an  
expensive Sort.  In cases where only a small amount of data would need  
to be sorted, it may actually be faster to use a regular Gather node  
and then sort the results afterward, because Gather Merge sometimes  
needs to wait synchronously for tuples whereas a pure Gather generally  
doesn't.  But if this avoids an expensive sort then it's a win.  
  
Rushabh Lathia, reviewed and tested by Amit Kapila, Thomas Munro,  
and Neha Sharma, and reviewed and revised by me.  
  
Discussion: http://postgr.es/m/CAGPqQf09oPX-cQRpBKS0Gq49Z+m6KBxgxd_p9gX8CKk_d75HoQ@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/commands/explain.c
M src/backend/executor/Makefile
M src/backend/executor/execProcnode.c
A src/backend/executor/nodeGatherMerge.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/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/pathnode.c
M src/backend/utils/misc/guc.c
A src/include/executor/nodeGatherMerge.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/test/regress/expected/select_parallel.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/select_parallel.sql
M src/tools/pgindent/typedefs.list

Fix inclusions of c.h from .h files.

commit   : a72f0365db4168e7d720608fe3ac0ca3fe9355df    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 20:58:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 20:58:17 -0500    

Click here for diff

We have a project policy that every .c file should start by including  
postgres.h, postgres_fe.h, or c.h as appropriate; and then there is no  
need for any .h file to explicitly include any of these.  Fix a few  
headers that were violating this policy by including c.h.  
  
Discussion: https://postgr.es/m/CAEepm=2zCoeq3QxVwhS5DFeUh=yU6z81pbWMgfOB8OzyiBwxzw@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/fetch.h
M src/bin/pg_rewind/pg_rewind.h

Fix inclusions of postgres_fe.h from .h files.

commit   : 9722bb5757c5e90617be685bf127911b63efe08d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 20:41:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 20:41:06 -0500    

Click here for diff

We have a project policy that every .c file should start by including  
postgres.h, postgres_fe.h, or c.h as appropriate; and then there is no  
need for any .h file to explicitly include any of these.  Fix a few  
headers that were violating this policy by including postgres_fe.h.  
  
Discussion: https://postgr.es/m/CAEepm=2zCoeq3QxVwhS5DFeUh=yU6z81pbWMgfOB8OzyiBwxzw@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/ecpglib/extern.h
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/interfaces/libpq/libpq-int.h
M src/test/isolation/isolation_main.c
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h
M src/test/regress/pg_regress_main.c

Bring plpgsql into line with header inclusion policy.

commit   : 08da52859a1fadeac10aab621c6c793791ec1f2c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 17:21:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 17:21:08 -0500    

Click here for diff

We have a project policy that every .c file should start by including  
postgres.h, postgres_fe.h, or c.h as appropriate; and then there is no  
need for any .h file to explicitly include any of these.  (The core  
reason for this policy is to make it easy to verify that pg_config_os.h  
is included before any system headers such as <stdio.h>; without that,  
we have portability issues on some platforms due to variation in largefile  
options across different modules in the backend.  Also, if .h files were  
responsible for choosing which of these key headers to include, .h files  
that need to be includable in either frontend or backend compiles would be  
in trouble.)  
  
plpgsql was blithely ignoring this policy, so whack it upside the head  
until it complies.  I also chose to standardize on including plpgsql's  
own .h files after all core-system headers that it pulls in.  That  
could've been done either way, but this way seems saner.  
  
Discussion: https://postgr.es/m/CAEepm=2zCoeq3QxVwhS5DFeUh=yU6z81pbWMgfOB8OzyiBwxzw@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/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

Document intentional violations of header inclusion policy.

commit   : d6b059ec740a6affce9a069f1210d161068317e3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 17:01:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 17:01:13 -0500    

Click here for diff

Although there are good reasons for our policy of including postgres.h  
as the first #include in every .c file, never from .h files, there are  
two places where it seems expedient to violate the policy because the  
alternative is to modify externally-supplied .c files.  (In the case  
of the regexp library, the idea that it's externally-supplied is kind  
of at odds with reality, but I haven't entirely given up hope that it  
will become a standalone project some day.)  Add some comments to make  
it explicit that this is a policy violation and provide the reasoning.  
  
In passing, move #include "miscadmin.h" out of regcomp.c and into  
regcustom.h, which is where it should be if we're taking this reasoning  
seriously at all.  
  
Discussion: https://postgr.es/m/CAEepm=2zCoeq3QxVwhS5DFeUh=yU6z81pbWMgfOB8OzyiBwxzw@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regcomp.c
M src/include/regex/regcustom.h
M src/include/snowball/header.h

Suppress compiler warning in slab.c.

commit   : 2f899e7d37ece937740c99164dd846c4b6f884eb    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 16:19:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 16:19:37 -0500    

Click here for diff

Compilers that don't realize that elog(ERROR) doesn't return  
complained that SlabRealloc() failed to return a value.  
  
While at it, fix the rather muddled header comment for the function.  
  
Per buildfarm.  

M src/backend/utils/mmgr/slab.c

Suppress compiler warning in non-USE_LIBXML builds.

commit   : f379121093deb5465b01d93ebe9410d96c6cd093    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 16:10:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 16:10:00 -0500    

Click here for diff

Compilers that don't realize that ereport(ERROR) doesn't return  
complained that XmlTableGetValue() failed to return a value.  
  
Also, make XmlTableFetchRow's non-USE_LIBXML case look more like  
the other ones.  As coded, it could lead to "unreachable code"  
warnings with USE_LIBXML enabled.  
  
Oversights in commit fcec6caaf.  Per buildfarm.  

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

Put back <float.h> in a few files that need it for _isnan().

commit   : 86dbbf20d8496ede77566873d1e22cd11c1e544c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 15:38:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 15:38:26 -0500    

Click here for diff

Further fallout from commit c29aff959: there are some files that need  
<float.h>, and were getting it from datatype/timestamp.h, but it was not  
apparent in my (tgl's) testing because the requirement for <float.h>  
exists only on certain Windows toolchains.  
  
Report and patch by David Rowley.  
  
Discussion: https://postgr.es/m/CAKJS1f-BHceaFzZScFapDV48gUVM2CAOBfhkgffdqXzFb+kwew@mail.gmail.com  

M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistutil.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/selfuncs.c

Expose explain's SUMMARY option

commit   : f9b1a0dd403ec0931213c66d5f979a3d3e8e7e30    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 8 Mar 2017 15:14:03 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 8 Mar 2017 15:14:03 -0500    

Click here for diff

This exposes the existing explain summary option to users to allow them  
to choose if they wish to have the planning time and totalled run time  
included in the EXPLAIN result.  The existing default behavior is  
retained if SUMMARY is not specified- running explain without analyze  
will not print the summary lines (just the planning time, currently)  
while running explain with analyze will include the summary lines (both  
the planning time and the totalled execution time).  
  
Users who wish to see the summary information for plain explain can now  
use: EXPLAIN (SUMMARY ON) query;  Users who do not want to have the  
summary printed for an analyze run can use:  
EXPLAIN (ANALYZE ON, SUMMARY OFF) query;  
  
With this, we can now also have EXPLAIN ANALYZE queries included in our  
regression tests by using:  
EXPLAIN (ANALYZE ON, TIMING OFF, SUMMARY off) query;  
  
I went ahead and added an example of this, which will hopefully not make  
the buildfarm complain.  
  
Author: Ashutosh Bapat  
Discussion: https://postgr.es/m/CAFjFpReE5z2h98U2Vuia8hcEkpRRwrauRjHmyE44hNv8-xk+XA@mail.gmail.com  

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

Silence compiler warnings in BitmapHeapNext().

commit   : 15d03e597662847e13428a8b3ce9dd59c38decf3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 12:43:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 12:43:39 -0500    

Click here for diff

Same disease as 270d7dd8a5a7128fc2b859f3bf95e2c1fb45be79.  

M src/backend/executor/nodeBitmapHeapscan.c

Use doubly-linked block lists in aset.c to reduce large-chunk overhead.

commit   : ff97741bc810390db6dd4da0f31ee1e93c8d3abb    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 12:21:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 12:21:12 -0500    

Click here for diff

Large chunks (those too large for any palloc freelist) are managed as  
separate blocks.  Formerly, realloc'ing or pfree'ing such a chunk required  
O(N) time in a context with N blocks, since we had to traipse down the  
singly-linked block list to locate the block's predecessor before we could  
fix the list links.  This can result in O(N^2) runtime in situations where  
large numbers of such chunks are manipulated within one context.  Cases  
like that were not foreseen in the original design of aset.c, and indeed  
didn't arise until fairly recently.  But such problems can now occur in  
reorderbuffer.c and in hash joining, both of which make repeated large  
requests without scaling up their request size as they do so, and which  
will free their requests in not-necessarily-LIFO order.  
  
To fix, change the block list from singly-linked to doubly-linked.  
This adds another 4 or 8 bytes to ALLOC_BLOCKHDRSZ, but that doesn't  
seem like unacceptable overhead, since aset.c's blocks are normally  
8K or more, and never less than 1K in current practice.  
  
In passing, get rid of some redundant AllocChunkGetPointer() calls in  
AllocSetRealloc (the compiler might be smart enough to optimize these  
away anyway, but no need to assume that) and improve AllocSetCheck's  
checking of block header fields.  
  
Back-patch to 9.4 where reorderbuffer.c appeared.  We could take this  
further back, but currently there's no evidence that it would be useful.  
  
Discussion: https://postgr.es/m/CAMkU=1x1hvue1XYrZoWk_omG0Ja5nBvTdvgrOeVkkeqs71CV8g@mail.gmail.com  

M src/backend/utils/mmgr/aset.c

Support parallel bitmap heap scans.

commit   : f35742ccb7aa53ee3ed8416bbb378b0c3eeb6bb9    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 8 Mar 2017 12:05:43 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 8 Mar 2017 12:05:43 -0500    

Click here for diff

The index is scanned by a single process, but then all cooperating  
processes can iterate jointly over the resulting set of heap blocks.  
In the future, we might also want to support using a parallel bitmap  
index scan to set up for a parallel bitmap heap scan, but that's a  
job for another day.  
  
Dilip Kumar, with some corrections and cosmetic changes by me.  The  
larger patch set of which this is a part has been reviewed and tested  
by (at least) Andres Freund, Amit Khandekar, Tushar Ahuja, Rafia  
Sabih, Haribabu Kommi, Thomas Munro, and me.  
  
Discussion: http://postgr.es/m/CAFiTN-uc4=0WxRGfCzs-xfkMYcSEWUC-Fon6thkJGjkh9i=13A@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/access/heap/heapam.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/backend/postmaster/pgstat.c
M src/include/access/heapam.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/pgstat.h
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Prevent logical rep workers with removed subscriptions from starting.

commit   : 4eafdcc27608dfb8a3afa3155d6ae07f66179782    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 9 Mar 2017 01:44:23 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 9 Mar 2017 01:44:23 +0900    

Click here for diff

Any logical rep workers must have their subscription entries in  
pg_subscription. To ensure this, we need to prevent the launcher  
from starting new worker corresponding to the subscription that  
DROP SUBSCRIPTION command is removing. To implement this,  
previously LogicalRepLauncherLock was introduced and held until  
the end of transaction running DROP SUBSCRIPTION. But using  
LWLock for that purpose was not valid.  
  
Instead, this commit changes DROP SUBSCRIPTION so that it takes  
AccessExclusiveLock on pg_subscription, in order to ensure that  
the launcher cannot see any subscriptions being removed. Also this  
commit gets rid of LogicalRepLauncherLock.  
  
Patch by me, reviewed by Petr Jelinek  
  
Discussion: https://www.postgresql.org/message-id/CAHGQGwHPi8ky-yANFfe0sgmhKtsYcQLTnKx07bW9S7-Rn1746w@mail.gmail.com  

M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/launcher.c
M src/backend/storage/lmgr/lwlocknames.txt

Fix XMLTABLE on older libxml2

commit   : a9f66f92533b2bfd7abf289219152091b7697e87    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 8 Mar 2017 13:29:48 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 8 Mar 2017 13:29:48 -0300    

Click here for diff

libxml2 older than 2.9.1 does not have xmlXPathSetContextNode (released  
in 2013, so reasonable platforms have trouble).  That function is fairly  
trivial, so I have inlined it in the one added caller.  This passes  
tests on my machine; let's see what the buildfarm thinks about it.  
  
Per joint complaint from Tom Lane and buildfarm.  

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

Add tests for foreign partitions.

commit   : 0d130c7abc85f828dced6c134a5fcbff3215c497    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 8 Mar 2017 11:26:03 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 8 Mar 2017 11:26:03 -0500    

Click here for diff

Amit Langote, reviewed by Ashutosh Bapat  
  
Discussion: http://postgr.es/m/[email protected]  

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

Support XMLTABLE query expression

commit   : fcec6caafa2346b6c9d3ad5065e417733bd63cd9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 8 Mar 2017 12:39:37 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 8 Mar 2017 12:39:37 -0300    

Click here for diff

XMLTABLE is defined by the SQL/XML standard as a feature that allows  
turning XML-formatted data into relational form, so that it can be used  
as a <table primary> in the FROM clause of a query.  
  
This new construct provides significant simplicity and performance  
benefit for XML data processing; what in a client-side custom  
implementation was reported to take 20 minutes can be executed in 400ms  
using XMLTABLE.  (The same functionality was said to take 10 seconds  
using nested PostgreSQL XPath function calls, and 5 seconds using  
XMLReader under PL/Python).  
  
The implemented syntax deviates slightly from what the standard  
requires.  First, the standard indicates that the PASSING clause is  
optional and that multiple XML input documents may be given to it; we  
make it mandatory and accept a single document only.  Second, we don't  
currently support a default namespace to be specified.  
  
This implementation relies on a new executor node based on a hardcoded  
method table.  (Because the grammar is fixed, there is no extensibility  
in the current approach; further constructs can be implemented on top of  
this such as JSON_TABLE, but they require changes to core code.)  
  
Author: Pavel Stehule, Ɓlvaro Herrera  
Extensively reviewed by: Craig Ringer  
Discussion: https://postgr.es/m/CAFj8pRAgfzMD-LoSmnMGybD0WsEznLHWap8DO79+-GTRAPR4qA@mail.gmail.com  

M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/func.sgml
M src/backend/commands/explain.c
M src/backend/executor/Makefile
M src/backend/executor/execAmi.c
M src/backend/executor/execProcnode.c
A src/backend/executor/nodeTableFuncscan.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/print.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/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/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/xml.c
M src/include/catalog/catversion.h
A src/include/executor/nodeTableFuncscan.h
A src/include/executor/tablefunc.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/nodes/primnodes.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/include/parser/kwlist.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_relation.h
M src/include/utils/xml.h
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

Silence compiler warnings in tbm_prepare_shared_iterate().

commit   : 270d7dd8a5a7128fc2b859f3bf95e2c1fb45be79    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 10:39:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Mar 2017 10:39:40 -0500    

Click here for diff

Maybe Robert's compiler can convince itself that these variables are  
never used uninitialized, but mine can't.  

M src/backend/nodes/tidbitmap.c

pg_waldump: Remove extra newline in error message

commit   : 911244610cd08fcdc28bd57db4a0d810cffc5080    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Mar 2017 09:57:17 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Mar 2017 09:57:17 -0500    

Click here for diff

fatal_error() already prints out a trailing newline.  

M src/bin/pg_waldump/pg_waldump.c

Fix connection leak in DROP SUBSCRIPTION command, take 2.

commit   : 77d21970ae19418f321e6a76ddf1a57ae999c77a    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 8 Mar 2017 23:43:38 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 8 Mar 2017 23:43:38 +0900    

Click here for diff

Commit 898a792eb8283e31efc0b6fcbc03bbcd5f7df667 fixed the connection  
leak issue, but it was an unreliable way of bugfix. This bugfix was  
assuming that walrcv_command() subroutine cannot throw an error,  
but it's untenable assumption. For example, if it will be changed  
so that an error is thrown, connection leak issue will happen again.  
  
This patch ensures that the connection is closed even when  
walrcv_command() subroutine throws an error.  
  
Patch by me, reviewed by Petr Jelinek and Michael Paquier  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/commands/subscriptioncmds.c

Create INSTALL file via XSLT

commit   : 044d9efb6c97d65247a1287e7676de0ee75b3cfe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Feb 2017 10:44:59 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Feb 2017 10:44:59 -0500    

Click here for diff

As before, create an INSTALL.html file for processing with lynx, but use  
xsltproc and a new XSLT stylesheet instead of jade and DSSSL.  
  
Replacing jade with xsltproc removes jade from the requirements for  
distribution building.  
  
Reviewed-by: Magnus Hagander <[email protected]>  

M doc/src/sgml/.gitignore
M doc/src/sgml/Makefile
A doc/src/sgml/stylesheet-text.xsl
M doc/src/sgml/stylesheet.dsl

Remove inclusion of postgres.h from a few header files.

commit   : d9528604ccb05f545be7ca2bad161877fd3d9c13    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 8 Mar 2017 08:18:12 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 8 Mar 2017 08:18:12 -0500    

Click here for diff

Thomas Munro, per project policy articuled by Andres Freund and  
Tom Lane.  
  
Discussion: http://postgr.es/m/CAEepm=2zCoeq3QxVwhS5DFeUh=yU6z81pbWMgfOB8OzyiBwxzw@mail.gmail.com  

M src/include/access/bufmask.h
M src/include/utils/dsa.h

Fix parallel index and index-only scans to fall back to serial.

commit   : 09529a70bb5a77935d086d651c63396767d240d7    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 8 Mar 2017 08:15:24 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 8 Mar 2017 08:15:24 -0500    

Click here for diff

Parallel executor nodes can't assume that parallel execution will  
happen in every case where the plan calls for it, because it might  
not work out that way.  However, parallel index scan and parallel  
index-only scan failed to do the right thing here.  Repair.  
  
Amit Kapila, per a report from me.  
  
Discussion: http://postgr.es/m/CAA4eK1Kq5qb_u2AOoda5XBB91vVWz90w=LgtRLgsssriS8pVTw@mail.gmail.com  

M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c

tidbitmap: Support shared iteration.

commit   : 98e6e89040a0534ca26914c66cae9dd49ef62ad9    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 8 Mar 2017 08:02:03 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 8 Mar 2017 08:02:03 -0500    

Click here for diff

When a shared iterator is used, each call to tbm_shared_iterate()  
returns a result that has not yet been returned to any process  
attached to the shared iterator.  In other words, each cooperating  
processes gets a disjoint subset of the full result set, but all  
results are returned exactly once.  
  
This is infrastructure for parallel bitmap heap scan.  
  
Dilip Kumar.  The larger patch set of which this is a part has been  
reviewed and tested by (at least) Andres Freund, Amit Khandekar,  
Tushar Ahuja, Rafia Sabih, Haribabu Kommi, and Thomas Munro.  
  
Discussion: http://postgr.es/m/CAFiTN-uc4=0WxRGfCzs-xfkMYcSEWUC-Fon6thkJGjkh9i=13A@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/access/gin/ginget.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/nodes/tidbitmap.c
M src/backend/storage/lmgr/lwlock.c
M src/include/nodes/tidbitmap.h
M src/include/storage/lwlock.h

Fix grammar

commit   : b7fa016d68b51bc385b75f9d5cffef79e5671981    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 7 Mar 2017 22:45:45 -0500    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 7 Mar 2017 22:45:45 -0500    

Click here for diff

Reported by Jeremy Finzel  

M doc/src/sgml/wal.sgml

Fix segfault in ALTER PUBLICATION/SUBSCRIPTION RENAME

commit   : b8957927e642ae15c01f985c17fd6fe00ec68069    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Mar 2017 22:44:59 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Mar 2017 22:44:59 -0500    

Click here for diff

From: Masahiko Sawada <[email protected]>  
Reported-by: Fujii Masao <[email protected]>  

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/publication.out
M src/test/regress/expected/subscription.out
M src/test/regress/sql/publication.sql
M src/test/regress/sql/subscription.sql

hash: Refactor hash index creation.

commit   : 38305398cdc029e3a74bfad1815cb33f5b087336    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 17:03:51 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 17:03:51 -0500    

Click here for diff

The primary goal here is to move all of the related page modifications  
to a single section of code, in preparation for adding write-ahead  
logging.  In passing, rename _hash_metapinit to _hash_init, since it  
initializes more than just the metapage.  
  
Amit Kapila.  The larger patch series of which this is a part has been  
reviewed and tested by Ɓlvaro Herrera, Ashutosh Sharma, Mark Kirkwood,  
Jeff Janes, and Jesper Pedersen.  

M src/backend/access/hash/hash.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/include/access/hash.h

Improve postgresql.conf.sample comments about parallel workers.

commit   : 2b87dd8d7ae33ef5c70671674c08bbff066738bf    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 15:30:03 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 15:30:03 -0500    

Click here for diff

David Rowley, reviewed by Amit Kapila  
  
Discussion: http://postgr.es/m/CAKJS1f8gPEUPscj6kSqpveMnnx9_3ZypzwsKstv+8atx6VmjBg@mail.gmail.com  

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

Properly initialize variable.

commit   : 506f05423a7c60eef8ed8b5430d03be1fec138a2    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 13:49:53 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 13:49:53 -0500    

Click here for diff

Commit 3bc7dafa9bebbdaa1bbf0da0798d29a8bdaf6a8f forgot to do this.  
  
Noted while experimenting with valgrind.  

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

Invent start_proc parameters for PL/Tcl.

commit   : 0d2b1f305dc78d536d80cfb4bb2ac4d7104453db    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Mar 2017 12:40:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Mar 2017 12:40:44 -0500    

Click here for diff

Define GUCs pltcl.start_proc and pltclu.start_proc.  When set to a  
nonempty value at the time a new Tcl interpreter is created, the  
parameterless pltcl or pltclu function named by the GUC is called to  
allow user-controlled initialization to occur within the interpreter.  
This is modeled on plv8's start_proc parameter, and also has much in  
common with plperl's on_init feature.  It allows users to fully  
replace the "modules" feature that was removed in commit 817f2a586.  
  
Since an initializer function could subvert later Tcl code in nearly  
arbitrary ways, mark both GUCs as SUSET for now.  It would be nice  
to find a way to relax that someday; but the corresponding GUCs in  
plperl are also SUSET, and there's not been much complaint.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pltcl.sgml
M src/pl/tcl/Makefile
A src/pl/tcl/expected/pltcl_start_proc.out
M src/pl/tcl/pltcl.c
A src/pl/tcl/sql/pltcl_start_proc.sql

Clean up test_ifaddrs a bit.

commit   : 03cf2219346aa78ecd1b6d4501a7697692a43c62    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Mar 2017 12:05:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Mar 2017 12:05:57 -0500    

Click here for diff

We customarily #include <netinet/in.h> before <arpa/inet.h>; according  
to our git history (cf commit 527f8babc) there used to be platform(s)  
where <arpa/inet.h> didn't compile otherwise.  That's probably not  
really an issue anymore, but since test_ifaddrs.c is the one and only  
place in our code that's not following that rule, bring it into line.  
Also remove #include <sys/socket.h>, as that's duplicative given that  
libpq/ifaddr.h does so (via pqcomm.h).  
  
In passing, add a .gitignore file so nobody accidentally commits the  
test_ifaddrs executable, as I nearly did.  
  
I see no particular need to back-patch this, as it's just neatnik-ism  
considering we don't build test_ifaddrs by default, or even document  
it anywhere.  

A src/tools/ifaddrs/.gitignore
M src/tools/ifaddrs/test_ifaddrs.c

A collection of small fixes for the SCRAM patch.

commit   : 95c1dbcdfffcc3a77e693c3c2759e26a01f465c8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Mar 2017 19:00:22 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Mar 2017 19:00:22 +0200    

Click here for diff

* Add required #includes for htonl. Per buildfarm members pademelon/gaur.  
  
* Remove unnecessary "#include <utils/memutils>".  
  
* Fix checking for empty string in pg_SASL_init. (Reported by Peter  
  Eisentraut and his compiler)  
  
* Move code in pg_SASL_init to match the recent changes (commit ba005f193d)  
  to pg_fe_sendauth() function, where it's copied from.  
  
* Return value of malloc() was not checked for NULL in  
  scram_SaltedPassword(). Fix by avoiding the malloc().  

M src/common/scram-common.c
M src/interfaces/libpq/fe-auth.c

Consider parallel merge joins.

commit   : 3bc7dafa9bebbdaa1bbf0da0798d29a8bdaf6a8f    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 11:49:49 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 11:49:49 -0500    

Click here for diff

Commit 45be99f8cd5d606086e0a458c9c72910ba8a613d took the position  
that performing a merge join in parallel was not likely to work out  
well, but this conclusion was greeted with skepticism even at the  
time.  Whether it was true then or not, it's clearly not true any  
more now that we have parallel index scan.  
  
Dilip Kumar, reviewed by Amit Kapila and by me.  
  
Discussion: http://postgr.es/m/CAFiTN-v3=cM6nyFwFGp0fmvY4=kk79Hq9Fgu0u8CSJ-EEq1Tiw@mail.gmail.com  

M src/backend/optimizer/path/joinpath.c
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Fix pgbench's failure to honor the documented long-form option "--builtin".

commit   : ef2662394455578f6c57e99a7896c69bdd9fbd74    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Mar 2017 11:36:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Mar 2017 11:36:35 -0500    

Click here for diff

Not only did it not accept --builtin as a synonym for -b, but what it did  
accept as a synonym was --tpc-b (huh?), which it got even further wrong  
by marking as no_argument, so that if you did try that you got a core  
dump.  I suppose this is leftover from some early design for the new  
switches added by commit 8bea3d221, but it's still pretty sloppy work.  
  
Per bug #14580 from Stepan Pesternikov.  Back-patch to 9.6 where the  
error was introduced.  
  
Report: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

Give partitioned table "p" in regression tests a less generic name.

commit   : aa56671836e6f80dc3bdc917dfc860ac10b822be    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 11:32:33 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 11:32:33 -0500    

Click here for diff

And don't drop it, so that we improve the coverage of the pg_upgrade  
regression tests.  
  
Amit Langote, per a gripe from Tom Lane  
  
Discussion: http://postgr.es/m/[email protected]  

M src/test/regress/expected/alter_table.out
M src/test/regress/expected/insert.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/insert.sql
M src/test/regress/sql/sanity_check.sql

Fix relcache reference leak.

commit   : d88d06cd0783933b7103d42d3f101baa22b37292    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 11:24:51 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 11:24:51 -0500    

Click here for diff

Reported by Kevin Grittner.  Faulty commit identified by Tom Lane.  
Patch by Amit Langote, reviewed by Michael Paquier.  
  
Discussion: http://postgr.es/m/CACjxUsOHbH1=99u8mGxmLHfy5hov4ENEpvM6=3ARjos7wG7rtQ@mail.gmail.com  

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

Remove duplicated word.

commit   : 508dabaf39e1f66cbe3fc54d2b66f010aa59c66b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 11:18:56 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 11:18:56 -0500    

Click here for diff

Amit Langote  

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

Document what values postgres_fdw sets for each parameter it sets.

commit   : 889a3f4892b271c502f74082a352447408f6292d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 10:57:46 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 10:57:46 -0500    

Click here for diff

David Rader, reviewed by me.  

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

Fix wrong word in comment.

commit   : cd87a5ed65f2b4f3bdf07c9664a64696c86d17be    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 10:43:28 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 10:43:28 -0500    

Click here for diff

Third time's the charm.  

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

Remove vestigial grammar support for CHARACTER ... CHARACTER SET option.

commit   : 11324e408f0e3a25621c611467927c644894b30d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Mar 2017 10:42:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Mar 2017 10:42:11 -0500    

Click here for diff

The SQL standard says that you should be able to write "CHARACTER SET foo"  
as part of the declaration of a char-type column.  We don't implement that,  
but a rough form of support has existed in gram.y since commit f10b63923.  
That's now sat there for nigh 20 years without anyone fleshing it out ---  
and even if someone did, the contemplated approach of having separate data  
type name(s) for every character set certainly isn't what we'd do today.  
Let's just remove the grammar production; if anyone is ever motivated to  
work on this, reinventing the grammar support is a trivial fraction of  
what they'd have to do.  And we've never documented anything about  
supporting such a clause.  
  
Per gripe from Neha Khatri.  
  
Discussion: https://postgr.es/m/CAFO0U+-iOS5oYN5v3SBuZvfhPUTRrkDFEx8w7H17B07Rwg3YUA@mail.gmail.com  

M src/backend/parser/gram.y

Preparatory refactoring for parallel merge join support.

commit   : a71f10189dc10a2fe422158a2c9409e0f77c6b9e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 10:33:29 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 10:33:29 -0500    

Click here for diff

Extract the logic used by hash_inner_and_outer into a separate  
function, get_cheapest_parallel_safe_total_inner, so that it can  
also be used to plan parallel merge joins.  
  
Also, add a require_parallel_safe argument to the existing function  
get_cheapest_path_for_pathkeys, because parallel merge join needs  
to find the cheapest path for a given set of pathkeys that is  
parallel-safe, not just the cheapest one overall.  
  
Patch by me, reviewed by Dilip Kumar.  
  
Discussion: http://postgr.es/m/CA+TgmoYOv+dFK0MWW6366dFj_xTnohQfoBDrHyB7d1oZhrgPjA@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/pathkeys.c
M src/include/optimizer/paths.h

Fix parallel hash join path search.

commit   : 655393a022bd653e2b48dbf20b69236981e35195    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 10:22:07 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Mar 2017 10:22:07 -0500    

Click here for diff

When the very cheapest path is not parallel-safe, we want to instead use  
the cheapest unparameterized path that is.  The old code searched  
innerrel->cheapest_parameterized_paths, but that isn't right, because  
the path we want may not be in that list.  Search innerrel->pathlist  
instead.  
  
Spotted by Dilip Kumar.  
  
Discussion: http://postgr.es/m/CAFiTN-szCEcZrQm0i_w4xqSaRUTOUFstNu32Zn4rxxDcoa8gnA@mail.gmail.com  

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

psql: Add \gx command

commit   : b2678efd43f17db7dfa04e0ca076ea01275cd9bc    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 7 Mar 2017 09:31:52 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 7 Mar 2017 09:31:52 -0500    

Click here for diff

It can often be useful to use expanded mode output (\x) for just a  
single query.  Introduce a \gx which acts exactly like \g except that it  
will force expanded output mode for that one \gx call.  This is simpler  
than having to use \x as a toggle and also means that the user doesn't  
have to worry about the current state of the expanded variable, or  
resetting it later, to ensure a given query is always returned in  
expanded mode.  
  
Primairly Christoph's patch, though I did tweak the documentation and help  
text a bit, and re-indented the tab completion section.  
  
Author: Christoph Berg  
Reviewed By: Daniel Verite  
Discussion: https://postgr.es/m/20170127132737.6skslelaf4txs6iw%40msg.credativ.de  

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

Allow pg_dumpall to dump roles w/o user passwords

commit   : 9a83d56b38c870ce47b7651385ff2add583bf136    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 7 Mar 2017 22:00:54 +0800    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 7 Mar 2017 22:00:54 +0800    

Click here for diff

Add new option --no-role-passwords which dumps roles without passwords.  
Since we donā€™t need passwords, we choose to use pg_roles in preference  
to pg_authid since access may be restricted for security reasons in  
some configrations.  
  
Robins Tharakan and Simon Riggs  

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

Fix comments in SCRAM-SHA-256 patch.

commit   : 55acfcbffd7d11db8c10cd94ba44bfe5974894e0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Mar 2017 15:22:52 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Mar 2017 15:22:52 +0200    

Click here for diff

Amit Kapila.  

M src/backend/libpq/auth-scram.c
M src/common/base64.c
M src/common/scram-common.c
M src/include/common/base64.h
M src/include/common/scram-common.h
M src/include/libpq/scram.h
M src/interfaces/libpq/fe-auth-scram.c

Ensure ThisTimeLineID is valid before START_REPLICATION

commit   : 5ee2197767f648bc21e324e751b84d42af573b43    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 7 Mar 2017 21:06:09 +0800    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 7 Mar 2017 21:06:09 +0800    

Click here for diff

Craig Ringer  

M src/backend/replication/walsender.c

Add regression tests for passwords.

commit   : 1fff35d872321015a87ca55042384b83f51dedcf    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Mar 2017 14:25:52 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Mar 2017 14:25:52 +0200    

Click here for diff

Michael Paquier.  

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

Support SCRAM-SHA-256 authentication (RFC 5802 and 7677).

commit   : 818fd4a67d610991757b610755e3065fb99d80a5    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Mar 2017 14:25:40 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Mar 2017 14:25:40 +0200    

Click here for diff

This introduces a new generic SASL authentication method, similar to the  
GSS and SSPI methods. The server first tells the client which SASL  
authentication mechanism to use, and then the mechanism-specific SASL  
messages are exchanged in AuthenticationSASLcontinue and PasswordMessage  
messages. Only SCRAM-SHA-256 is supported at the moment, but this allows  
adding more SASL mechanisms in the future, without changing the overall  
protocol.  
  
Support for channel binding, aka SCRAM-SHA-256-PLUS is left for later.  
  
The SASLPrep algorithm, for pre-processing the password, is not yet  
implemented. That could cause trouble, if you use a password with  
non-ASCII characters, and a client library that does implement SASLprep.  
That will hopefully be added later.  
  
Authorization identities, as specified in the SCRAM-SHA-256 specification,  
are ignored. SET SESSION AUTHORIZATION provides more or less the same  
functionality, anyway.  
  
If a user doesn't exist, perform a "mock" authentication, by constructing  
an authentic-looking challenge on the fly. The challenge is derived from  
a new system-wide random value, "mock authentication nonce", which is  
created at initdb, and stored in the control file. We go through these  
motions, in order to not give away the information on whether the user  
exists, to unauthenticated users.  
  
Bumps PG_CONTROL_VERSION, because of the new field in control file.  
  
Patch by Michael Paquier and Heikki Linnakangas, reviewed at different  
stages by Robert Haas, Stephen Frost, David Steele, Aleksander Alekseev,  
and many others.  
  
Discussion: https://www.postgresql.org/message-id/CAB7nPqRbR3GmFYdedCAhzukfKrgBLTLtMvENOmPrVWREsZkF8g%40mail.gmail.com  
Discussion: https://www.postgresql.org/message-id/CAB7nPqSMXU35g%3DW9X74HVeQp0uvgJxvYOuA4A-A3M%2B0wfEBv-w%40mail.gmail.com  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/pgcrypto/.gitignore
M contrib/pgcrypto/Makefile
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/create_role.sgml
M src/backend/access/transam/xlog.c
M src/backend/commands/user.c
M src/backend/libpq/Makefile
A src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/backend/libpq/pg_hba.conf.sample
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c
M src/bin/pg_controldata/pg_controldata.c
M src/common/Makefile
A src/common/base64.c
A src/common/scram-common.c
M src/include/access/xlog.h
M src/include/catalog/pg_control.h
A src/include/common/base64.h
A src/include/common/scram-common.h
M src/include/libpq/crypt.h
M src/include/libpq/hba.h
M src/include/libpq/pqcomm.h
A src/include/libpq/scram.h
M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile
A src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/tools/msvc/Mkvcbuild.pm

Refactor SHA2 functions and move them to src/common/.

commit   : 273c458a2b3a0fb73968020ea5e9e35eb6928967    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Mar 2017 14:23:49 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Mar 2017 14:23:49 +0200    

Click here for diff

This way both frontend and backends can use them. The functions are taken  
from pgcrypto, which now fetches the source files it needs from  
src/common/.  
  
A new interface is designed for the SHA2 functions, which allow linking  
to either OpenSSL or the in-core stuff taken from KAME as needed.  
  
Michael Paquier, reviewed by Robert Haas.  
  
Discussion: https://www.postgresql.org/message-id/CAB7nPqTGKuTM5jiZriHrNaQeVqp5e_iT3X4BFLWY_HyHxLvySQ%40mail.gmail.com  

M contrib/pgcrypto/.gitignore
M contrib/pgcrypto/Makefile
M contrib/pgcrypto/internal-sha2.c
D contrib/pgcrypto/sha2.h
M src/common/Makefile
R082 contrib/pgcrypto/sha2.c src/common/sha2.c
A src/common/sha2_openssl.c
A src/include/common/sha2.h
M src/tools/msvc/Mkvcbuild.pm

pg_dump: Properly handle public schema ACLs with --clean

commit   : 330b84d8c40864007833e05dc9d849c4bda77240    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 6 Mar 2017 23:29:02 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 6 Mar 2017 23:29:02 -0500    

Click here for diff

pg_dump has always handled the public schema in a special way when it  
comes to the "--clean" option.  To wit, we do not drop or recreate the  
public schema in "normal" mode, but when we are run in "--clean" mode  
then we do drop and recreate the public schema.  
  
When running in "--clean" mode, the public schema is dropped and then  
recreated and it is recreated with the normal schema-default privileges  
of "nothing".  This is unlike how the public schema starts life, which  
is to have CREATE and USAGE GRANT'd to the PUBLIC role, and that is what  
is recorded in pg_init_privs.  
  
Due to this, in "--clean" mode, pg_dump would mistakenly only dump out  
the set of privileges required to go from the initdb-time privileges on  
the public schema to whatever the current-state privileges are.  If the  
privileges were not changed from initdb time, then no privileges would  
be dumped out for the public schema, but with the schema being dropped  
and recreated, the result was that the public schema would have no ACLs  
on it instead of what it should have, which is the initdb-time  
privileges.  
  
Practically speaking, this meant that pg_dump with --clean mode dumping  
a database where the ACLs on the public schema were not changed from the  
default would, upon restore, result in a public schema with *no*  
privileges GRANT'd, not matching the state of the existing database  
(where the initdb-time privileges would have been CREATE and USAGE to  
the PUBLIC role for the public schema).  
  
To fix, adjust the query in getNamespaces() to ignore the pg_init_privs  
entry for the public schema when running in "--clean" mode, meaning that  
the privileges for the public schema would be dumped, correctly, as if  
it was going from a newly-created schema to the current state (which is,  
indeed, what will happen during the restore thanks to the DROP/CREATE).  
  
Only the public schema is handled in this special way by pg_dump, no  
other initdb-time objects are dropped/recreated in --clean mode.  
  
Back-patch to 9.6 where the bug was introduced.  
  
Discussion: https://postgr.es/m/3534542.o3cNaKiDID%40techfox  

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

Repair incorrect pg_dump labeling for some comments and security labels.

commit   : 299990ba16ab75b09b7fed61322f1f23fdc7cf4c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Mar 2017 19:33:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Mar 2017 19:33:59 -0500    

Click here for diff

We attached no schema label to comments for procedural languages, casts,  
transforms, operator classes, operator families, or text search objects.  
The first three categories of objects don't really have schemas, but  
pg_dump treats them as if they do, and it seems like the TocEntry fields  
for their comments had better match the TocEntry fields for the parent  
objects.  (As an example of a possible hazard, the type names in a CAST  
will be formatted with the assumption of a particular search_path, so  
failing to ensure that this same path is active for the COMMENT ON command  
could lead to an error or to attaching the comment to the wrong cast.)  
In the last six cases, this was a flat-out error --- possibly mine to  
begin with, but it was a long time ago.  
  
The security label for a procedural language was likewise not correctly  
labeled as to schema, and both the comment and security label for a  
procedural language were not correctly labeled as to owner.  
  
In simple cases the restore would accidentally work correctly anyway, since  
these comments and security labels would normally get emitted right after  
the owning object, and so the search path and active user would be correct  
anyhow.  But it could fail in corner cases; for example a schema-selective  
restore would omit comments it should include.  
  
Giuseppe Broccolo noted the oversight, and proposed the correct fix, for  
text search dictionary objects; I found the rest by cross-checking other  
dumpComment() calls.  These oversights are ancient, so back-patch all  
the way.  
  
Discussion: https://postgr.es/m/CAFzmHiWwwzLjzwM4x5ki5s_PDMR6NrkipZkjNnO3B0xEpBgJaA@mail.gmail.com  

M src/bin/pg_dump/pg_dump.c

Make simplehash.h grow hashtable in additional cases.

commit   : d4c62a6b623d6eef88218158e9fa3cf974c6c7e5    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 23 Nov 2016 00:23:42 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 23 Nov 2016 00:23:42 -0800    

Click here for diff

Increase the size when either the distance between actual and optimal  
slot grows too large, or when too many subsequent entries would have  
to be moved.  
  
This addresses reports that the simplehash performed, sometimes  
considerably, worse than dynahash.  
  
The reason turned out to be that insertions into the hashtable where,  
due to the use of parallel query, in effect done from another  
hashtable, in hash-value order.  If the target hashtable, due to  
mis-estimation, was sized a lot smaller than the source table(s) that  
lead to very imbalanced tables; a lot of entries in many close-by  
buckets from the source tables were inserted into a single, wider,  
bucket on the target table.  As the growth factor was solely computed  
based on the fillfactor, the performance of the table decreased  
further and further.  
  
b81b5a96f424531b was an attempt to address this problem for hash  
aggregates (but not for bitmap scans), but it turns out that the  
current method of mixing hash values often actually leaves neighboring  
hash-values close to each other, just in different value range.  It  
might be worth revisiting that independently of the performance issues  
addressed in this patch..  
  
To address that problem resize tables in two additional cases: Firstly  
when the optimal position for an entry would be far from the actual  
position, secondly when many entries would have to be moved to make  
space for the new entry (while satisfying the robin hood property).  
  
Due to the additional resizing threshold it seems possible, and  
testing confirms that so far, that a higher fillfactor doesn't hurt  
performance and saves a bit of memory.  It seems better to increase it  
now, before a release containing any of this code, rather than wonder  
in some later release.  
  
The various boundaries aren't determined in a particularly scientific  
manner, they might need some fine-tuning.  
  
In all my tests the new code now, even with parallelism, performs at  
least as good as the old code, in several scenarios significantly  
better.  
  
Reported-By: Dilip Kumar, Robert Haas, Kuntal Ghosh  
Discussion:  
    https://postgr.es/m/CAFiTN-vagvuAydKG9VnWcoK=ADAhxmOa4ZTrmNsViBBooTnriQ@mail.gmail.com  
    https://postgr.es/m/CAGz5QC+=fNTYgzMLTBUNeKt6uaWZFXJbkB5+7oWm-n9DwVxcLA@mail.gmail.com  

M src/include/lib/simplehash.h

pg_upgrade: Fix large object COMMENTS, SECURITY LABELS

commit   : ff992c074e308ade204a38eb43a6d19c8403414e    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 6 Mar 2017 17:03:57 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 6 Mar 2017 17:03:57 -0500    

Click here for diff

When performing a pg_upgrade, we copy the files behind pg_largeobject  
and pg_largeobject_metadata, allowing us to avoid having to dump out and  
reload the actual data for large objects and their ACLs.  
  
Unfortunately, that isn't all of the information which can be associated  
with large objects.  Currently, we also support COMMENTs and SECURITY  
LABELs with large objects and these were being silently dropped during a  
pg_upgrade as pg_dump would skip everything having to do with a large  
object and pg_upgrade only copied the tables mentioned to the new  
cluster.  
  
As the file copies happen after the catalog dump and reload, we can't  
simply include the COMMENTs and SECURITY LABELs in pg_dump's binary-mode  
output but we also have to include the actual large object definition as  
well.  With the definition, comments, and security labels in the pg_dump  
output and the file copies performed by pg_upgrade, all of the data and  
metadata associated with large objects is able to be successfully pulled  
forward across a pg_upgrade.  
  
In 9.6 and master, we can simply adjust the dump bitmask to indicate  
which components we don't want.  In 9.5 and earlier, we have to put  
explciit checks in in dumpBlob() and dumpBlobs() to not include the ACL  
or the data when in binary-upgrade mode.  
  
Adjustments made to the privileges regression test to allow another test  
(large_object.sql) to be added which explicitly leaves a large object  
with a comment in place to provide coverage of that case with  
pg_upgrade.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
A src/test/regress/expected/large_object.out
M src/test/regress/expected/privileges.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/large_object.sql
M src/test/regress/sql/privileges.sql

Avoid dangling pointer to relation name in RLS code path in DoCopy().

commit   : a8df75b0a470f477dad75a7408e429e10c13fc07    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Mar 2017 16:50:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Mar 2017 16:50:47 -0500    

Click here for diff

With RLS active, "COPY tab TO ..." failed under -DRELCACHE_FORCE_RELEASE,  
and would sometimes fail without that, because it used the relation name  
directly from the relcache as part of the parsetree it's building.  That  
becomes a potentially-dangling pointer as soon as the relcache entry is  
closed, a bit further down.  Typical symptom if the relcache entry chanced  
to get cleared would be "relation does not exist" error with a garbage  
relation name, or possibly a core dump; but if you were really truly  
unlucky, the COPY might copy from the wrong table.  
  
Per report from Andrew Dunstan that regression tests fail with  
-DRELCACHE_FORCE_RELEASE.  The core tests now pass for me (but have  
not tried "make check-world" yet).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copy.c

Combine several DROP variants into generic DropStmt

commit   : e6477a8134ace06ef3a45a7ce15813cd398e72d8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Feb 2017 23:10:07 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Feb 2017 23:10:07 -0500    

Click here for diff

Combine DROP of FOREIGN DATA WRAPPER, SERVER, POLICY, RULE, and TRIGGER  
into generic DropStmt grammar.  
  
Reviewed-by: Jim Nasby <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/ref/drop_foreign_data_wrapper.sgml
M doc/src/sgml/ref/drop_server.sgml
M src/backend/parser/gram.y

Allow dropping multiple functions at once

commit   : 583f6c414895e72c710f723fbb3649df664530d7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2016 12:00:00 -0500    

Click here for diff

The generic drop support already supported dropping multiple objects of  
the same kind at once.  But the previous representation  
of function signatures across two grammar symbols and structure members  
made this cumbersome to do for functions, so it was not supported.  Now  
that function signatures are represented by a single structure, it's  
trivial to add this support.  Same for aggregates and operators.  
  
Reviewed-by: Jim Nasby <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/ref/drop_aggregate.sgml
M doc/src/sgml/ref/drop_function.sgml
M doc/src/sgml/ref/drop_operator.sgml
M src/backend/parser/gram.y
M src/test/regress/expected/create_function_3.out
M src/test/regress/sql/create_function_3.sql

Replace LookupFuncNameTypeNames() with LookupFuncWithArgs()

commit   : 2ca64c6f7105f97ce886bdbbd880f50225bf24ba    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2016 12:00:00 -0500    

Click here for diff

The old function took function name and function argument list as  
separate arguments.  Now that all function signatures are passed around  
as ObjectWithArgs structs, this is no longer necessary and can be  
replaced by a function that takes ObjectWithArgs directly.  Similarly  
for aggregates and operators.  
  
Reviewed-by: Jim Nasby <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/catalog/aclchk.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/functioncmds.c
M src/backend/commands/opclasscmds.c
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/parser/parse_func.c
M src/backend/parser/parse_oper.c
M src/include/nodes/parsenodes.h
M src/include/parser/parse_func.h
M src/include/parser/parse_oper.h

Remove objname/objargs split for referring to objects

commit   : 8b6d6cf853aab12f0dc2adba7c99c3e458662734    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 12 Nov 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 12 Nov 2016 12:00:00 -0500    

Click here for diff

In simpler times, it might have worked to refer to all kinds of objects  
by a list of name components and an optional argument list.  But this  
doesn't work for all objects, which has resulted in a collection of  
hacks to place various other nodes types into these fields, which have  
to be unpacked at the other end.  This makes it also weird to represent  
lists of such things in the grammar, because they would have to be lists  
of singleton lists, to make the unpacking work consistently.  The other  
problem is that keeping separate name and args fields makes it awkward  
to deal with lists of functions.  
  
Change that by dropping the objargs field and have objname, renamed to  
object, be a generic Node, which can then be flexibly assigned and  
managed using the normal Node mechanisms.  In many cases it will still  
be a List of names, in some cases it will be a string Value, for types  
it will be the existing Typename, for functions it will now use the  
existing ObjectWithArgs node type.  Some of the more obscure object  
types still use somewhat arbitrary nested lists.  
  
Reviewed-by: Jim Nasby <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/catalog/objectaddress.c
M src/backend/commands/alter.c
M src/backend/commands/comment.c
M src/backend/commands/dropcmds.c
M src/backend/commands/extension.c
M src/backend/commands/seclabel.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/include/catalog/objectaddress.h
M src/include/commands/extension.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/event_trigger.out
M src/test/regress/expected/object_address.out
M src/test/regress/sql/event_trigger.sql

Add operator_with_argtypes grammar rule

commit   : 550214a4efb214dfc9c2a475607deeeea69da858    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2016 12:00:00 -0500    

Click here for diff

This makes the handling of operators similar to that of functions and  
aggregates.  
  
Rename node FuncWithArgs to ObjectWithArgs, to reflect the expanded use.  
  
Reviewed-by: Jim Nasby <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/catalog/aclchk.c
M src/backend/commands/functioncmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/tools/pgindent/typedefs.list

Use class_args field in opclass_drop

commit   : 63ebd377a6ecd3388596c3ea958e813f23b5f4ae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2016 12:00:00 -0500    

Click here for diff

This makes it consistent with the usage in opclass_item.  
  
Reviewed-by: Jim Nasby <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/commands/opclasscmds.c
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h

Fix incorrect comments.

commit   : 12a2544cb5f9e1f8541d1b941da6d9dae15f50a5    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 6 Mar 2017 13:10:55 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 6 Mar 2017 13:10:55 -0500    

Click here for diff

Commit 19dc233c32f2900e57b8da4f41c0f662ab42e080 introduced these  
comments.  Michael Paquier noticed that one of them had a typo, but  
a bigger problem is that they were not an accurate description of  
what the code was doing.  
  
Patch by me.  

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

Mark pg_start_backup and pg_stop_backup as parallel-restricted.

commit   : 9fe3c644a73198941e9a502958c24727dc4a6434    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 6 Mar 2017 12:41:55 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 6 Mar 2017 12:41:55 -0500    

Click here for diff

They depend on backend-private state that will not be synchronized by  
the parallel machinery, so they should not be marked parallel-safe.  
This issue also exists in 9.6, but we obviously can't do anything  
about 9.6 clusters that already exist.  Possibly this could be  
back-patched so that future 9.6 clusters would come out OK, or  
possibly we should back-patch some other fix, but that would need more  
discussion.  
  
David Steele, reviewed by Michael Paquier  
  
Discussion: http://postgr.es/m/CA+TgmoYCWfO2UM-t=HUMFJyxJywLDiLL0nAJpx88LKtvBvNECw@mail.gmail.com  

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

Fix user-after-free bug.

commit   : 7f6fa29f18aa84743185ee7ada97f277459228a7    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 6 Mar 2017 12:13:06 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 6 Mar 2017 12:13:06 -0500    

Click here for diff

Introduced by commit aea5d298362e881b13d95a48c5ae116879237389.  
  
Patch from Amit Kapila.  Issue discovered independently by Amit Kapila  
and Ashutosh Sharma.  

M src/backend/postmaster/bgworker.c

Reorder the asynchronous libpq calls for replication connection

commit   : e434ad39ae7316bcf35fd578dd34ad7e1ff3c25f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Mar 2017 09:33:26 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Mar 2017 09:33:26 -0500    

Click here for diff

Per libpq documentation, the initial state must be  
PGRES_POLLING_WRITING.  Failing to do that appears to cause some issues  
on some Windows systems.  
  
From: Petr Jelinek <[email protected]>  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Enhance docs for ALTER TABLE lock levels of storage parms

commit   : 6f3a13ff058f15d565a30c16c0c2cb14cc994e42    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 6 Mar 2017 16:48:12 +0530    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 6 Mar 2017 16:48:12 +0530    

Click here for diff

As requested by Robert Haas  

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

commit   : 21d4e2e20656381b4652eb675af4f6d65053607f    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 6 Mar 2017 16:04:31 +0530    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 6 Mar 2017 16:04:31 +0530    

Click here for diff

The following parameters are now updateable with ShareUpdateExclusiveLock  
effective_io_concurrency  
parallel_workers  
seq_page_cost  
random_page_cost  
n_distinct  
n_distinct_inherited  
  
Simon Riggs and FabrĆ­zio Mello  

M src/backend/access/common/reloptions.c
M src/backend/utils/cache/spccache.c

Allow partitioned tables to be dropped without CASCADE

commit   : 8b4d582d279d784616c228be58af1e39aa430402    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 6 Mar 2017 15:50:53 +0530    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 6 Mar 2017 15:50:53 +0530    

Click here for diff

Record partitioned table dependencies as DEPENDENCY_AUTO  
rather than DEPENDENCY_NORMAL, so that DROP TABLE just works.  
  
Remove all the tests for partitioned tables where earlier  
work had deliberately avoided using CASCADE.  
  
Amit Langote, reviewed by Ashutosh Bapat and myself  

M src/backend/commands/tablecmds.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/insert.out
M src/test/regress/expected/update.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/insert.sql
M src/test/regress/sql/update.sql

In rebuild_relation(), don't access an already-closed relcache entry.

commit   : dbca84f04ed5debe748029699aa44fa86beca32d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Mar 2017 16:09:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Mar 2017 16:09:33 -0500    

Click here for diff

This reliably fails with -DRELCACHE_FORCE_RELEASE, as reported by  
Andrew Dunstan, and could sometimes fail in normal operation, resulting  
in a wrong persistence value being used for the transient table.  
It's not immediately clear to me what effects that might have beyond  
the risk of a crash while accessing OldHeap->rd_rel->relpersistence,  
but it's probably not good.  
  
Bug introduced by commit f41872d0c, and made substantially worse by  
commit 85b506bbf, which added a second such access significantly  
later than the heap_close.  I doubt the first reference could fail  
in a production scenario, but the second one definitely could.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/cluster.c

pg_dump: Fix ordering

commit   : d77ff69341f20db348ba2a4b29c522a93ac8e901    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 4 Mar 2017 14:47:27 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 4 Mar 2017 14:47:27 -0500    

Click here for diff

Materialized views refresh should be last.  
  
From: Jim Nasby <[email protected]>  

M src/bin/pg_dump/pg_dump_sort.c

Disallow CREATE/DROP SUBSCRIPTION in transaction block

commit   : 272adf4f9cd67df323ae57ff3dee238b649d3b73    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 23:25:34 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 23:25:34 -0500    

Click here for diff

Disallow CREATE SUBSCRIPTION and DROP SUBSCRIPTION in a transaction  
block when the replication slot is to be created or dropped, since that  
cannot be rolled back.  
  
based on patch by Masahiko Sawada <[email protected]>  

M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/drop_subscription.sgml
M src/backend/commands/subscriptioncmds.c
M src/backend/tcop/utility.c
M src/include/commands/subscriptioncmds.h
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql

Fix parsing of DROP SUBSCRIPTION ... DROP SLOT

commit   : 347302730dc3092143ccbc1c29b47ac3354f924b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 22:14:58 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 22:14:58 -0500    

Click here for diff

It didn't actually parse before.  
  
Reported-by: Masahiko Sawada <[email protected]>  

M src/backend/parser/gram.y
M src/test/subscription/t/001_rep_changes.pl

Fix two recently introduced grammar errors in mmgr/README.

commit   : 1309375e706440e1e2fe2a5bb74effbc639261ef    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 3 Mar 2017 17:54:46 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 3 Mar 2017 17:54:46 -0800    

Click here for diff

These were introduced by me in f4e2d50c.  
  
Reported-By: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/README

Fix typo

commit   : 2357c12b4988b4d30c1e2e813e438424546eaa88    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 18:21:06 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 18:21:06 -0500    

Click here for diff

M src/backend/commands/tablecmds.c

doc: Put callouts in SQL comments

commit   : 47b55d4174fd5662cd2f8c40852a20eec5f07c8f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 15:03:03 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 15:03:03 -0500    

Click here for diff

This makes copy-and-pasting the SQL code easier.  
  
From: Thomas Munro <[email protected]>  

M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/query.sgml

psql: Add tab completion for logical replication

commit   : 6f236e1eb8c7601bded96fd96244d676e95b8c26    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 14:13:48 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 14:13:48 -0500    

Click here for diff

Add tab completion for publications and subscriptions.  Also, to be able  
to get a list of subscriptions, make pg_subscription world-readable but  
revoke access to subconninfo using column privileges.  
  
From: Michael Paquier <[email protected]>  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/system_views.sql
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h

Add RENAME support for PUBLICATIONs and SUBSCRIPTIONs

commit   : 6da9759a03d6d985c3b95a3177bbda7bcffd0ae6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 10:47:04 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 10:47:04 -0500    

Click here for diff

From: Petr Jelinek <[email protected]>  

M src/backend/commands/alter.c
M src/backend/parser/gram.y
M src/backend/replication/logical/worker.c
M src/bin/psql/tab-complete.c
M src/test/regress/expected/publication.out
M src/test/regress/expected/subscription.out
M src/test/regress/sql/publication.sql
M src/test/regress/sql/subscription.sql
M src/test/subscription/t/001_rep_changes.pl

Fix after trigger execution in logical replication

commit   : 713f7c47d9c38654adbc36c47fd9e439f0d1f715    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 10:05:56 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 10:05:56 -0500    

Click here for diff

From: Petr Jelinek <[email protected]>  
Tested-by: Thom Brown <[email protected]>  

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

Use asynchronous connect API in libpqwalreceiver

commit   : 1e8a850094478a2036891fa3d4ce769bce411ee3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 09:07:22 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2017 09:07:22 -0500    

Click here for diff

This makes the connection attempt from CREATE SUBSCRIPTION and from  
WalReceiver interruptable by the user in case the libpq connection is  
hanging.  The previous coding required immediate shutdown (SIGQUIT) of  
PostgreSQL in that situation.  
  
From: Petr Jelinek <[email protected]>  
Tested-by: Thom Brown <[email protected]>  

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

Allow vacuums to report oldestxmin

commit   : 9eb344faf54a849898d9be012ddfa8204cfeb57c    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 3 Mar 2017 19:18:25 +0530    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 3 Mar 2017 19:18:25 +0530    

Click here for diff

Allow VACUUM and Autovacuum to report the oldestxmin value they  
used while cleaning tables, helping to make better sense out of  
the other statistics we report in various cases.  

M src/backend/commands/vacuumlazy.c

Add pg_current_logfile() function.

commit   : 19dc233c32f2900e57b8da4f41c0f662ab42e080    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Mar 2017 11:32:45 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Mar 2017 11:32:45 +0530    

Click here for diff

The syslogger will write out the current stderr and csvlog names, if  
it's running and there are any, to a new file in the data directory  
called "current_logfiles".  We take care to remove this file when it  
might no longer be valid (but not at shutdown).  The function  
pg_current_logfile() can be used to read the entries in the file.  
  
Gilles Darold, reviewed and modified by Karl O.  Pinc, Michael  
Paquier, and me.  Further review by Ɓlvaro Herrera and Christoph Berg.  

M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/storage.sgml
M src/backend/catalog/system_views.sql
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/replication/basebackup.c
M src/backend/utils/adt/misc.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/postmaster/syslogger.h

Notify bgworker registrant after freeing worker slot.

commit   : aea5d298362e881b13d95a48c5ae116879237389    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Mar 2017 09:14:49 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Mar 2017 09:14:49 +0530    

Click here for diff

Tom Lane observed buildfarm failures caused by the select_parallel  
regression test trying to launch new parallel queries before the  
worker slots used by the previous ones were freed.  Try to fix this by  
having the postmaster free the worker slots before it sends the  
SIGUSR1 notifications to the registering process.  This doesn't  
completely eliminate the possibility that the user backend might  
(correctly) observe the worker as dead before the slot is free, but I  
believe it should make the window significantly narrower.  
  
Patch by me, per complaint from Tom Lane.  Reviewed by Amit Kapila.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/postmaster/bgworker.c
M src/backend/postmaster/postmaster.c
M src/include/postmaster/bgworker_internals.h

Improve error reporting for tuple-routing failures.

commit   : 5a73e17317e91912b2755f7960d5bf31d374cf31    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Mar 2017 09:07:41 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Mar 2017 09:07:41 +0530    

Click here for diff

Currently, the whole row is shown without column names.  Instead,  
adopt a style similar to _bt_check_unique() in ExecFindPartition()  
and show the failing key: (key1, ...) = (val1, ...).  
  
Amit Langote, per a complaint from Simon Riggs.  Reviewed by me;  
I also adjusted the grammar in one of the comments.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/access/index/genam.c
M src/backend/catalog/partition.c
M src/backend/executor/execMain.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/partition.h
M src/include/utils/ruleutils.h
M src/test/regress/expected/insert.out
M src/test/regress/sql/insert.sql

Correct old release note item

commit   : be6ed6451c693d9121d357996cbc21b06058b9c1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 2 Mar 2017 11:09:44 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 2 Mar 2017 11:09:44 -0500    

Click here for diff

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

Update documentation of tsquery_phrase().

commit   : d99706ed5178d7f37ac322e02e8c56e4e5e0e99a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Mar 2017 09:34:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Mar 2017 09:34:35 -0500    

Click here for diff

Missed in commit 028350f61.  Noted by Eiji Seki.  

M doc/src/sgml/func.sgml

Refactor bitmap heap scan in preparation for parallel support.

commit   : 9e0fe09fc5dc1135479b532d1806e28cbc5a35aa    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Mar 2017 18:47:40 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Mar 2017 18:47:40 +0530    

Click here for diff

The final patch will be less messy if the prefetching support is  
a bit better isolated, so do that.  
  
Dilip Kumar, with some changes by me.  The larger patch set of which  
this is a part has been reviewed and tested by (at least) Andres  
Freund, Amit Khandekar, Tushar Ahuja, Rafia Sabih, Haribabu Kommi, and  
Thomas Munro.  

M src/backend/executor/nodeBitmapHeapscan.c

Don't uselessly rewrite, truncate, VACUUM, or ANALYZE partitioned tables.

commit   : 3c3bb99330aa9b4c2f6258bfa0265d806bf365c3    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Mar 2017 17:18:19 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Mar 2017 17:18:19 +0530    

Click here for diff

Also, recursively perform VACUUM and ANALYZE on partitions when the  
command is applied to a partitioned table.  In passing, some related  
documentation updates.  
  
Amit Langote, reviewed by Michael Paquier, Ashutosh Bapat, and by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/vacuum.sgml
M src/backend/commands/analyze.c
M src/backend/commands/tablecmds.c
M src/backend/commands/vacuum.c

Update comments overlooked by 2f5c9d9c9cec436e55847ec580606d7e88067df6.

commit   : fa42b2005f0cd825fe5a5fd4db93a7c30b5fe883    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Mar 2017 17:03:50 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Mar 2017 17:03:50 +0530    

Click here for diff

Tomas Vondra  

M src/backend/catalog/index.c
M src/backend/utils/cache/syscache.c

Handle unaligned SerializeSnapshot() buffer.

commit   : 7f3112135eb67e5df56cd34b8ce662bf6a2390e9    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 2 Mar 2017 00:03:27 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 2 Mar 2017 00:03:27 -0500    

Click here for diff

Likewise in RestoreSnapshot().  Do so by copying between the user buffer  
and a stack buffer of known alignment.  Back-patch to 9.6, where this  
last applies cleanly.  In master, the select_parallel test dies with  
SIGBUS on "Oracle Solaris 10 1/13 s10s_u11wos_24a SPARC", building  
32-bit with gcc 4.9.2.  In 9.6 and 9.5, the buffers in question happen  
to be sufficiently-aligned, and this change is mere insurance against  
future 9.6 changes or extension code compromising that.  

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

Create <sect3> in the functions-xml section

commit   : 4461a9bfd1ac4aa1f922e8309e79d097bde9fcb4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 1 Mar 2017 19:27:24 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 1 Mar 2017 19:27:24 -0300    

Click here for diff

This is a small change so that a new XMLTABLE sect3 can be added easily  
later.  
  
Author: Craig Ringer  
Discussion: https://postgr.es/m/CAFj8pRAgfzMD-LoSmnMGybD0WsEznLHWap8DO79+-GTRAPR4qA@mail.gmail.com  

M doc/src/sgml/func.sgml

Fix timeouts in PostgresNode::psql

commit   : 231f48796bcf2976f19122b8c6e12f50b463f94e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Mar 2017 13:52:38 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Mar 2017 13:52:38 -0500    

Click here for diff

Newer Perl or IPC::Run versions default to appending the filename to string  
exceptions, e.g. the exception  
  
    psql timed out  
  
 is thrown as  
  
    psql timed out at /usr/share/perl5/vendor_perl/IPC/Run.pm line 2961.  
  
To handle this, match exceptions with !~ rather than ne.  
  
From: Craig Ringer <[email protected]>  
Reviewed-by: Dagfinn Ilmari MannsĆ„ker <[email protected]>  

M src/test/perl/PostgresNode.pm

Fix s/ITERTOR/ITERATOR/ typo in simplehash.h.

commit   : 8f7277dfb5e703a034dbce7b155d998e577a6bc3    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 1 Mar 2017 10:17:12 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 1 Mar 2017 10:17:12 -0800    

Click here for diff

This could lead to problem when simplehash.h is used to define two  
different types of hashtable visible in the same translation unit.  
  
Reported-By: Josh Soref  
Discussion: https://postgr.es/m/CACZqfqCC7WdBAY=rQePb9-qW1rjdaTdHsV5KoVejHkDb6qrtOg@mail.gmail.com  

M src/include/lib/simplehash.h

Fix naming inconsistency

commit   : 005638e9886aeedeeef933bdbd123d928053d390    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Mar 2017 12:22:33 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Mar 2017 12:22:33 -0500    

Click here for diff

subobjid -> objsubid  
  
From: Jim Nasby <[email protected]>  

M src/backend/catalog/objectaddress.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/object_address.out
M src/test/regress/sql/object_address.sql

Collect duplicate copies of oid_cmp()

commit   : 20f6d74242b3c9c84924e890248d027d30283e21    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Mar 2017 11:55:28 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Mar 2017 11:55:28 -0500    

Click here for diff

M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/oid.c
M src/include/utils/builtins.h

Move atooid() definition to a central place

commit   : 788af6f8541d5f30acec540e4fd3cb24f5347209    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Mar 2017 11:55:28 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Mar 2017 11:55:28 -0500    

Click here for diff

M contrib/lo/lo.c
M contrib/vacuumlo/vacuumlo.c
M src/backend/bootstrap/bootparse.y
M src/backend/libpq/hba.c
M src/backend/nodes/readfuncs.c
M src/backend/utils/adt/misc.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/psql/common.h
M src/bin/scripts/droplang.c
M src/include/fe_utils/string_utils.h
M src/include/postgres_ext.h

psql: Add tab completion for DEALLOCATE

commit   : b5a388392dab4c4a7c0fbd6cd0ad7421eabfc5cf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Mar 2017 08:51:57 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Mar 2017 08:51:57 -0500    

Click here for diff

EXECUTE already tab-completes the list of prepared statements, but  
DEALLOCATE was missing.  
  
From: Dagfinn Ilmari MannsĆ„ker <[email protected]>  

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

hash: Refactor and clean up bucket split code.

commit   : 21a3cf41284c08307ef9abe3400be5dc53723519    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 1 Mar 2017 14:43:38 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 1 Mar 2017 14:43:38 +0530    

Click here for diff

As with commit 30df93f698d016d086e8961aa6c6076b37ea0ef4 and commit  
b0f18cb77f50a54e997d857d592f6a511617f52c, the goal here is to move all  
of the related page modifications to a single section of code, in  
preparation for adding write-ahead logging.  
  
Amit Kapila, with slight changes by me.  The larger patch series of  
which this is a part has been reviewed and tested by Ɓlvaro Herrera,  
Ashutosh Sharma, Mark Kirkwood, Jeff Janes, and Jesper Pedersen.  

M src/backend/access/hash/hashpage.c

Fix assertion failure due to over-eager code deduplication.

commit   : 123ccbe58309d08e42009e99a4b34a3a1aef7798    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 28 Feb 2017 20:41:44 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 28 Feb 2017 20:41:44 -0800    

Click here for diff

In the previous commit I'd made MemoryContextContains() use  
GetMemoryChunkContext(), but that causes trouble when the passed  
pointer isn't allocated in any memory context - that's probably  
something we shouldn't do, but the previous commit isn't a place for a  
"policy" change.  

M src/backend/utils/mmgr/mcxt.c

Overhaul memory management README.

commit   : f4e2d50cd7483a068c0a32e56b2d40f980cdea72    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 28 Feb 2017 10:36:29 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 28 Feb 2017 10:36:29 -0800    

Click here for diff

The README was written as a "historical account", and that style  
hasn't aged particularly well.  Rephrase it to describe the current  
situation, instead of having various version specific comments.  
  
This also updates the description of how allocated chunks are  
associated with their corresponding context, the method of which has  
changed in the preceding commit.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/README

Reduce size of common allocation header.

commit   : 7e3aa03b418d604d33040ed8fb866857dae82a02    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 27 Feb 2017 23:32:22 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 27 Feb 2017 23:32:22 -0800    

Click here for diff

The new slab allocator needs different per-allocation information than  
the classical aset.c.  The definition in 58b25e981 wasn't sufficiently  
careful on 32 platforms with 8 byte alignment, leading to buildfarm  
failures.  That's not entirely easy to fix by just adjusting the  
definition.  
  
As slab.c doesn't actually need the size part(s) of the common header,  
all chunks are equally sized after all, it seems better to instead  
reduce the header to the part needed by all allocators, namely which  
context an allocation belongs to. That has the advantage of reducing  
the overhead of slab allocations, and also allows for more flexibility  
in future allocators.  
  
To avoid spreading the logic about accessing a chunk's context around,  
centralize it in GetMemoryChunkContext(), which allows to delete a  
good number of lines.  
  
A followup commit will revise the mmgr/README portion about  
StandardChunkHeader, and more.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c
M src/include/utils/memutils.h
M src/tools/pgindent/typedefs.list

Use proper enum constants for LockWaitPolicy

commit   : eb75f4fced77e108393f18425ec3f7aba2e70a9d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Feb 2017 23:46:06 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Feb 2017 23:46:06 -0500    

Click here for diff

M src/backend/executor/execReplication.c

Fix incorrect variable datatype

commit   : 016c9908347ed2ba7b9d7101c858ea7730b6c0b0    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 28 Feb 2017 12:16:42 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 28 Feb 2017 12:16:42 +0100    

Click here for diff

Both datatypes map to the same underlying one which is why it still  
worked, but we should use the correct type.  
  
Author: Kyotaro HORIGUCHI  

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

Allow index AMs to return either HeapTuple or IndexTuple format during IOS.

commit   : 9b88f27cb42fe8ff59ddc75e29c005624b8850a2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Feb 2017 17:20:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Feb 2017 17:20:34 -0500    

Click here for diff

Previously, only IndexTuple format was supported for the output data of  
an index-only scan.  This is fine for btree, which is just returning a  
verbatim index tuple anyway.  It's not so fine for SP-GiST, which can  
return reconstructed data that's much larger than a page.  
  
To fix, extend the index AM API so that index-only scan data can be  
returned in either HeapTuple or IndexTuple format.  There's other ways  
we could have done it, but this way avoids an API break for index AMs  
that aren't concerned with the issue, and it costs little except a couple  
more fields in IndexScanDescs.  
  
I changed both GiST and SP-GiST to use the HeapTuple method.  I'm not  
very clear on whether GiST can reconstruct data that's too large for an  
IndexTuple, but that seems possible, and it's not much of a code change to  
fix.  
  
Per a complaint from Vik Fearing.  Reviewed by Jason Li.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/indexam.sgml
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/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/spgist/spgscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/include/access/gist_private.h
M src/include/access/relscan.h
M src/include/access/spgist_private.h

hash: Refactor overflow page allocation.

commit   : 30df93f698d016d086e8961aa6c6076b37ea0ef4    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 27 Feb 2017 22:56:34 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 27 Feb 2017 22:56:34 +0530    

Click here for diff

As with commit b0f18cb77f50a54e997d857d592f6a511617f52c, the goal  
here is to move all of the related page modifications to a single  
section of code, in preparation for adding write-ahead logging.  
  
Amit Kapila, with slight changes by me.  The larger patch series  
of which this is a part has been reviewed and tested by Ɓlvaro  
Herrera, Ashutosh Sharma, Mark Kirkwood, Jeff Janes, and Jesper  
Pedersen, all of whom should also have been credited in the  
previous commit message.  

M src/backend/access/hash/hashovfl.c
M src/include/access/hash.h

hash: Refactor bucket squeeze code.

commit   : b0f18cb77f50a54e997d857d592f6a511617f52c    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 27 Feb 2017 22:34:21 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 27 Feb 2017 22:34:21 +0530    

Click here for diff

In preparation for adding write-ahead logging to hash indexes,  
refactor _hash_freeovflpage and _hash_squeezebucket so that all  
related page modifications happen in a single section of code.  The  
previous coding assumed that it would be fine to move tuples one at a  
time, and also that the various operations involved in freeing an  
overflow page didn't necessarily all need to be done together, all  
of which is true if you don't care about write-ahead logging.  
  
Amit Kapila, with slight changes by me.  

M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/storage/page/bufpage.c
M src/include/access/hash.h
M src/include/storage/bufpage.h

Remove PL/Tcl's "module" facility.

commit   : 817f2a586342767d3289a320bb1dac5dcbb76979    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Feb 2017 11:20:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Feb 2017 11:20:22 -0500    

Click here for diff

PL/Tcl has long had a facility whereby Tcl code could be autoloaded from  
a database table named "pltcl_modules".  However, nobody is using it, as  
evidenced by the recent discovery that it's never been fixed to work with  
standard_conforming_strings turned on.  Moreover, it's rather shaky from  
a security standpoint, and the table design is very old and crufty (partly  
because it dates from before we had TOAST).  A final problem is that  
because the table-population scripts depend on the Tcl client library  
Pgtcl, which we removed from the core distribution in 2004, it's  
impossible to create a self-contained regression test for the feature.  
Rather than try to surmount these problems, let's just remove it.  
  
A follow-on patch will provide a way to execute user-defined  
initialization code, similar to features that exist in plperl and plv8.  
With that, it will be possible to implement this feature or similar ones  
entirely in userspace, which is where it belongs.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pltcl.sgml
M src/pl/tcl/Makefile
D src/pl/tcl/modules/.gitignore
D src/pl/tcl/modules/Makefile
D src/pl/tcl/modules/README
D src/pl/tcl/modules/pltcl_delmod.in
D src/pl/tcl/modules/pltcl_listmod.in
D src/pl/tcl/modules/pltcl_loadmod.in
D src/pl/tcl/modules/unknown.pltcl
M src/pl/tcl/pltcl.c

chomp PQerrorMessage() in backend uses

commit   : 2ed193c904679a533d5e26a27c97119793bcae52    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Feb 2017 08:30:06 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Feb 2017 08:30:06 -0500    

Click here for diff

PQerrorMessage() returns an error message with a trailing newline, but  
in backend use (dblink, postgres_fdw, libpqwalreceiver), we want to have  
the error message without that for emitting via ereport().  To simplify  
that, add a function pchomp() that returns a pstrdup'ed string with the  
trailing newline characters removed.  

M contrib/dblink/dblink.c
M contrib/dblink/expected/dblink.out
M contrib/postgres_fdw/connection.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/utils/mmgr/mcxt.c
M src/include/utils/palloc.h

Use the new "Slab" context for some allocations in reorderbuffer.h.

commit   : 9fab40ad32efa4038d19eaed975bb4c1713ccbc0    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 27 Feb 2017 03:41:44 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 27 Feb 2017 03:41:44 -0800    

Click here for diff

Note that this change alone does not yet fully address the performance  
problems triggering this work, a large portion of the slowdown is  
triggered by the tuple allocator, which isn't converted to the new  
allocator.  It would be possible to do so, but using evenly sized  
objects, like both the current implementation in reorderbuffer.c and  
slab.c, wastes a fair amount of memory.  A later patch by Tomas will  
introduce a better approach.  
  
Author: Tomas Vondra  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Add "Slab" MemoryContext implementation for efficient equal-sized allocations.

commit   : 58b25e98106dbe062cec0f3d31d64977bffaa4af    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 27 Feb 2017 03:41:44 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 27 Feb 2017 03:41:44 -0800    

Click here for diff

The default general purpose aset.c style memory context is not a great  
choice for allocations that are all going to be evenly sized,  
especially when those objects aren't small, and have varying  
lifetimes.  There tends to be a lot of fragmentation, larger  
allocations always directly go to libc rather than have their cost  
amortized over several pallocs.  
  
These problems lead to the introduction of ad-hoc slab allocators in  
reorderbuffer.c. But it turns out that the simplistic implementation  
leads to problems when a lot of objects are allocated and freed, as  
aset.c is still the underlying implementation. Especially freeing can  
easily run into O(n^2) behavior in aset.c.  
  
While the O(n^2) behavior in aset.c can, and probably will, be  
addressed, custom allocators for this behavior are more efficient  
both in space and time.  
  
This allocator is for evenly sized allocations, and supports both  
cheap allocations and freeing, without fragmenting significantly.  It  
does so by allocating evenly sized blocks via malloc(), and carves  
them into chunks that can be used for allocations.  In order to  
release blocks to the OS as early as possible, chunks are allocated  
from the fullest block that still has free objects, increasing the  
likelihood of a block being entirely unused.  
  
A subsequent commit uses this in reorderbuffer.c, but a further  
allocator is needed to resolve the performance problems triggering  
this work.  
  
There likely are further potentialy uses of this allocator besides  
reorderbuffer.c.  
  
There's potential further optimizations of the new slab.c, in  
particular the array of freelists could be replaced by a more  
intelligent structure - but for now this looks more than good enough.  
  
Author: Tomas Vondra, editorialized by Andres Freund  
Reviewed-By: Andres Freund, Petr Jelinek, Robert Haas, Jim Nasby  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/Makefile
A src/backend/utils/mmgr/slab.c
M src/include/nodes/memnodes.h
M src/include/nodes/nodes.h
M src/include/utils/memutils.h
M src/tools/pgindent/typedefs.list

Make useful infrastructure from aset.c generally available.

commit   : bfd12cccbd72c1846bfa3e4031155c9bd479d70a    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 27 Feb 2017 03:41:44 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 27 Feb 2017 03:41:44 -0800    

Click here for diff

An upcoming patch introduces a new type of memory context. To avoid  
duplicating debugging infrastructure within aset.c, move useful pieces  
to memdebug.[ch].  
  
While touching aset.c, fix printf format code in AllocFree* debug  
macros.  
  
Author: Tomas Vondra  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/Makefile
M src/backend/utils/mmgr/aset.c
A src/backend/utils/mmgr/memdebug.c
M src/include/utils/memdebug.h

Add missing progname prefix to some messages

commit   : 1513dbea7f89053476a5e95e2f2e952135a5b34c    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 26 Feb 2017 21:29:34 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 26 Feb 2017 21:29:34 +0100    

Click here for diff

Author: Michael Banck  

M src/bin/pg_basebackup/pg_basebackup.c

Clarify the role of checkpoint at the begininng of base backups

commit   : 51e26c9c3d2904b65041fc4a19c72c62508f63d4    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 26 Feb 2017 21:27:51 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 26 Feb 2017 21:27:51 +0100    

Click here for diff

Output a message about checkpoint starting in verbose mode of  
pg_basebackup, and make the documentation state more clearly that this  
happens.  
  
Author: Michael Banck  

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

TAP tests for target_session_attrs connection parameter.

commit   : caa6c1f193a9ab4b4fb9b8687f41e6d66bbeaade    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 26 Feb 2017 23:41:23 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 26 Feb 2017 23:41:23 +0530    

Click here for diff

Michael Paquier  

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

Basic tab completion for partitioning.

commit   : 9d1fb11a95bafdae9889898361f70e9bcbef6993    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 26 Feb 2017 22:50:00 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 26 Feb 2017 22:50:00 +0530    

Click here for diff

Amit Langote  
  
Discussion: http://postgr.es/m/CA+TgmobYOj=A8GesiEs_V2Wq46-_w0+7MOwPiNWC+iuzJ-uWjA@mail.gmail.com  

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

Allow custom and foreign scans to have shutdown callbacks.

commit   : a315b967cc1bd43ecf3c10ea48b44a4fb0ff8d45    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 26 Feb 2017 13:36:49 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 26 Feb 2017 13:36:49 +0530    

Click here for diff

This is expected to be useful mostly when performing such scans in  
parallel, because in that case it allows (in combination with commit  
acf555bc53acb589b5a2827e65d655fa8c9adee0) nodes below a Gather to get  
control just before the DSM segment goes away.  
  
KaiGai Kohei, except that I rewrote the documentation.  Reviewed by  
Claudio Freire.  
  
Discussion: http://postgr.es/m/CADyhKSXJK0jUJ8rWv4AmKDhsUh124_rEn39eqgfC5D8fu6xVuw@mail.gmail.com  

M doc/src/sgml/custom-scan.sgml
M doc/src/sgml/fdwhandler.sgml
M src/backend/executor/execProcnode.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/extensible.h

Put back #include <windows.h> in dirmod.c.

commit   : 285ca26132abdd0a1adc11a21789f103c4e3f6d8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Feb 2017 18:34:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Feb 2017 18:34:09 -0500    

Click here for diff

I removed this in commit 9e3755ecb, reasoning that the win32.h  
port-specific header file included by c.h would have provided it.  
However, that's only true on native win32 builds, not Cygwin builds.  
  
It may be that some of the other <windows.h> inclusions also need  
to be put back on the same grounds; but this is the only one that  
is clearly meant to be included #ifdef __CYGWIN__, so maybe this is  
the extent of the problem.  Awaiting further buildfarm results.  

M src/port/dirmod.c

Remove some configure header-file checks that we weren't really using.

commit   : 2bd7f85796ec373ecae61dd480437b3e668ec883    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Feb 2017 18:10:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Feb 2017 18:10:09 -0500    

Click here for diff

We had some AC_CHECK_HEADER tests that were really wastes of cycles,  
because the code proceeded to #include those headers unconditionally  
anyway, in all or a large majority of cases.  The lack of complaints  
shows that those headers are available on every platform of interest,  
so we might as well let configure run a bit faster by not probing  
those headers at all.  
  
I suspect that some of the tests I left alone are equally useless, but  
since all the existing #includes of the remaining headers are properly  
guarded, I didn't touch them.  

M config/ac_func_accept_argtypes.m4
M config/c-library.m4
M configure
M configure.in
M src/backend/libpq/ifaddr.c
M src/bin/psql/command.c
M src/include/libpq/libpq-be.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Remove useless duplicate inclusions of system header files.

commit   : 9e3755ecb2d058f7d123dd35a2e1784006190962    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Feb 2017 16:12:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Feb 2017 16:12:24 -0500    

Click here for diff

c.h #includes a number of core libc header files, such as <stdio.h>.  
There's no point in re-including these after having read postgres.h,  
postgres_fe.h, or c.h; so remove code that did so.  
  
While at it, also fix some places that were ignoring our standard pattern  
of "include postgres[_fe].h, then system header files, then other Postgres  
header files".  While there's not any great magic in doing it that way  
rather than system headers last, it's silly to have just a few files  
deviating from the general pattern.  (But I didn't attempt to enforce this  
globally, only in files I was touching anyway.)  
  
I'd be the first to say that this is mostly compulsive neatnik-ism,  
but over time it might save enough compile cycles to be useful.  

M contrib/fuzzystrmatch/dmetaphone.c
M contrib/ltree/crc32.c
M contrib/pgcrypto/px.h
M src/backend/access/transam/timeline.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlogarchive.c
M src/backend/commands/dbcommands.c
M src/backend/commands/tablespace.c
M src/backend/libpq/ifaddr.c
M src/backend/port/atomics.c
M src/backend/port/dynloader/freebsd.h
M src/backend/port/dynloader/netbsd.h
M src/backend/port/dynloader/openbsd.h
M src/backend/port/win32/crashdump.c
M src/backend/postmaster/autovacuum.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/latch.c
M src/backend/utils/adt/cash.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/inet_cidr_ntop.c
M src/backend/utils/adt/inet_net_pton.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/init/miscinit.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/fetch.c
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pgevent/pgevent.c
M src/bin/psql/command.c
M src/bin/psql/crosstabview.c
M src/bin/psql/help.c
M src/bin/psql/startup.c
M src/common/ip.c
M src/common/username.c
M src/common/wait_error.c
M src/fe_utils/print.c
M src/include/libpq/libpq.h
M src/include/port/atomics/generic-msvc.h
M src/include/utils/pg_locale.h
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/typename.c
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/pthread-win32.c
M src/pl/plperl/plperl.c
M src/port/chklocale.c
M src/port/dirmod.c
M src/port/inet_net_ntop.c
M src/port/open.c
M src/port/system.c
M src/test/isolation/isolationtester.c
M src/timezone/strftime.c
M src/timezone/zic.c

pg_upgrade docs: clarify instructions on standby extensions

commit   : 5639ceddcb7f3efa8751b2ba6e50cc1d27cc2a45    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 Feb 2017 12:59:23 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 Feb 2017 12:59:23 -0500    

Click here for diff

Previously the pg_upgrade standby upgrade instructions said not to  
execute pgcrypto.sql, but it should have referenced the extension  
command "CREATE EXTENSION pgcrypto".  This patch makes that doc change.  
  
Reported-by: a private bug report  
  
Backpatch-through: 9.4, where standby instructions were added  

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

Suppress compiler warnings in ecpg test on newer Windows toolchains.

commit   : c5658a0764d5ac5ea8c2c11d27c62d5472234227    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Feb 2017 16:45:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Feb 2017 16:45:32 -0500    

Click here for diff

nan_test.pgc supposed that it could unconditionally #define isnan()  
and isinf() on WIN32.  This was evidently copied at some point from  
src/include/port/win32.h, but nowadays there's a test on _MSC_VER  
there.  Make nan_test.pgc look the same.  
  
Per buildfarm warnings.  There's no evidence this produces anything  
worse than a warning, and besides it's only a test case, so I don't  
feel a need to back-patch.  

M src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.stderr
M src/interfaces/ecpg/test/pgtypeslib/nan_test.pgc

Fix unportable definition of BSWAP64() macro.

commit   : 41c16edcf6c90d1f42810ea523b7e65c99edad50    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Feb 2017 15:21:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Feb 2017 15:21:39 -0500    

Click here for diff

We have a portable way of writing uint64 constants, but whoever wrote  
this macro didn't know about it.  
  
While at it, fix unsafe under-parenthesization of arguments.  That might  
be moot, because there are already good reasons not to use the macro on  
anything more complicated than a simple variable, but it's still poor  
practice.  
  
Per buildfarm warnings.  

M src/include/port/pg_bswap.h

Make tablesample work with partitioned tables.

commit   : 5dbdb2f799232cb1b6df7d7a85d59ade3234d30c    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 24 Feb 2017 12:21:46 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 24 Feb 2017 12:21:46 +0530    

Click here for diff

This was an oversight in the original partitioning commit.  
  
Amit Langote, reviewed by David Fetter  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/parser/parse_clause.c
M src/test/regress/expected/tablesample.out
M src/test/regress/sql/tablesample.sql

Add an Assert that enum_cmp_internal() gets passed an FmgrInfo pointer.

commit   : 6d493e1a013514a6f0abb5d30d08219c1831cfec    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Feb 2017 22:08:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Feb 2017 22:08:10 -0500    

Click here for diff

If someone were to try to call one of the enum comparison functions  
using DirectFunctionCallN, it would very likely seem to work, because  
only in unusual cases does enum_cmp_internal() need to access the  
typcache.  But once such a case occurred, code like that would crash  
with a null pointer dereference.  To make an oversight of that sort  
less likely to escape detection, add a non-bypassable Assert that  
fcinfo->flinfo isn't NULL.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Consistently declare timestamp variables as TimestampTz.

commit   : c29aff959dc64f7321062e7f33d8c6ec23db53d3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Feb 2017 15:57:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Feb 2017 15:57:08 -0500    

Click here for diff

Twiddle the replication-related code so that its timestamp variables  
are declared TimestampTz, rather than the uninformative "int64" that  
was previously used for meant-to-be-always-integer timestamps.  
This resolves the int64-vs-TimestampTz declaration inconsistencies  
introduced by commit 7c030783a, though in the opposite direction to  
what was originally suggested.  
  
This required including datatype/timestamp.h in a couple more places  
than before.  I decided it would be a good idea to slim down that  
header by not having it pull in <float.h> etc, as those headers are  
no longer at all relevant to its purpose.  Unsurprisingly, a small number  
of .c files turn out to have been depending on those inclusions, so add  
them back in the .c files as needed.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/auth_delay/auth_delay.c
M contrib/btree_gist/btree_ts.c
M src/backend/access/common/reloptions.c
M src/backend/access/transam/xlog.c
M src/backend/commands/prepare.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/tcop/pquery.c
M src/backend/utils/adt/nabstime.c
M src/backend/utils/cache/inval.c
M src/backend/utils/time/snapmgr.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/include/datatype/timestamp.h
M src/include/utils/snapmgr.h
M src/include/utils/snapshot.h
M src/include/utils/timestamp.h

Remove now-dead code for !HAVE_INT64_TIMESTAMP.

commit   : b9d092c962ea3262930e3c31a8c3d79b66ce9d43    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Feb 2017 14:04:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Feb 2017 14:04:43 -0500    

Click here for diff

This is a basically mechanical removal of #ifdef HAVE_INT64_TIMESTAMP  
tests and the negative-case controlled code.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gist/btree_time.c
M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_utils_num.h
M src/backend/commands/variable.c
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/misc.c
M src/backend/utils/adt/nabstime.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/misc/guc.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_waldump/compat.c
M src/include/datatype/timestamp.h
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/include/utils/timestamp.h
M src/interfaces/ecpg/include/pgtypes_interval.h
M src/interfaces/ecpg/include/pgtypes_timestamp.h
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c

Remove pg_control's enableIntTimes field.

commit   : d28aafb6dda326688e2f042c95c93ea57963c03c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Feb 2017 12:23:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Feb 2017 12:23:12 -0500    

Click here for diff

We don't need it any more.  
  
pg_controldata continues to report that date/time type storage is  
"64-bit integers", but that's now a hard-wired behavior not something  
it sees in the data.  This avoids breaking pg_upgrade, and perhaps other  
utilities that inspect pg_control this way.  Ditto for pg_resetwal.  
  
I chose to remove the "bigint_timestamps" output column of  
pg_control_init(), though, as that function hasn't been around long  
and probably doesn't have ossified users.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/access/transam/xlog.c
M src/backend/utils/misc/pg_controldata.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_proc.h

De-support floating-point timestamps.

commit   : b6aa17e0ae367afdcea07118e016111af4fa6bc3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Feb 2017 11:40:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Feb 2017 11:40:12 -0500    

Click here for diff

Per discussion, the time has come to do this.  The handwriting has been  
on the wall at least since 9.0 that this would happen someday, whenever  
it got to be too much of a burden to support the float-timestamp option.  
The triggering factor now is the discovery that there are multiple bugs  
in the code that attempts to implement use of integer timestamps in the  
replication protocol even when the server is built for float timestamps.  
The internal float timestamps leak into the protocol fields in places.  
While we could fix the identified bugs, there's a very high risk of  
introducing more.  Trying to build a wall that would positively prevent  
mixing integer and float timestamps is more complexity than we want to  
undertake to maintain a long-deprecated option.  The fact that these  
bugs weren't found through testing also indicates a lack of interest  
in float timestamps.  
  
This commit disables configure's --disable-integer-datetimes switch  
(it'll still accept --enable-integer-datetimes, though), removes direct  
references to USE_INTEGER_DATETIMES, and removes discussion of float  
timestamps from the user documentation.  A considerable amount of code is  
rendered dead by this, but removing that will occur as separate mop-up.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M doc/src/sgml/config.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/installation.sgml
M src/include/c.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/interfaces/ecpg/include/ecpg_config.h.in
M src/interfaces/ecpg/include/pgtypes_interval.h
M src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
M src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout
M src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc
M src/tools/msvc/Solution.pm
M src/tools/msvc/config_default.pl

Fix logical replication with different encodings

commit   : c3368f9173c13e2e293df91f75f1a5c565c4ca18    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Feb 2017 11:27:59 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Feb 2017 11:27:59 -0500    

Click here for diff

reported by Shinoda, Noriyoshi <[email protected]>; partial  
patch by Kyotaro HORIGUCHI <[email protected]>  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/proto.c

Remove deprecated COMMENT ON RULE syntax

commit   : e8d016d81940e75c126aa52971b7903b7301002e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Feb 2017 08:45:14 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Feb 2017 08:45:14 -0500    

Click here for diff

This was only used for allowing upgrades from pre-7.3 instances, which  
was a long time ago.  

M src/backend/catalog/objectaddress.c
M src/backend/parser/gram.y
M src/backend/rewrite/rewriteSupport.c
M src/include/rewrite/rewriteSupport.h
M src/test/modules/test_ddl_deparse/expected/comment_on.out
M src/test/modules/test_ddl_deparse/sql/comment_on.sql
M src/test/regress/expected/object_address.out

Fix contrib/pg_trgm's extraction of trigrams from regular expressions.

commit   : 9e43e8714c9e976e41b7429fa7c426c9a6e5e8e6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 Feb 2017 15:04:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 Feb 2017 15:04:07 -0500    

Click here for diff

The logic for removing excess trigrams from the result was faulty.  
It intends to avoid merging the initial and final states of the NFA,  
which is necessary, but in testing whether removal of a specific trigram  
would cause that, it failed to consider the combined effects of all the  
state merges that that trigram's removal would cause.  This could result  
in a broken final graph that would never match anything, leading to GIN  
or GiST indexscans not finding anything.  
  
To fix, add a "tentParent" field that is used only within this loop,  
and set it to show state merges that we are tentatively going to do.  
While examining a particular arc, we must chase up through tentParent  
links as well as regular parent links (the former can only appear atop  
the latter), and we must account for state init/fin flag merges that  
haven't actually been done yet.  
  
To simplify the latter, combine the separate init and fin bool fields  
into a bitmap flags field.  I also chose to get rid of the "children"  
state list, which seems entirely inessential.  
  
Per bug #14563 from Alexey Isayko, which the added test cases are based on.  
Back-patch to 9.3 where this code was added.  
  
Report: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_trgm/expected/pg_trgm.out
M contrib/pg_trgm/sql/pg_trgm.sql
M contrib/pg_trgm/trgm_regexp.c

Correctly handle array pseudotypes in to_json and to_jsonb

commit   : 502a3832cc54c7115dacb8a2dae06f0620995ac6    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 22 Feb 2017 11:10:49 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 22 Feb 2017 11:10:49 -0500    

Click here for diff

Columns with array pseudotypes have not been identified as arrays, so  
they have been rendered as strings in the json and jsonb conversion  
routines. This change allows them to be rendered as json arrays, making  
it possible to deal correctly with the anyarray columns in pg_stats.  

M src/backend/utils/adt/json.c
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

Pass the source text for a parallel query to the workers.

commit   : 4c728f382970b6346142fe4409212063ee3e92dc    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 22 Feb 2017 12:15:17 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 22 Feb 2017 12:15:17 +0530    

Click here for diff

With this change, you can see the query that a parallel worker is  
executing in pg_stat_activity, and if the worker crashes you can  
see what query it was executing when it crashed.  
  
Rafia Sabih, reviewed by Kuntal Ghosh and Amit Kapila and slightly  
revised by me.  

M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execUtils.c
M src/include/nodes/execnodes.h

Fix incorrect typecast.

commit   : b4316928d57bec22e95875e6487a4d665bd03a52    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 22 Feb 2017 12:05:42 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 22 Feb 2017 12:05:42 +0530    

Click here for diff

Ashutosh Sharma, per a report from Mithun Cy.  
  
Discussion: http://postgr.es/m/CAD__OujgqNNnCujeFTmKpjNu+W4smS8Hbi=RcWAhf1ZUs3H4WA@mail.gmail.com  

M contrib/pageinspect/hashfuncs.c

Shut down Gather's children before shutting down Gather itself.

commit   : acf555bc53acb589b5a2827e65d655fa8c9adee0    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 22 Feb 2017 07:59:27 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 22 Feb 2017 07:59:27 +0530    

Click here for diff

It turns out that the original shutdown order here does not work well.  
Multiple people attempting to develop further parallel query patches  
have discovered that they need to do cleanup before the DSM goes away,  
and you can't do that if the parent node gets cleaned up first.  
  
Patch by me, reviewed by KaiGai Kohei and Dilip Kumar.  
  
Discussion: http://postgr.es/m/CA+TgmoY6bOc1YnhcAQnMfCBDbsJzROQ3sYxSAL-SYB5tMJcTKg@mail.gmail.com  
Discussion: http://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/CA+TgmoYuPOc=+xrG1v0fCsoLbKAab9F1ddOeaaiLMzKOiBar1Q@mail.gmail.com  

M src/backend/executor/execProcnode.c
M src/backend/executor/nodeGather.c

doc: Add missing comma.

commit   : d912dd062b64287adcabab4180abafefd07cea14    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 22 Feb 2017 06:49:39 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 22 Feb 2017 06:49:39 +0530    

Click here for diff

Yugo Nagata  

M doc/src/sgml/ddl.sgml

Suppress unused-variable warning.

commit   : c56ac2913a1f3adce674a2eb27257d0bca81317f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Feb 2017 17:58:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Feb 2017 17:58:24 -0500    

Click here for diff

Rearrange so we don't have an unused variable in disable-cassert case.  
  
Discussion: https://postgr.es/m/CAMkU=1x63f2QyFTeas83xJqD+Hm1PBuok1LrzYzS-OngDzYOVA@mail.gmail.com  

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

Fix sloppy handling of corner-case errors in fd.c.

commit   : f97de05a14bbd26cf0252906b44643e8923bdf85    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Feb 2017 17:51:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Feb 2017 17:51:27 -0500    

Click here for diff

Several places in fd.c had badly-thought-through handling of error returns  
from lseek() and close().  The fact that those would seldom fail on valid  
FDs is probably the reason we've not noticed this up to now; but if they  
did fail, we'd get quite confused.  
  
LruDelete and LruInsert actually just Assert'd that lseek never fails,  
which is pretty awful on its face.  
  
In LruDelete, we indeed can't throw an error, because that's likely to get  
called during error abort and so throwing an error would probably just lead  
to an infinite loop.  But by the same token, throwing an error from the  
close() right after that was ill-advised, not to mention that it would've  
left the LRU state corrupted since we'd already unlinked the VFD from the  
list.  I also noticed that really, most of the time, we should know the  
current seek position and it shouldn't be necessary to do an lseek here at  
all.  As patched, if we don't have a seek position and an lseek attempt  
doesn't give us one, we'll close the file but then subsequent re-open  
attempts will fail (except in the somewhat-unlikely case that a  
FileSeek(SEEK_SET) call comes between and allows us to re-establish a known  
target seek position).  This isn't great but it won't result in any state  
corruption.  
  
Meanwhile, having an Assert instead of an honest test in LruInsert is  
really dangerous: if that lseek failed, a subsequent read or write would  
read or write from the start of the file, not where the caller expected,  
leading to data corruption.  
  
In both LruDelete and FileClose, if close() fails, just LOG that and mark  
the VFD closed anyway.  Possibly leaking an FD is preferable to getting  
into an infinite loop or corrupting the VFD list.  Besides, as far as I can  
tell from the POSIX spec, it's unspecified whether or not the file has been  
closed, so treating it as still open could be the wrong thing anyhow.  
  
I also fixed a number of other places that were being sloppy about  
behaving correctly when the seekPos is unknown.  
  
Also, I changed FileSeek to return -1 with EINVAL for the cases where it  
detects a bad offset, rather than throwing a hard elog(ERROR).  It seemed  
pretty inconsistent that some bad-offset cases would get a failure return  
while others got elog(ERROR).  It was missing an offset validity check for  
the SEEK_CUR case on a closed file, too.  
  
Back-patch to all supported branches, since all this code is fundamentally  
identical in all of them.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add tests for two-phase commit

commit   : 30820982b295404ed00ddd28c8864211dc986dd3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Feb 2017 18:20:48 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Feb 2017 18:20:48 -0300    

Click here for diff

There's some ongoing performance work on this area, so let's make sure  
we don't break things.  
  
Extracted from a larger patch originally by Stas Kelvich.  
  
Authors: Stas Kelvich, Nikhil Sontakke, Michael Paquier  
Discussion: https://postgr.es/m/CAMGcDxfsuLLOg=h5cTg3g77Jjk-UGnt=RW7zK57zBSoFsapiWA@mail.gmail.com  

A src/test/recovery/t/009_twophase.pl

Fix whitespace

commit   : 74321d87fb1a27746c9dd0853b2da3287a0940d9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Feb 2017 15:44:07 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Feb 2017 15:44:07 -0500    

Click here for diff

M src/backend/commands/subscriptioncmds.c

Fix typo in comment.

commit   : e14ec7d346f8686c9471c16a01579d6b1c3b4975    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 22 Feb 2017 03:39:45 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 22 Feb 2017 03:39:45 +0900    

Click here for diff

neha khatri  

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

Fix connection leak in DROP SUBSCRIPTION command.

commit   : 898a792eb8283e31efc0b6fcbc03bbcd5f7df667    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 22 Feb 2017 03:36:02 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 22 Feb 2017 03:36:02 +0900    

Click here for diff

Previously the command forgot to close the connection to the publisher  
when it failed to drop the replication slot.  

M src/backend/commands/subscriptioncmds.c

Make walsender always initialize the buffers.

commit   : 1d04a59be31bf004b880226be0e3fe84acff2815    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 22 Feb 2017 03:11:58 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 22 Feb 2017 03:11:58 +0900    

Click here for diff

Walsender uses the local buffers for each outgoing and incoming message.  
Previously when creating replication slot, walsender forgot to initialize  
one of them and which can cause the segmentation fault error. To fix this  
issue, this commit changes walsender so that it always initialize them  
before it executes the requested replication command.  
  
Back-patch to 9.4 where replication slot was introduced.  
  
Problem report and initial patch by Stas Kelvich, modified by me.  
Report: https://www.postgresql.org/message-id/[email protected]  

M src/backend/replication/walsender.c

Remove confusing comment about unsupported feature.

commit   : d36537008a8d53853d2fda49913cb54fa6e28f94    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 22 Feb 2017 02:49:42 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 22 Feb 2017 02:49:42 +0900    

Click here for diff

The initial table synchronization feature has not been supported yet,  
but there was the confusing header comment about it in logical/worker.c.  

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

doc: Update URL for plr

commit   : 7248099c169b40b8f70cdaf8e12d0deaab9b16e2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Feb 2017 12:34:25 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Feb 2017 12:34:25 -0500    

Click here for diff

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

Use less-generic table name in new regression test case.

commit   : 1c95f0b478a91b58391720dcda35bc032e582564    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Feb 2017 12:18:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Feb 2017 12:18:22 -0500    

Click here for diff

Creating global objects named "foo" isn't an especially wise thing,  
but especially not in a test script that has already used that name  
for something else, and most especially not in a script that runs  
in parallel with other scripts that use that name :-(  
  
Per buildfarm.  

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

Make more use of castNode()

commit   : 38d103763d14baddf3cbfe4b00b501059fc9447f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Feb 2017 11:33:07 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Feb 2017 11:33:07 -0500    

Click here for diff

M src/backend/commands/copy.c
M src/backend/nodes/nodeFuncs.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/path/joinrels.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/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/clauses.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/misc/guc.c
M src/pl/plpgsql/src/pl_handler.c
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c

Reject too-old Python versions a bit sooner.

commit   : 4e5ce3c1aeadf81b504bc9d683b67950bd3f8766    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Feb 2017 11:28:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Feb 2017 11:28:23 -0500    

Click here for diff

Commit 04aad4018 added this check after the search for a Python shared  
library, which seems to me to be a pretty unfriendly ordering.  The  
search might fail for what are basically version-related reasons, and  
in such a case it'd be better to say "your Python is too old" than  
"could not find shared library for Python".  

M config/python.m4
M configure
M configure.in

Drop support for Python 2.3

commit   : 04aad401867ad3e1519615d8486e32b50dbcb5f5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Feb 2017 09:27:02 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Feb 2017 09:27:02 -0500    

Click here for diff

There is no specific reason for this right now, but keeping support for  
old Python versions around indefinitely increases the maintenance  
burden.  The oldest supported Python version is now Python 2.4, which is  
still shipped in RHEL/CentOS 5 by default.  
  
In configure, add a check for the required Python version and give a  
friendly error message for an old version, instead of relying on an  
obscure build error later on.  

M config/python.m4
M configure
M configure.in
M contrib/hstore_plpython/expected/hstore_plpython.out
M contrib/hstore_plpython/sql/hstore_plpython.sql
M doc/src/sgml/installation.sgml
M src/pl/plpython/expected/plpython_ereport.out
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/sql/plpython_ereport.sql

Small correction to BRIN docs

commit   : 0bf41dd1908a0c05833168b9972e1c52cb7547b7    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 21 Feb 2017 09:07:15 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 21 Feb 2017 09:07:15 +0000    

Click here for diff

Replace incorrect word "index" with "heap"  
  
Takayuki Tsunakawa  

M doc/src/sgml/brin.sgml

Improve error message for misuse of TZ, tz, OF formatting patterns.

commit   : 1c073505e8e4fa8a03312fea714da25ab83cb5fa    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Feb 2017 10:27:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Feb 2017 10:27:48 -0500    

Click here for diff

Be specific about which pattern is being complained of, and avoid saying  
"it's not supported in to_date", which is just confusing if the error is  
actually coming out of to_timestamp.  We can phrase it as "is only  
supported in to_char", instead.  Also, use the term "formatting field" not  
"format pattern", because other error messages in the same file prefer that  
terminology.  (This isn't terribly consistent with the documentation, so  
maybe we should change all these error messages?)  

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

Fix documentation of to_char/to_timestamp TZ, tz, OF formatting patterns.

commit   : 10257fc5ff74487a46594bd8c8c041878f409c17    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Feb 2017 10:05:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Feb 2017 10:05:00 -0500    

Click here for diff

These are only supported in to_char, not in the other direction, but the  
documentation failed to mention that.  Also, describe TZ/tz as printing the  
time zone "abbreviation", not "name", because what they print is elsewhere  
referred to that way.  Per bug #14558.  

M doc/src/sgml/func.sgml

Make src/interfaces/libpq/test clean up after itself.

commit   : 090f21bbad98001979da8589e9647a1d49bce4ee    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 Feb 2017 17:18:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 Feb 2017 17:18:10 -0500    

Click here for diff

It failed to remove a .o file during "make clean", and it lacked  
a .gitignore file entirely.  

A src/interfaces/libpq/test/.gitignore
M src/interfaces/libpq/test/Makefile

Dept of second thoughts: rename new perl script.

commit   : 5b3a2ca850718e1fd74f26bc2886e880676b2cd6    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 Feb 2017 16:41:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 Feb 2017 16:41:51 -0500    

Click here for diff

It didn't take long at all for me to become irritated that the original  
choice of name for this script resulted in "warning" showing up in several  
places in build logs, because I tend to grep for that.  Change the script  
name to avoid that.  

M src/Makefile.global.in
R091 src/tools/fix-flex-warning.pl src/tools/fix-old-flex-code.pl
M src/tools/msvc/pgflex.pl

Adjust PL/Tcl regression test to dodge a possible bug or zone dependency.

commit   : 170511b30da40d73b54d8190711cd6066327b934    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 Feb 2017 16:14:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 Feb 2017 16:14:52 -0500    

Click here for diff

One case in the PL/Tcl tests is observed to fail on RHEL5 with a Turkish  
time zone setting.  It's not clear if this is an old Tcl bug or something  
odd about the zone data, but in any case that test is meant to see if the  
Tcl [clock] command works at all, not what its corner-case behaviors are.  
Therefore we have no need to test exactly which week a Sunday midnight is  
considered to fall into.  Probe the following Tuesday instead.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/tcl/expected/pltcl_setup.out
M src/pl/tcl/sql/pltcl_setup.sql

Suppress "unused variable" warnings with older versions of flex.

commit   : 65d508fd4decee4d5a54c1e7b93acd25d5e80556    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 Feb 2017 13:04:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 Feb 2017 13:04:30 -0500    

Click here for diff

Versions of flex before 2.5.36 might generate code that results in an  
"unused variable" warning, when using %option reentrant.  Historically  
we've worked around that by specifying -Wno-error, but that's an  
unsatisfying solution.  The official "fix" for this was just to insert a  
dummy reference to the variable, so write a small perl script that edits  
the generated C code similarly.  
  
The MSVC side of this is untested, but the buildfarm should soon reveal  
if I broke that.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in
M src/backend/parser/Makefile
M src/bin/psql/Makefile
M src/fe_utils/Makefile
A src/tools/fix-flex-warning.pl
M src/tools/msvc/pgflex.pl

Make partitions automatically inherit OIDs.

commit   : a3dc8e495b4967fe07086a700d115c89f4f0add0    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 19 Feb 2017 21:29:27 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 19 Feb 2017 21:29:27 +0530    

Click here for diff

Previously, if the parent was specified as WITH OIDS, each child  
also had to be explicitly specified as WITH OIDS.  
  
Amit Langote, per a report from Simon Riggs.  Some additional  
work on the documentation changes by me.  
  
Discussion: http://postgr.es/m/CANP8+jJBpWocfKrbJcaf3iBt9E3U=WPE_NC8YE6rye+YJ1sYnQ@mail.gmail.com  

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

Add optimizer and executor support for parallel index-only scans.

commit   : 0414b26bac09379a4cbf1fbd847d1cee2293c5e4    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 19 Feb 2017 15:53:59 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 19 Feb 2017 15:53:59 +0530    

Click here for diff

Commit 5262f7a4fc44f651241d2ff1fa688dd664a34874 added similar support  
for parallel index scans; this extends that work to index-only scans.  
As with parallel index scans, this requires support from the index AM,  
so currently parallel index-only scans will only be possible for btree  
indexes.  
  
Rafia Sabih, reviewed and tested by Rahila Syed, Tushar Ahuja,  
and Amit Kapila  
  
Discussion: http://postgr.es/m/CAOGQiiPEAs4C=TBp0XShxBvnWXuzGL2u++Hm1=qnCpd6_Mf8Fw@mail.gmail.com  

M src/backend/executor/execParallel.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/optimizer/path/indxpath.c
M src/include/executor/nodeIndexonlyscan.h
M src/include/nodes/execnodes.h
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Make dsa_allocate interface more like MemoryContextAlloc.

commit   : 16be2fd100199bdf284becfcee02c5eb20d8a11d    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 19 Feb 2017 13:59:53 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 19 Feb 2017 13:59:53 +0530    

Click here for diff

A new function dsa_allocate_extended now takes flags which indicate  
that huge allocations should be permitted, that out-of-memory  
conditions should not throw an error, and/or that the returned memory  
should be zero-filled, just like MemoryContextAllocateExtended.  
  
Commit 9acb85597f1223ac26a5b19a9345849c43d0ff54, which added  
dsa_allocate0, was broken because it failed to account for the  
possibility that dsa_allocate() might return InvalidDsaPointer.  
This fixes that problem along the way.  
  
Thomas Munro, with some comment changes by me.  
  
Discussion: http://postgr.es/m/CA+Tgmobt7CcF_uQP2UQwWmu4K9qCHehMJP9_9m1urwP8hbOeHQ@mail.gmail.com  

M src/backend/utils/mmgr/dsa.c
M src/include/utils/dsa.h

Fix help message for pg_basebackup -R

commit   : 1a16af8b35216bf8967007cabdb7f84206bd067f    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 18 Feb 2017 13:45:14 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 18 Feb 2017 13:45:14 +0100    

Click here for diff

The recovery.conf file that's generated is specifically for replication,  
and not needed (or wanted) for regular backup restore, so indicate that  
in the message.  

M src/bin/pg_basebackup/pg_basebackup.c

Optimize query for information_schema.constraint_column_usage

commit   : e3a58c8835a2cd428b8534dd8df30a7cb96c976b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Feb 2017 19:32:15 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Feb 2017 19:32:15 -0500    

Click here for diff

The way the old query was written prevented some join optimizations  
because the join conditions were hidden inside a CASE expression.  With  
a large number of constraints, the query became unreasonably slow.  The  
new query performs much better.  
  
From: Alexey Bashtanov <[email protected]>  
Reviewed-by: Ashutosh Bapat <[email protected]>  

M src/backend/catalog/information_schema.sql

doc: Fix typos

commit   : 68f3dbc5525a7e78290f7dee8a74f66d5fa738d6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Feb 2017 18:59:29 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Feb 2017 18:59:29 -0500    

Click here for diff

From: Thom Brown <[email protected]>  

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

pg_dump: Message style improvements

commit   : 363ac78aee37790a1f932ee3050bdd21085aabfe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Feb 2017 18:58:55 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Feb 2017 18:58:55 -0500    

Click here for diff

M src/bin/pg_dump/pg_dump.c

Document usage of COPT environment variable for adjusting configure flags.

commit   : a029d2cf4203f8f240bae4651e62c2358673b9f4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Feb 2017 16:11:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Feb 2017 16:11:02 -0500    

Click here for diff

Also add to the existing rather half-baked description of PROFILE,  
which does exactly the same thing, but I think people use it differently.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/installation.sgml
M src/Makefile.global.in

pg_dump: Fix typo in query

commit   : 39370e6a0ae6e92a79a50a9531b6a291cb2ee590    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Feb 2017 15:06:28 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Feb 2017 15:06:28 -0500    

Click here for diff

This could lead to incorrect dumping of language privileges in some  
cases, which is probably a rare situation.  

M src/bin/pg_dump/pg_dump.c

Remove redundant coverage target

commit   : 638d650dd7200e0eba91abb521284f239f547bbb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Feb 2017 08:56:57 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Feb 2017 08:56:57 -0500    

Click here for diff

This was probably forgotten to be removed when general recursion support  
was added.  

M src/Makefile

Fix typo on comment

commit   : e7e4cd1ab51b506f9fad9b7b107e315fdb4b8b74    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 16 Feb 2017 23:53:01 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 16 Feb 2017 23:53:01 -0500    

Click here for diff

M src/include/replication/logicalrelation.h

Add new function dsa_allocate0.

commit   : 9acb85597f1223ac26a5b19a9345849c43d0ff54    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 16 Feb 2017 12:45:53 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 16 Feb 2017 12:45:53 -0500    

Click here for diff

This does the same thing as dsa_allocate, except that the memory  
is guaranteed to be zero-filled on return.  
  
Dilip Kumar, adjusted by me.  

M src/backend/utils/mmgr/dsa.c
M src/include/utils/dsa.h

Doc: remove duplicate index entry.

commit   : 3b7673388da3598933ae6c4f9fdc7c79dee05558    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Feb 2017 11:30:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Feb 2017 11:30:07 -0500    

Click here for diff

This causes a warning with the old html-docs toolchain, though not with the  
new.  I had originally supposed that we needed both <indexterm> entries to  
get both a primary index entry and a see-also link; but evidently not,  
as pointed out by Fabien Coelho.  
  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1702161616060.5445@lancre  

M doc/src/sgml/syntax.sgml

Avoid crash in ALTER TABLE not_partitioned DETACH PARTITION.

commit   : 59407301a39f47e35098a1c211f154adcd2bdaf9    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 16 Feb 2017 08:37:37 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 16 Feb 2017 08:37:37 -0500    

Click here for diff

Amit Langote, reviewed and slightly changed by me.  

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

Formatting and docs corrections for logical decoding output plugins.

commit   : 93e6e40574bccf9c6f33c520a4189d3e98e2fd1f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Feb 2017 18:15:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Feb 2017 18:15:47 -0500    

Click here for diff

Make the typedefs for output plugins consistent with project style;  
they were previously not even consistent with each other as to layout  
or inclusion of parameter names.  Make the documentation look the same,  
and fix errors therein (missing and misdescribed parameters).  
  
Back-patch because of the documentation bugs.  

M doc/src/sgml/logicaldecoding.sgml
M src/include/replication/output_plugin.h

Doc: fix typo in logicaldecoding.sgml.

commit   : adb67d67f0f29acb175620ab05be26a146512fa2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Feb 2017 17:31:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Feb 2017 17:31:02 -0500    

Click here for diff

There's no such field as OutputPluginOptions.output_mode;  
it's actually output_type.  Noted by T. Katsumata.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/logicaldecoding.sgml

Make sure that hash join's bulk-tuple-transfer loops are interruptible.

commit   : f2ec57dee93b29e2e27235ec8cc0683d0bc7d775    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Feb 2017 16:40:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Feb 2017 16:40:05 -0500    

Click here for diff

The loops in ExecHashJoinNewBatch(), ExecHashIncreaseNumBatches(), and  
ExecHashRemoveNextSkewBucket() are all capable of iterating over many  
tuples without ever doing a CHECK_FOR_INTERRUPTS, so that the backend  
might fail to respond to SIGINT or SIGTERM for an unreasonably long time.  
Fix that.  In the case of ExecHashJoinNewBatch(), it seems useful to put  
the added CHECK_FOR_INTERRUPTS into ExecHashJoinGetSavedTuple() rather  
than directly in the loop, because that will also ensure that both  
principal code paths through ExecHashJoinOuterGetTuple() will do a  
CHECK_FOR_INTERRUPTS, which seems like a good idea to avoid surprises.  
  
Back-patch to all supported branches.  
  
Tom Lane and Thomas Munro  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c

Doc: fix syntax synopsis for INSERT ... ON CONFLICT DO UPDATE.

commit   : 2b18743614bb526e5a49a542c9c80c96668639cd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Feb 2017 15:41:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Feb 2017 15:41:09 -0500    

Click here for diff

Commit 906bfcad7 adjusted the syntax synopsis for UPDATE, but missed  
the fact that the INSERT synopsis now contains a duplicate of that.  
  
In passing, improve wording and markup about using a table alias to  
dodge the conflict with use of "excluded" as a special table name.  

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

Fix tab completion for "ALTER SYSTEM SET variable ...".

commit   : a5d4e3ff79636a647a69e93ec8b9239703e9556a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Feb 2017 15:23:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Feb 2017 15:23:19 -0500    

Click here for diff

It wouldn't complete "TO" after the variable name, which is certainly  
minor enough.  But since we do complete "TO" after "SET variable ...",  
and since this case used to work pre-9.6, I think this is a bug.  
  
Also, fix the query used to collect the variable names; whoever last  
touched it evidently didn't understand how the pieces are supposed  
to fit together.  It accidentally worked anyway, because readline  
ignores irrelevant completions, but it was randomly unlike the ones  
around it, and could be a source of actual bugs if someone copied  
it as a prototype for another query.  

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

Fix YA unwanted behavioral difference with operator_precedence_warning.

commit   : 01e0cbc4f687325b825e7953f99f0b16a2bd4e96    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Feb 2017 14:43:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Feb 2017 14:43:59 -0500    

Click here for diff

Jeff Janes noted that the error cursor position shown for some errors  
would vary when operator_precedence_warning is turned on.  We'd prefer  
that option to have no undocumented effects, so this isn't desirable.  
To fix, make sure that an AEXPR_PAREN node has the same exprLocation  
as its child node.  
  
(Note: it would be a little cheaper to use @2 here instead of an  
exprLocation call, but there are cases where that wouldn't produce  
the identical answer, so don't do it like that.)  
  
Back-patch to 9.5 where this feature was introduced.  
  
Discussion: https://postgr.es/m/CAMkU=1ykK+VhhcQ4Ky8KBo9FoaUJH3f3rDQB8TkTXi-ZsBRUkQ@mail.gmail.com  

M src/backend/parser/gram.y

Add optimizer and executor support for parallel index scans.

commit   : 5262f7a4fc44f651241d2ff1fa688dd664a34874    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 13:53:24 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 13:53:24 -0500    

Click here for diff

In combination with 569174f1be92be93f5366212cc46960d28a5c5cd, which  
taught the btree AM how to perform parallel index scans, this allows  
parallel index scan plans on btree indexes.  This infrastructure  
should be general enough to support parallel index scans for other  
index AMs as well, if someone updates them to support parallel  
scans.  
  
Amit Kapila, reviewed and tested by Anastasia Lubennikova, Tushar  
Ahuja, and Haribabu Kommi, and me.  

M contrib/bloom/blcost.c
M contrib/bloom/bloom.h
M contrib/bloom/blutils.c
M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgutils.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeIndexscan.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/planner.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/adt/selfuncs.c
M src/include/access/amapi.h
M src/include/executor/nodeIndexscan.h
M src/include/nodes/execnodes.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/utils/index_selfuncs.h
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Replace min_parallel_relation_size with two new GUCs.

commit   : 51ee6f3160d2e1515ed6197594bda67eb99dc2cc    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 13:37:24 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 13:37:24 -0500    

Click here for diff

When min_parallel_relation_size was added, the only supported type  
of parallel scan was a parallel sequential scan, but there are  
pending patches for parallel index scan, parallel index-only scan,  
and parallel bitmap heap scan.  Those patches introduce two new  
types of complications: first, what's relevant is not really the  
total size of the relation but the portion of it that we will scan;  
and second, index pages and heap pages shouldn't necessarily be  
treated in exactly the same way.  Typically, the number of index  
pages will be quite small, but that doesn't necessarily mean that  
a parallel index scan can't pay off.  
  
Therefore, we introduce min_parallel_table_scan_size, which works  
out a degree of parallelism for scans based on the number of table  
pages that will be scanned (and which is therefore equivalent to  
min_parallel_relation_size for parallel sequential scans) and also  
min_parallel_index_scan_size which can be used to work out a degree  
of parallelism based on the number of index pages that will be  
scanned.  
  
Amit Kapila and Robert Haas  
  
Discussion: http://postgr.es/m/CAA4eK1KowGSYYVpd2qPpaPPA5R90r++QwDFbrRECTE9H_HvpOg@mail.gmail.com  
Discussion: http://postgr.es/m/CAA4eK1+TnM4pXQbvn7OXqam+k_HZqb0ROZUMxOiL6DWJYCyYow@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/release-9.6.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
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Fix wrong articles in pg_proc descriptions.

commit   : 5d40286985af3ea60eda3b873ce4ee26f96505f4    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 12:13:38 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 12:13:38 -0500    

Click here for diff

This technically should involve a catversion bump, but that seems  
pedantic, so I skipped it.  
  
Report and patch by David Christensen.  

M src/include/catalog/pg_proc.h

Document new libpq connection statuses for target_session_attrs.

commit   : 1330a7d7265577412cae44653a5368172af396c7    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 11:03:41 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 11:03:41 -0500    

Click here for diff

I didn't realize these would ever be visible to clients, but Michael  
figured out that it can happen when using asynchronous interfaces  
such as PQconnectPoll.  
  
Michael Paquier  

M doc/src/sgml/libpq.sgml

libpq: Make target_session_attrs=read-write consume empty result.

commit   : 1de0a4e00eee2a72c0b5b34892092efcec681f81    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 11:03:30 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 11:03:30 -0500    

Click here for diff

Otherwise, the leftover empty result can cause problems in some  
situations.  
  
Michael Paquier and Ashutosh Bapat, per a report from Higuchi Daisuke  

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

doc: Add advice about systemd RemoveIPC

commit   : fbe7a3fa45f360e73ce141e51005a3e86cd1926c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Feb 2017 10:44:07 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Feb 2017 10:44:07 -0500    

Click here for diff

Reviewed-by: Magnus Hagander <[email protected]>  

M doc/src/sgml/runtime.sgml

pg_upgrade: Fix problems caused by renaming pg_resetxlog.

commit   : b8777611230ac94734ea99004d2a7d4266f9a954    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 10:14:16 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 10:14:16 -0500    

Click here for diff

Commit 85c11324cabaddcfaf3347df78555b30d27c5b5a renamed pg_resetxlog  
to pg_resetwal, but didn't make pg_upgrade smart enough to cope with  
the situation.  
  
Michael Paquier, per a complaint from Jeff Janes  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/exec.c

Add CREATE COLLATION IF NOT EXISTS clause

commit   : 6d16ecc646d21b39092970c591fd0f73b4cfc26b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Feb 2017 22:51:09 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Feb 2017 22:51:09 -0500    

Click here for diff

The core of the functionality was already implemented when  
pg_import_system_collations was added.  This just exposes it as an  
option in the SQL command.  

M doc/src/sgml/ref/create_collation.sgml
M src/backend/commands/collationcmds.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/collationcmds.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/collate.linux.utf8.out
M src/test/regress/sql/collate.linux.utf8.sql

Fix some nonstandard capitalization.

commit   : e403732ef66d368f0a9a154d8f756f5d28615b8a    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 07:53:38 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 07:53:38 -0500    

Click here for diff

Ashutosh Bapat  

M doc/src/sgml/ddl.sgml

btree: Support parallel index scans.

commit   : 569174f1be92be93f5366212cc46960d28a5c5cd    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 07:41:14 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Feb 2017 07:41:14 -0500    

Click here for diff

This isn't exposed to the optimizer or the executor yet; we'll add  
support for those things in a separate patch.  But this puts the  
basic mechanism in place: several processes can attach to a parallel  
btree index scan, and each one will get a subset of the tuples that  
would have been produced by a non-parallel scan.  Each index page  
becomes the responsibility of a single worker, which then returns  
all of the TIDs on that page.  
  
Rahila Syed, Amit Kapila, Robert Haas, reviewed and tested by  
Anastasia Lubennikova, Tushar Ahuja, and Haribabu Kommi.  

M doc/src/sgml/monitoring.sgml
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/postmaster/pgstat.c
M src/include/access/nbtree.h
M src/include/pgstat.h
M src/tools/pgindent/typedefs.list

Fix typo in comment.

commit   : 8569955ee39650a667b9700385e1bc19fbf47069    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Feb 2017 21:06:13 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Feb 2017 21:06:13 -0500    

Click here for diff

Higuchi Daisuke  

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

Allow parallel workers to execute subplans.

commit   : 5e6d8d2bbbcace304450b309e79366c0da4063e4    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Feb 2017 18:09:47 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Feb 2017 18:09:47 -0500    

Click here for diff

This doesn't do anything to make Param nodes anything other than  
parallel-restricted, so this only helps with uncorrelated subplans,  
and it's not necessarily very cheap because each worker will run the  
subplan separately (just as a Hash Join will build a separate copy of  
the hash table in each participating process), but it's a first step  
toward supporting cases that are more likely to help in practice, and  
is occasionally useful on its own.  
  
Amit Kapila, reviewed and tested by Rafia Sabih, Dilip Kumar, and  
me.  
  
Discussion: http://postgr.es/m/CAA4eK1+e8Z45D2n+rnDMDYsVEb5iW7jqaCH_tvPMYau=1Rru9w@mail.gmail.com  

M src/backend/executor/execParallel.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/clauses.c
M src/include/nodes/primnodes.h
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Split index xlog headers from other private index headers.

commit   : 8da9a226369e9ceec7cef1ab7a16cdc0adb4d657    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Feb 2017 15:37:59 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Feb 2017 15:37:59 -0500    

Click here for diff

The xlog-specific headers need to be included in both frontend code -  
specifically, pg_waldump - and the backend, but the remainder of the  
private headers for each index are only needed by the backend.  By  
splitting the xlog stuff out into separate headers, pg_waldump pulls  
in fewer backend headers, which is a good thing.  
  
Patch by me, reviewed by Michael Paquier and Andres Freund, per a  
complaint from Dilip Kumar.  
  
Discussion: http://postgr.es/m/CA+TgmoZ=F=GkxV0YEv-A8tb+AEGy_Qa7GSiJ8deBKFATnzfEug@mail.gmail.com  

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/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/gistbuild.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/transam/rmgr.c
M src/bin/pg_waldump/rmgrdesc.c
M src/include/access/gin.h
M src/include/access/gin_private.h
A src/include/access/ginblock.h
A src/include/access/ginxlog.h
M src/include/access/gist_private.h
A src/include/access/gistxlog.h
M src/include/access/hash_xlog.h
M src/include/access/nbtree.h
A src/include/access/nbtxlog.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
A src/include/access/spgxlog.h

Minor fixes for WAL consistency checking.

commit   : fb47544d0ca18312bf0b9e53e335217db5c41a08    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Feb 2017 12:41:01 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Feb 2017 12:41:01 -0500    

Click here for diff

Michael Paquier, reviewed and slightly revised by me.  
  
Discussion: http://postgr.es/m/CAB7nPqRzCQb=vdfHvMtP0HMLBHU6z1aGdo4GJsUP-HP8jx+Pkw@mail.gmail.com  

M src/backend/access/common/bufmask.c
M src/backend/access/heap/heapam.c
M src/backend/access/transam/xlog.c
M src/include/access/bufmask.h

Don't disallow dropping NOT NULL for a list partition key.

commit   : e28b1156122f4d48d6f6f7a7f26381ee7af65a91    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Feb 2017 12:12:34 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Feb 2017 12:12:34 -0500    

Click here for diff

Range partitioning doesn't support nulls in the partitioning columns,  
but list partitioning does.  
  
Amit Langote, per a complaint from Amul Sul  

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

Remove duplicate code in planner.c.

commit   : 8d396a0a7046438ced8d8ada6ceb7c0756e58351    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Feb 2017 11:47:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Feb 2017 11:47:12 -0500    

Click here for diff

I noticed while hacking on join UNION transforms that planner.c's  
function get_base_rel_indexes() just duplicates the functionality of  
get_relids_in_jointree().  It doesn't even have the excuse of being  
older code :-(.  Drop it and use the latter function instead.  

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

Replace reference to "xlog-method" with "wal-method" in error message.

commit   : 0dfa89ba2992b1be86ad3a5523a8d26dce31a08c    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 15 Feb 2017 01:25:48 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 15 Feb 2017 01:25:48 +0900    

Click here for diff

Commit 62e8b38 renamed "--xlog-method" option for pg_basebackup to  
"--wal-method", but forgot to update the error message mentioning that option.  

M src/bin/pg_basebackup/pg_basebackup.c

Corrections and improvements to generic parallel query documentation.

commit   : 0ede57a1a5161012f8f4a55049ef24c987d5b59c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Feb 2017 09:37:31 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Feb 2017 09:37:31 -0500    

Click here for diff

David Rowley, reviewed by Brad DeJong, Amit Kapila, and me.  
  
Discussion: http://postgr.es/m/CAKJS1f81fob-M6RJyTVv3SCasxMuQpj37ReNOJ=tprhwd7hAVg@mail.gmail.com  

M doc/src/sgml/parallel.sgml

Replace references to "xlog" with "wal" in docs.

commit   : f10637ebe02074e264b17606c00bc09da986c60d    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 14 Feb 2017 02:30:46 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 14 Feb 2017 02:30:46 +0900    

Click here for diff

Commit f82ec32ac30ae7e3ec7c84067192535b2ff8ec0e renamed the pg_xlog  
directory to pg_wal. To make things consistent, we decided to eliminate  
"xlog" from user-visible docs.  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/pgstandby.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/storage.sgml

Remove contrib/tsearch2.

commit   : 7ada2d31f47f1d378ae7d4ee2d044df1bb2b0c6a    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 13 Feb 2017 11:02:23 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 13 Feb 2017 11:02:23 -0500    

Click here for diff

This module was intended to ease migrations of applications that used  
the pre-8.3 version of text search to the in-core version introduced  
in that release.  However, since all pre-8.3 releases of the database  
have been out of support for more than 5 years at this point, we  
expect that few people are depending on it at this point.  If some  
people still need it, nothing prevents it from being maintained as a  
separate extension, outside of core.  
  
Discussion: http://postgr.es/m/CA+Tgmob5R8aDHiFRTQsSJbT1oreKg2FOSBrC=2f4tqEH3dOMAg@mail.gmail.com  

M .gitattributes
M contrib/Makefile
D contrib/tsearch2/.gitignore
D contrib/tsearch2/Makefile
D contrib/tsearch2/data/test_tsearch.data
D contrib/tsearch2/expected/tsearch2.out
D contrib/tsearch2/sql/tsearch2.sql
D contrib/tsearch2/tsearch2–1.0.sql
D contrib/tsearch2/tsearch2–unpackaged–1.0.sql
D contrib/tsearch2/tsearch2.c
D contrib/tsearch2/tsearch2.control
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/textsearch.sgml
D doc/src/sgml/tsearch2.sgml
M src/test/modules/test_parser/test_parser.c
M src/tools/msvc/Mkvcbuild.pm

doc: Remove accidental extra table cell

commit   : ae0e550ce1703621efb3b75f4558df253cef5bca    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 12 Feb 2017 20:22:06 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 12 Feb 2017 20:22:06 -0500    

Click here for diff

M doc/src/sgml/catalogs.sgml

Ignore tablespace ACLs when ignoring schema ACLs.

commit   : f30f34e5897b64e0fb6616154c11dc9765866046    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 12 Feb 2017 16:03:41 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 12 Feb 2017 16:03:41 -0500    

Click here for diff

The ALTER TABLE ALTER TYPE implementation can issue DROP INDEX and  
CREATE INDEX to refit existing indexes for the new column type.  Since  
this CREATE INDEX is an implementation detail of an index alteration,  
the ensuing DefineIndex() should skip ACL checks specific to index  
creation.  It already skips the namespace ACL check.  Make it skip the  
tablespace ACL check, too.  Back-patch to 9.2 (all supported versions).  
  
Reviewed by Tom Lane.  

M src/backend/commands/indexcmds.c
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source

Add CREATE SEQUENCE AS <data type> clause

commit   : 2ea5b06c7a7056dca0af1610aadebe608fbcca08    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 10 Feb 2017 15:12:32 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 10 Feb 2017 15:12:32 -0500    

Click here for diff

This stores a data type, required to be an integer type, with the  
sequence.  The sequences min and max values default to the range  
supported by the type, and they cannot be set to values exceeding that  
range.  The internal implementation of the sequence is not affected.  
  
Change the serial types to create sequences of the appropriate type.  
This makes sure that the min and max values of the sequence for a serial  
column match the range of values supported by the table column.  So the  
sequence can no longer overflow the table column.  
  
This also makes monitoring for sequence exhaustion/wraparound easier,  
which currently requires various contortions to cross-reference the  
sequences with the table columns they are used with.  
  
This commit also effectively reverts the pg_sequence column reordering  
in f3b421da5f4addc95812b9db05a24972b8fd9739, because the new seqtypid  
column allows us to fill the hole in the struct and create a more  
natural overall column ordering.  
  
Reviewed-by: Steve Singer <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/ref/alter_sequence.sgml
M doc/src/sgml/ref/create_sequence.sgml
M src/backend/catalog/information_schema.sql
M src/backend/catalog/system_views.sql
M src/backend/commands/sequence.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_sequence.h
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/regress/expected/rules.out
M src/test/regress/expected/sequence.out
M src/test/regress/sql/sequence.sql

Update ddl.sgml for declarative partitioning syntax

commit   : 9401883a7a598f1f1664c74835821f697932666f    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 10 Feb 2017 10:03:28 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 10 Feb 2017 10:03:28 +0000    

Click here for diff

Add a section titled "Partitioned Tables" to describe what are  
partitioned tables, partition, their similarities with inheritance.  
The existing section on inheritance is retained for clarity.  
  
Then add examples to the partitioning chapter that show syntax for  
partitioned tables.  In fact they implement the same partitioning  
scheme that is currently shown using inheritance.  
  
Amit Langote, with additional details and explanatory text by me  

M doc/src/sgml/ddl.sgml

Add keywords for partitioning

commit   : 61c9a9dac44c0f0c24342a4fa4f750756ac72f2f    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 10 Feb 2017 09:07:18 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 10 Feb 2017 09:07:18 +0000    

Click here for diff

Amit Langote  

M doc/src/sgml/keywords.sgml

Improve CREATE TABLE documentation of partitioning

commit   : c1369fe2ea79724e56ee55e4c87778afd6016942    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 10 Feb 2017 08:59:37 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 10 Feb 2017 08:59:37 +0000    

Click here for diff

Amit Langote, with corrections by me  

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

Rename command line options for ongoing xlog -> wal conversion.

commit   : 62e8b387514ce965c8b3d67c81990e0ecf8c9b83    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Feb 2017 16:42:51 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Feb 2017 16:42:51 -0500    

Click here for diff

initdb and pg_basebackup now have a --waldir option rather --xlogdir,  
and pg_basebackup now has --wal-method rather than --xlog-method.  

M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Rename dtrace probes for ongoing xlog -> wal conversion.

commit   : 3f01fd4ca0b4c81333b1f0dadb09c73aa589ab6e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Feb 2017 16:40:19 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Feb 2017 16:40:19 -0500    

Click here for diff

xlog-switch becomes wal-switch, and xlog-insert becomes wal-insert.  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/utils/probes.d

Rename user-facing tools with "xlog" in the name to say "wal".

commit   : 85c11324cabaddcfaf3347df78555b30d27c5b5a    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Feb 2017 16:23:46 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Feb 2017 16:23:46 -0500    

Click here for diff

This means pg_receivexlog because pg_receivewal, pg_resetxlog  
becomes pg_resetwal, and pg_xlogdump becomes pg_waldump.  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/allfiles.sgml
R089 doc/src/sgml/ref/pg_receivexlog.sgml doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
R089 doc/src/sgml/ref/pg_resetxlog.sgml doc/src/sgml/ref/pg_resetwal.sgml
R091 doc/src/sgml/ref/pg_xlogdump.sgml doc/src/sgml/ref/pg_waldump.sgml
M doc/src/sgml/reference.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
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/walsender.c
M src/backend/utils/misc/guc.c
M src/bin/Makefile
M src/bin/pg_basebackup/.gitignore
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/nls.mk
R099 src/bin/pg_basebackup/pg_receivexlog.c src/bin/pg_basebackup/pg_receivewal.c
A src/bin/pg_basebackup/t/020_pg_receivewal.pl
D src/bin/pg_basebackup/t/020_pg_receivexlog.pl
M src/bin/pg_basebackup/walmethods.h
A src/bin/pg_resetwal/.gitignore
R055 src/bin/pg_resetxlog/Makefile src/bin/pg_resetwal/Makefile
A src/bin/pg_resetwal/nls.mk
R099 src/bin/pg_resetxlog/pg_resetxlog.c src/bin/pg_resetwal/pg_resetwal.c
R100 src/bin/pg_resetxlog/po/cs.po src/bin/pg_resetwal/po/cs.po
R100 src/bin/pg_resetxlog/po/de.po src/bin/pg_resetwal/po/de.po
R100 src/bin/pg_resetxlog/po/es.po src/bin/pg_resetwal/po/es.po
R100 src/bin/pg_resetxlog/po/fr.po src/bin/pg_resetwal/po/fr.po
R100 src/bin/pg_resetxlog/po/it.po src/bin/pg_resetwal/po/it.po
R100 src/bin/pg_resetxlog/po/ja.po src/bin/pg_resetwal/po/ja.po
R100 src/bin/pg_resetxlog/po/ko.po src/bin/pg_resetwal/po/ko.po
R100 src/bin/pg_resetxlog/po/pl.po src/bin/pg_resetwal/po/pl.po
R100 src/bin/pg_resetxlog/po/pt_BR.po src/bin/pg_resetwal/po/pt_BR.po
R100 src/bin/pg_resetxlog/po/ru.po src/bin/pg_resetwal/po/ru.po
R100 src/bin/pg_resetxlog/po/sv.po src/bin/pg_resetwal/po/sv.po
R100 src/bin/pg_resetxlog/po/zh_CN.po src/bin/pg_resetwal/po/zh_CN.po
D src/bin/pg_resetxlog/.gitignore
D src/bin/pg_resetxlog/nls.mk
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/pg_upgrade.c
R085 src/bin/pg_xlogdump/.gitignore src/bin/pg_waldump/.gitignore
R062 src/bin/pg_xlogdump/Makefile src/bin/pg_waldump/Makefile
R098 src/bin/pg_xlogdump/compat.c src/bin/pg_waldump/compat.c
A src/bin/pg_waldump/nls.mk
R099 src/bin/pg_xlogdump/pg_xlogdump.c src/bin/pg_waldump/pg_waldump.c
R092 src/bin/pg_xlogdump/rmgrdesc.c src/bin/pg_waldump/rmgrdesc.c
R081 src/bin/pg_xlogdump/rmgrdesc.h src/bin/pg_waldump/rmgrdesc.h
D src/bin/pg_xlogdump/nls.mk
M src/include/access/xlog_internal.h
M src/include/storage/bufmgr.h
M src/tools/msvc/Install.pm
M src/tools/msvc/Mkvcbuild.pm

Blind try to fix portability issue in commit 8f93bd851 et al.

commit   : 5d2adf0f81a2e4ca4f101b19b1efea147b462301    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Feb 2017 15:49:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Feb 2017 15:49:57 -0500    

Click here for diff

The S/390 members of the buildfarm are showing failures indicating  
that they're having trouble with the rint() calls I added yesterday.  
There's no good reason for that, and I wonder if it is a compiler bug  
similar to the one we worked around in d9476b838.  Try to fix it using  
the same method as before, namely to store the result of rint() back  
into a "double" variable rather than immediately converting to int64.  
(This isn't entirely waving a dead chicken, since on machines with  
wider-than-double float registers, the extra store forces a width  
conversion.  I don't know if S/390 is like that, but it seems worth  
trying.)  
  
In passing, merge duplicate ereport() calls in float8_timestamptz().  
  
Per buildfarm.  

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

Remove all references to "xlog" from SQL-callable functions in pg_proc.

commit   : 806091c96f9b81f7631e4e37a05af377b473b5da    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Feb 2017 15:10:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Feb 2017 15:10:09 -0500    

Click here for diff

Commit f82ec32ac30ae7e3ec7c84067192535b2ff8ec0e renamed the pg_xlog  
directory to pg_wal.  To make things consistent, and because "xlog" is  
terrible terminology for either "transaction log" or "write-ahead log"  
rename all SQL-callable functions that contain "xlog" in the name to  
instead contain "wal".  (Note that this may pose an upgrade hazard for  
some users.)  
  
Similarly, rename the xlog_position argument of the functions that  
create slots to be called wal_position.  
  
Discussion: https://www.postgresql.org/message-id/CA+Tgmob=YmA=H3DbW1YuOXnFVgBheRmyDkWcD9M8f=5bGWYEoQ@mail.gmail.com  

M contrib/bloom/t/001_wal.pl
M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M doc/src/sgml/backup.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/recovery-config.sgml
M src/backend/access/transam/recovery.conf.sample
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/system_views.sql
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/libpq_fetch.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
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/002_archiving.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/008_fsm_truncation.pl
M src/test/regress/expected/hs_standby_functions.out
M src/test/regress/sql/hs_primary_extremes.sql
M src/test/regress/sql/hs_primary_setup.sql
M src/test/regress/sql/hs_standby_functions.sql
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl

simplehash: Additional tweaks to make specifying an allocator work.

commit   : 72257f95781af97108fa9a9e7224ec81a90e7693    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Feb 2017 14:59:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Feb 2017 14:59:57 -0500    

Click here for diff

Even if we don't emit definitions for SH_ALLOCATE and SH_FREE, we  
still need prototypes.  The user can't define them before including  
simplehash.h because SH_TYPE isn't available yet.  
  
For the allocator to be able to access private_data, it needs to  
become an argument to SH_CREATE.  Previously we relied on callers  
to set that after returning from SH_CREATE, but SH_CREATE calls  
SH_ALLOCATE before returning.  
  
Dilip Kumar, reviewed by me.  

M src/backend/executor/execGrouping.c
M src/backend/nodes/tidbitmap.c
M src/include/lib/simplehash.h

Fix race condition in ConditionVariablePrepareToSleep.

commit   : 3f3d60d3bbd10f6cc118d24aadc60e96b9854576    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Feb 2017 14:42:32 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Feb 2017 14:42:32 -0500    

Click here for diff

Thomas Munro  

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

pageinspect: Fix hash_bitmap_info not to read the underlying page.

commit   : fc8219dc54c95ea673560b786aa8123ce6ec5977    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Feb 2017 14:02:58 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Feb 2017 14:02:58 -0500    

Click here for diff

It did that to verify that the page was an overflow page rather than  
anything else, but that means that checking the status of all the  
overflow bits requires reading the entire index.  So don't do that.  
The new code validates that the page is not a primary bucket page  
or bitmap page by looking at the metapage, so that using this on  
large numbers of pages can be reasonably efficient.  
  
Ashutosh Sharma, per a complaint from me, and with further  
modifications by me.  

M contrib/pageinspect/expected/hash.out
M contrib/pageinspect/hashfuncs.c
M src/backend/access/hash/hashovfl.c

Allow index AMs to cache data across aminsert calls within a SQL command.

commit   : 86d911ec0f9d4643e9a47db42510959dec0ed76b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Feb 2017 11:52:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Feb 2017 11:52:12 -0500    

Click here for diff

It's always been possible for index AMs to cache data across successive  
amgettuple calls within a single SQL command: the IndexScanDesc.opaque  
field is meant for precisely that.  However, no comparable facility  
exists for amortizing setup work across successive aminsert calls.  
This patch adds such a feature and teaches GIN, GIST, and BRIN to use it  
to amortize catalog lookups they'd previously been doing on every call.  
(The other standard index AMs keep everything they need in the relcache,  
so there's little to improve there.)  
  
For GIN, the overall improvement in a statement that inserts many rows  
can be as much as 10%, though it seems a bit less for the other two.  
In addition, this makes a really significant difference in runtime  
for CLOBBER_CACHE_ALWAYS tests, since in those builds the repeated  
catalog lookups are vastly more expensive.  
  
The reason this has been hard up to now is that the aminsert function is  
not passed any useful place to cache per-statement data.  What I chose to  
do is to add suitable fields to struct IndexInfo and pass that to aminsert.  
That's not widening the index AM API very much because IndexInfo is already  
within the ken of ambuild; in fact, by passing the same info to aminsert  
as to ambuild, this is really removing an inconsistency in the AM API.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spginsert.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/toasting.c
M src/backend/commands/constraint.c
M src/backend/commands/indexcmds.c
M src/backend/executor/execIndexing.c
M src/include/access/amapi.h
M src/include/access/brin_internal.h
M src/include/access/genam.h
M src/include/access/gin_private.h
M src/include/access/gist_private.h
M src/include/access/hash.h
M src/include/access/nbtree.h
M src/include/access/spgist.h
M src/include/nodes/execnodes.h

Add explicit ORDER BY to a few tests that exercise hash-join code.

commit   : 7c5d8c16e12e56c1043ff4a28e07a306a15c2b85    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 8 Feb 2017 16:58:21 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 8 Feb 2017 16:58:21 -0800    

Click here for diff

A proposed patch, also by Thomas and in the same thread, would change  
the output order of these.  Independent of the follow-up patches  
getting committed, nailing down the order in these specific tests at  
worst seems harmless.  
  
Author: Thomas Munro  
Discussion: https://postgr.es/m/CAEepm=1D4-tP7j7UAgT_j4ZX2j4Ehe1qgZQWFKBMb8F76UW5Rg@mail.gmail.com  

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

Fix roundoff problems in float8_timestamptz() and make_interval().

commit   : 8f93bd8512466c9b6c4dbc1e5efd0f72b8e2be9a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Feb 2017 18:04:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Feb 2017 18:04:59 -0500    

Click here for diff

When converting a float value to integer microseconds, we should be careful  
to round the value to the nearest integer, typically with rint(); simply  
assigning to an int64 variable will truncate, causing apparently off-by-one  
values in cases that should work.  Most places in the datetime code got  
this right, but not these two.  
  
float8_timestamptz() is new as of commit e511d878f (9.6).  Previous  
versions effectively depended on interval_mul() to do roundoff correctly,  
which it does, so this fixes an accuracy regression in 9.6.  
  
The problem in make_interval() dates to its introduction in 9.4.  Aside  
from being careful to round not truncate, let's incorporate the hours and  
minutes inputs into the result with exact integer arithmetic, rather than  
risk introducing roundoff error where there need not have been any.  
  
float8_timestamptz() problem reported by Erik Nordstrƶm, though this is  
not his proposed patch.  make_interval() problem found by me.  
  
Discussion: https://postgr.es/m/CAHuQZDS76jTYk3LydPbKpNfw9KbACmD=49dC4BrzHcfPv6yA1A@mail.gmail.com  

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

Add WAL consistency checking facility.

commit   : a507b86900f695aacc8d52b7d2cfcb65f58862a2    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 8 Feb 2017 15:45:30 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 8 Feb 2017 15:45:30 -0500    

Click here for diff

When the new GUC wal_consistency_checking is set to a non-empty value,  
it triggers recording of additional full-page images, which are  
compared on the standby against the results of applying the WAL record  
(without regard to those full-page images).  Allowable differences  
such as hints are masked out, and the resulting pages are compared;  
any difference results in a FATAL error on the standby.  
  
Kuntal Ghosh, based on earlier patches by Michael Paquier and Heikki  
Linnakangas.  Extensively reviewed and revised by Michael Paquier and  
by me, with additional reviews and comments from Amit Kapila, Ɓlvaro  
Herrera, Simon Riggs, and Peter Eisentraut.  

M doc/src/sgml/config.sgml
M src/backend/access/brin/brin_xlog.c
M src/backend/access/common/Makefile
A src/backend/access/common/bufmask.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/rmgr.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/commands/sequence.c
M src/backend/utils/misc/guc.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_xlogdump/pg_xlogdump.c
M src/bin/pg_xlogdump/rmgrdesc.c
M src/include/access/brin_xlog.h
A src/include/access/bufmask.h
M src/include/access/generic_xlog.h
M src/include/access/gin.h
M src/include/access/gist_private.h
M src/include/access/heapam_xlog.h
M src/include/access/nbtree.h
M src/include/access/rmgr.h
M src/include/access/rmgrlist.h
M src/include/access/spgist.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/commands/sequence.h

Fix relcache leaks in get_object_address_publication_rel()

commit   : 115cb31597fac8a17202d1e41da8baf33fcb60cf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Feb 2017 22:09:53 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Feb 2017 22:09:53 -0500    

Click here for diff

M src/backend/catalog/objectaddress.c

doc: Some improvements in CREATE SUBSCRIPTION ref page

commit   : e35bbea7ddd89c7f51988fcf03c87150938ea2e3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Feb 2017 21:26:50 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Feb 2017 21:26:50 -0500    

Click here for diff

Add link to description of libpq connection strings.  Add link to  
explanation of replication access control.  This currently points to the  
description of streaming replication access control, which is currently  
the same as for logical replication, but that might be refined later.  
Also remove plain-text passwords from the examples, to not encourage  
that dubious practice.  
  
based on suggestions from Simon Riggs  

M doc/src/sgml/ref/create_subscription.sgml

Revise the way the element allocator for a simplehash is specified.

commit   : c3c4f6e1740be256178cd7551d5b8a7677159b74    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Feb 2017 17:01:40 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Feb 2017 17:01:40 -0500    

Click here for diff

This method is more elegant and more efficient.  
  
Per a suggestion from Andres Freund, who also briefly reviewed  
the patch.  

M src/backend/executor/execGrouping.c
M src/backend/nodes/tidbitmap.c
M src/include/lib/simplehash.h

Speed up "brin" regression test a little bit.

commit   : 242066cc8e587ccbe5e1cf38c4f085f080dcd5e0    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Feb 2017 16:34:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Feb 2017 16:34:11 -0500    

Click here for diff

In the large DO block, collect row TIDs into array variables instead of  
creating and dropping a pile of temporary tables.  In a normal build,  
this reduces the brin test script's runtime from about 1.1 sec to 0.4 sec  
on my workstation.  That's not all that exciting perhaps, but in a  
CLOBBER_CACHE_ALWAYS test build, the runtime drops from 20 min to 17 min,  
which is a little more useful.  In combination with some other changes  
I plan to propose, this will help provide a noticeable reduction in  
cycle time for CLOBBER_CACHE_ALWAYS buildfarm critters.  

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

Avoid redefining simplehash_allocate/simplehash_free.

commit   : ac8eb972f268c787bfe7579b1747c3866fced5a9    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Feb 2017 16:20:05 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Feb 2017 16:20:05 -0500    

Click here for diff

There's no generic guard against multiple inclusion in this file,  
for good reason.  But these typedefs need one, as per a report  
from Jeff Janes.  

M src/include/lib/simplehash.h

Allow the element allocator for a simplehash to be specified.

commit   : 565903af474e85cef28ff712d773f13b6701ded5    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Feb 2017 15:58:30 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Feb 2017 15:58:30 -0500    

Click here for diff

This is infrastructure for a pending patch to allow parallel bitmap  
heap scans.  
  
Dilip Kumar, reviewed (in earlier versions) by Andres Freund and  
(more recently) by me.  Some further renaming by me, also.  

M src/backend/executor/execGrouping.c
M src/backend/nodes/tidbitmap.c
M src/include/lib/simplehash.h

Fix compiler warning.

commit   : 94708c0e8c32ad1c9c6ffbdb894fe158eda596e7    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Feb 2017 15:09:14 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Feb 2017 15:09:14 -0500    

Click here for diff

Mithun Cy, per a report by Erik Rijkers  

M src/backend/access/hash/hashpage.c

Cache hash index's metapage in rel->rd_amcache.

commit   : 293e24e507838733aba4748b514536af2d39d7f2    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Feb 2017 12:24:25 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Feb 2017 12:24:25 -0500    

Click here for diff

This avoids a very significant amount of buffer manager traffic and  
contention when scanning hash indexes, because it's no longer  
necessary to lock and pin the metapage for every scan.  We do need  
some way of figuring out when the cache is too stale to use any more,  
so that when we lock the primary bucket page to which the cached  
metapage points us, we can tell whether a split has occurred since we  
cached the metapage data.  To do that, we use the hash_prevblkno field  
in the primary bucket page, which would otherwise always be set to  
InvalidBuffer.  
  
This patch contains code so that it will continue working (although  
less efficiently) with hash indexes built before this change, but  
perhaps we should consider bumping the hash version and ripping out  
the compatibility code.  That decision can be made later, though.  
  
Mithun Cy, reviewed by Jesper Pedersen, Amit Kapila, and by me.  
Before committing, I made a number of cosmetic changes to the last  
posted version of the patch, adjusted _hash_getcachedmetap to be more  
careful about order of operation, and made some necessary updates to  
the pageinspect documentation and regression tests.  

M contrib/pageinspect/expected/hash.out
M doc/src/sgml/pageinspect.sgml
M src/backend/access/hash/README
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/include/access/hash.h

Correct thinko in last-minute release note item.

commit   : 39c3ca5161911cebafbcce160ef89e5a4faaf569    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Feb 2017 10:24:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Feb 2017 10:24:24 -0500    

Click here for diff

The CREATE INDEX CONCURRENTLY bug can only be triggered by row updates,  
not inserts, since the problem would arise from an update incorrectly  
being made HOT.  Noted by Alvaro.  

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

Release notes for 9.6.2, 9.5.6, 9.4.11, 9.3.16, 9.2.20.

commit   : 64ee636a5b4dc5796a582bf061d94ca2809f5ef3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Feb 2017 15:30:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Feb 2017 15:30:16 -0500    

Click here for diff

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

doc: Document sequence function privileges better

commit   : 696af9ab0a92642978169c227e187a65c2f35f17    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2017 15:21:20 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2017 15:21:20 -0500    

Click here for diff

Document the privileges required for each of the sequence functions.  
This was already in the GRANT reference page, but also add it to the  
function description for easier reference.  

M doc/src/sgml/func.sgml

Avoid permission failure in pg_sequences.last_value

commit   : ab82340a43bebe57a3db0e52bb74120b3bb53ae5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2017 15:17:27 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2017 15:17:27 -0500    

Click here for diff

Before, reading pg_sequences.last_value would fail unless the user had  
appropriate sequence permissions, which would make the pg_sequences view  
cumbersome to use.  Instead, return null instead of the real value when  
there are no permissions.  
  
From: Michael Paquier <[email protected]>  
Reported-by: Shinoda, Noriyoshi <[email protected]>  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/system_views.sql
M src/test/regress/expected/rules.out

Release note updates.

commit   : ad6af3fc4256c0e1eecf5d93d510da4b44e0d480    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Feb 2017 14:19:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Feb 2017 14:19:23 -0500    

Click here for diff

Add item for last-minute CREATE INDEX CONCURRENTLY fix.  
Repair a couple of misspellings of patch authors' names.  
  
Back-branch updates will follow shortly, but I thought I'd  
commit this separately just to make it more visible.  

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

Avoid returning stale attribute bitmaps in RelationGetIndexAttrBitmap().

commit   : 2aaec65464dad497536199dea13612b9232eaa3e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Feb 2017 13:19:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Feb 2017 13:19:50 -0500    

Click here for diff

The problem with the original coding here is that we might receive (and  
clear) a relcache invalidation signal for the target relation down inside  
one of the index_open calls we're doing.  Since the target is open, we  
would not drop the relcache entry, just reset its rd_indexvalid and  
rd_indexlist fields.  But RelationGetIndexAttrBitmap() kept going, and  
would eventually cache and return potentially-obsolete attribute bitmaps.  
  
The case where this matters is where the inval signal was from a CREATE  
INDEX CONCURRENTLY telling us about a new index on a formerly-unindexed  
column.  (In all other cases, the lock we hold on the target rel should  
prevent any concurrent change in index state.)  Even just returning the  
stale attribute bitmap is not such a problem, because it shouldn't matter  
during the transaction in which we receive the signal.  What hurts is  
caching the stale data, because it can survive into later transactions,  
breaking CREATE INDEX CONCURRENTLY's expectation that later transactions  
will not create new broken HOT chains.  The upshot is that there's a window  
for building corrupted indexes during CREATE INDEX CONCURRENTLY.  
  
This patch fixes the problem by rechecking that the set of index OIDs  
is still the same at the end of RelationGetIndexAttrBitmap() as it was  
at the start.  If not, we loop back and try again.  That's a little  
more than is strictly necessary to fix the bug --- in principle, we  
could return the stale data but not cache it --- but it seems like a  
bad idea on general principles for relcache to return data it knows  
is stale.  
  
There might be more hazards of the same ilk, or there might be a better  
way to fix this one, but this patch definitely improves matters and seems  
unlikely to make anything worse.  So let's push it into today's releases  
even as we continue to study the problem.  
  
Pavan Deolasee and myself  
  
Discussion: https://postgr.es/m/CABOikdM2MUq9cyZJi1KyLmmkCereyGp5JQ4fuwKoyKEde_mzkQ@mail.gmail.com  

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

doc: Update CREATE DATABASE examples

commit   : 549f74733f45804cd3180de853e5d0610eecc22f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 2 Feb 2017 14:57:46 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 2 Feb 2017 14:57:46 -0500    

Click here for diff

The example of using CREATE DATABASE with the ENCODING option did not  
work anymore (except in special circumstances) and did not represent a  
good general-purpose example, so write some new examples.  
  
Reported-by: [email protected]  

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

Update comment in relcache.c.

commit   : a59318346ef476d3e66c4d13e92cf4ad6ce328ac    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Feb 2017 11:31:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Feb 2017 11:31:23 -0500    

Click here for diff

Commit 665d1fad9 introduced rd_pkindex, and made RelationGetIndexList  
responsible for updating it, but didn't bother to fix  
RelationGetIndexList's header comment to say so.  

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

Add missing newline to error messages

commit   : afcb0c97efc58459bcbbe795f42d8b7be414e076    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2017 09:47:39 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2017 09:47:39 -0500    

Click here for diff

Also improve the message style a bit while we're here.  

M src/bin/pg_dump/pg_dump.c

Fix typo also in expected output.

commit   : d93b7535a68b03cb8126b930af796af469fdd109    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 6 Feb 2017 12:04:04 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 6 Feb 2017 12:04:04 +0200    

Click here for diff

Commit 181bdb90ba fixed the typo in the .sql file, but forgot to update the  
expected output.  

M contrib/sepgsql/expected/label.out

Fix typo in variable name.

commit   : d02d985349cad066330786bd38e186a569415751    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 6 Feb 2017 11:45:08 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 6 Feb 2017 11:45:08 +0200    

Click here for diff

Masahiko Sawada  

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

Fix typos in comments.

commit   : 181bdb90ba1f2361aec5a621c8f1e01736f8cad2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 6 Feb 2017 11:33:58 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 6 Feb 2017 11:33:58 +0200    

Click here for diff

Backpatch to all supported versions, where applicable, to make backpatching  
of future fixes go more smoothly.  
  
Josh Soref  
  
Discussion: https://www.postgresql.org/message-id/CACZqfqCf+5qRztLPgmmosr-B0Ye4srWzzw_mo4c_8_B_mtjmJQ@mail.gmail.com  

M configure
M configure.in
M contrib/bloom/blvacuum.c
M contrib/cube/expected/cube.out
M contrib/cube/expected/cube_2.out
M contrib/cube/sql/cube.sql
M contrib/earthdistance/earthdistance–1.1.sql
M contrib/isn/ISSN.h
M contrib/isn/isn.c
M contrib/ltree/expected/ltree.out
M contrib/ltree/ltxtquery_io.c
M contrib/ltree/sql/ltree.sql
M contrib/pg_standby/pg_standby.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_op.c
M contrib/pgcrypto/mbuf.c
M contrib/pgcrypto/pgp-mpi-internal.c
M contrib/pgcrypto/pgp-mpi-openssl.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M contrib/seg/seg.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sql/label.sql
M contrib/spi/refint.c
M contrib/start-scripts/osx/PostgreSQL
M contrib/tsearch2/tsearch2–1.0.sql
M contrib/xml2/xpath.c
M src/Makefile.shlib
M src/backend/access/gist/README
M src/backend/access/hash/hashpage.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/xact.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/amcmds.c
M src/backend/commands/dbcommands.c
M src/backend/commands/explain.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/libpq/hba.c
M src/backend/optimizer/geqo/geqo_erx.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/storage/ipc/latch.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/predicate.c
M src/backend/storage/smgr/md.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/Makefile
M src/backend/utils/mmgr/freepage.c
M src/backend/utils/time/tqual.c
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/common.c
M src/bin/psql/describe.c
M src/include/access/visibilitymap.h
M src/include/access/xact.h
M src/include/c.h
M src/include/catalog/partition.h
M src/include/catalog/pg_subscription.h
M src/include/lib/simplehash.h
M src/include/storage/s_lock.h
M src/include/tsearch/dicts/spell.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/ecpg/pgtypeslib/numeric.c
M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/win32.c
M src/pl/plperl/ppport.h
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_typeio.h
M src/test/isolation/specs/receipt-report.spec
M src/test/isolation/specs/two-ids.spec
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/indirect_toast.out
M src/test/regress/expected/init_privs.out
M src/test/regress/expected/insert_conflict.out
M src/test/regress/expected/join.out
M src/test/regress/expected/matview.out
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/expected/rolenames.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/tsdicts.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/indirect_toast.sql
M src/test/regress/sql/init_privs.sql
M src/test/regress/sql/insert_conflict.sql
M src/test/regress/sql/join.sql
M src/test/regress/sql/matview.sql
M src/test/regress/sql/plpgsql.sql
M src/test/regress/sql/replica_identity.sql
M src/test/regress/sql/rolenames.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/tsdicts.sql
M src/test/ssl/ServerSetup.pm

First-draft release notes for 9.6.2.

commit   : 9863017b87f3592ff663d03fc663a4f1f8fdb8b2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Feb 2017 12:51:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Feb 2017 12:51:25 -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.6.sgml

Remove redundant comment.

commit   : 6f4b4ceefa673dff6563d2d17e2039248f16fe1d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Feb 2017 19:05:49 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Feb 2017 19:05:49 -0500    

Click here for diff

Rafia Sabih  

M src/backend/executor/execMain.c

Improve grammar of message about two-phase state files.

commit   : 38c363adf497c0a05858dc00bc49ea42023bd572    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Feb 2017 17:13:33 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Feb 2017 17:13:33 -0500    

Click here for diff

When there's only one two-phase state file, there's also only one  
long-running prepared transaction.  Adjust the message text  
accordingly.  
  
Nikhil Sontakke  
  
Discussion: http://postgr.es/m/CAMGcDxcmR_DWZXXndGoPzVQx=B17A5=RviEA1qNaF=FWLy5Whw@mail.gmail.com  

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

pageinspect: More type-sanity surgery on the new hash index code.

commit   : 871ec0e33673ad9719760131b71a02ecbda82e12    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Feb 2017 16:28:13 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Feb 2017 16:28:13 -0500    

Click here for diff

Uniformly expose unsigned quantities using the next-wider signed  
integer type (since we have no unsigned types at the SQL level).  
At the SQL level, this results a change to report itemoffset as  
int4 rather than int2.  Also at the SQL level, report one value  
that is an OID as type oid.  Under the hood, uniformly use macros  
that match the SQL output type as to both width and signedness.  

M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/pageinspect–1.5–1.6.sql

pgstattuple: Add pgstathashindex.

commit   : e759854a09d49725a9519c48a0d71a32bab05a01    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Feb 2017 14:35:25 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Feb 2017 14:35:25 -0500    

Click here for diff

Since pgstattuple v1.5 hasn't been released yet, no need for a new  
extension version.  The new function exposes statistics about hash  
indexes similar to what other pgstatindex functions return for other  
index types.  
  
Ashutosh Sharma, reviewed by Kuntal Ghosh.  Substantial further  
revisions by me.  

M contrib/pgstattuple/expected/pgstattuple.out
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/pgstattuple–1.4–1.5.sql
M contrib/pgstattuple/sql/pgstattuple.sql
M doc/src/sgml/pgstattuple.sgml

Be sure to release LogicalRepLauncherLock in DROP SUBSCRIPTION command.

commit   : 39b8cc991fe31ee8df8b0fee467bbd9800fcc1c5    
  
author   : Fujii Masao <[email protected]>    
date     : Sat, 4 Feb 2017 03:18:13 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sat, 4 Feb 2017 03:18:13 +0900    

Click here for diff

Previously DROP SUBSCRIPTION command forgot to release the lock at all.  
  
Original patches by Kyotaro Horiguchi and Michael Paquier,  
but I didn't use them.  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/commands/subscriptioncmds.c

In pageinspect/hashfuncs.c, avoid crashes on alignment-picky machines.

commit   : 14e9b18fed289e483ed28daec60fdab95da9cc48    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Feb 2017 11:34:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Feb 2017 11:34:41 -0500    

Click here for diff

On machines with MAXALIGN = 8, the payload of a bytea is not maxaligned,  
since it will start 4 bytes into a palloc'd value.  On alignment-picky  
hardware, this will cause failures in accesses to 8-byte-wide values  
within the page.  We already encountered this problem when we introduced  
GIN index inspection functions, and fixed it in commit 84ad68d64.  Make  
use of the same function for hash indexes.  
  
A small difficulty is that up to now contrib/pageinspect has not shared  
any functions at all across files.  To support that, introduce a common  
header file "pageinspect.h" for the module.  
  
Also, move get_page_from_raw() out of ginfuncs.c, where it didn't  
especially belong, and put it in rawpage.c which seems a more natural home.  
  
Per buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
A contrib/pageinspect/pageinspect.h
M contrib/pageinspect/rawpage.c

pageinspect: Remove platform-dependent values from hash tests.

commit   : 29e312bc1301061ae9f897ff39f3b230c421a5fb    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Feb 2017 11:06:41 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Feb 2017 11:06:41 -0500    

Click here for diff

Per a report from Tom Lane, the ffactor reported by hash_metapage_info  
and the free_size reported by hash_page_stats vary by platform.  
  
Ashutosh Sharma and Robert Haas  

M contrib/pageinspect/expected/hash.out
M contrib/pageinspect/sql/hash.sql

Fix a bunch more portability bugs in commit 08bf6e529.

commit   : c6eeb67dcc3b3f7aa94335e18a1075863d808a7c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Feb 2017 23:11:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Feb 2017 23:11:08 -0500    

Click here for diff

It seems like somebody used a dartboard while choosing integer widths  
for the various values taken and returned by these functions ... and  
then threw a fresh set of darts while writing the SQL declarations.  
  
This patch brings the C code into line with what the SQL declarations  
say, which is enough to make it not dump core on the particular 32-bit  
machine I'm testing on.  But I think we could do with another round  
of looking at what the datum widths *should* be.  For instance, it's  
not all that sensible that hash_bitmap_info decided to use int64 to  
represent a BlockNumber input when get_raw_page doesn't do it that way.  
  
There's also a remaining problem that the expected outputs from the  
test script are platform-dependent, but I'll leave that issue for  
somebody else.  
  
Per buildfarm.  

M contrib/pageinspect/hashfuncs.c

pageinspect: Try to fix some bugs in previous commit.

commit   : ed807fda6d5102537daa5d725e716555cbc49f44    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Feb 2017 22:29:29 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Feb 2017 22:29:29 -0500    

Click here for diff

Commit 08bf6e529587e1e9075d013d859af2649c32a511 seems not to have  
used the correct *GetDatum and PG_GETARG_* macros for the SQL types  
in some cases, and some of the SQL types seem to have been poorly  
chosen, too.  Try to fix it.  I'm not sure if this is the reason  
why the buildfarm is currently unhappy with this code, but it  
seems like a good place to start.  
  
Buildfarm unhappiness reported by Tom Lane.  

M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/pageinspect–1.5–1.6.sql

Clean up psql's behavior for a few more control variables.

commit   : fd6cd698031d3dbeccafde49a8b118cb840312aa    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Feb 2017 20:16:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Feb 2017 20:16:17 -0500    

Click here for diff

Modify FETCH_COUNT to always have a defined value, like other control  
variables, mainly so it will always appear in "\set" output.  
  
Add hooks to force HISTSIZE to be defined and require it to have an  
integer value.  (I don't see any point in allowing it to be set to  
non-integral values.)  
  
Add hooks to force IGNOREEOF to be defined and require it to have an  
integer value.  Unlike the other cases, here we're trying to be  
bug-compatible with a rather bogus externally-defined behavior, so I think  
we need to continue to allow "\set IGNOREEOF whatever".  Fix it so that  
the substitution hook silently replace non-numeric values with "10",  
so that the stored value always reflects what we're really doing.  
  
Add a dummy assign hook for HISTFILE, just so it's always in  
variables.c's list.  We can't require it to be defined always, because  
that would break the interaction with the PSQL_HISTORY environment  
variable, so there isn't any change in visible behavior here.  
  
Remove tab-complete.c's private list of known variable names, since that's  
really a maintenance nuisance.  Given the preceding changes, there are no  
control variables it won't show anyway.  This does mean that if for some  
reason you've unset one of the status variables (DBNAME, HOST, etc), that  
variable would not appear in tab completion for \set.  But I think that's  
fine, for at least two reasons: we shouldn't be encouraging people to use  
those variables as regular variables, and if someone does do so anyway,  
why shouldn't it act just like a regular variable?  
  
Remove ugly and no-longer-used-anywhere GetVariableNum().  In general,  
future additions of integer-valued control variables should follow the  
paradigm of adding an assign hook using ParseVariableNum(), so there's  
no reason to expect we'd need this again later.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/help.c
M src/bin/psql/input.c
M src/bin/psql/mainloop.c
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/tab-complete.c
M src/bin/psql/variables.c
M src/bin/psql/variables.h

Avoid improbable null pointer dereference in pgpassfileWarning().

commit   : 8ac0365c22f20dcd2a6b6752b95b665ada83e858    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Feb 2017 19:49:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Feb 2017 19:49:15 -0500    

Click here for diff

Coverity complained that we might pass a null pointer to strcmp()  
if PQresultErrorField were to return NULL.  That shouldn't be possible,  
since the server is supposed to always provide some SQLSTATE or other  
in an error message.  But we usually defend against such hazards, and  
it only takes a little more code to do so here.  
  
There's no good reason to think this is a live bug, so no back-patch.  

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

Fix placement of initPlans when forcibly materializing a subplan.

commit   : 555494d1bc119173bbf712940da823303644d4de    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Feb 2017 19:11:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Feb 2017 19:11:27 -0500    

Click here for diff

If we forcibly place a Material node atop a finished subplan, we need  
to move any initPlans attached to the subplan up to the Material node,  
in order to keep SS_finalize_plan() happy.  I'd figured this out in  
commit 7b67a0a49 for the case of materializing a cursor plan, but out of  
an abundance of caution, I put the initPlan movement hack at the call  
site for that case, rather than inside materialize_finished_plan().  
That was the wrong thing, because it turns out to also be necessary for  
the only other caller of materialize_finished_plan(), ie subselect.c.  
We lacked any test cases that exposed the mistake, but bug#14524 from  
Wei Congrui shows that it's possible to get an initPlan reference into  
the top tlist in that case too, and then SS_finalize_plan() complains.  
Hence, move the hack into materialize_finished_plan().  
  
In HEAD, also relocate some recently-added tests in subselect.sql, which  
I'd unthinkingly dropped into the middle of a sequence of related tests.  
  
Report: https://postgr.es/m/[email protected]  

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

doc: Add missing include in example code

commit   : aa09b9dcd57cbf18516332bf8310c12ef6f83715    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 2 Feb 2017 16:49:46 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 2 Feb 2017 16:49:46 -0500    

Click here for diff

It's not broken because the header file is included via other headers,  
but for better style we should be more explicit.  
  
Reported-by: [email protected]  

M doc/src/sgml/trigger.sgml

Fix mishandling of tSRFs at different nesting levels.

commit   : c82d4e658eff287846fe6243966d110ff4ae9025    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Feb 2017 16:38:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Feb 2017 16:38:13 -0500    

Click here for diff

Given a targetlist like "srf(x), f(srf(x))", split_pathtarget_at_srfs()  
decided that it needed two levels of ProjectSet nodes, failing to notice  
that the two SRF calls are textually equal().  Because of that, setrefs.c  
would convert the upper ProjectSet's tlist to "Var1, f(Var1)" (where Var1  
represents a reference to the srf(x) output of the lower ProjectSet).  
This triggered an assertion in nodeProjectSet.c complaining that it found  
no SRFs to evaluate, as reported by Erik Rijkers.  
  
What we want in such a case is to evaluate srf(x) only once and use a plain  
Result node to compute "Var1, f(Var1)"; that gives results similar to what  
previous versions produced, whereas allowing srf(x) to be evaluated again  
in an upper ProjectSet would square the number of rows emitted.  
  
Furthermore, even if the SRF calls aren't textually identical, we want them  
to be evaluated in lockstep, because that's what happened in the old  
implementation.  But split_pathtarget_at_srfs() got this completely wrong,  
using two levels of ProjectSet for a case like "srf(x), f(srf(y))".  
  
Hence, rewrite split_pathtarget_at_srfs() from the ground up so that it  
groups SRFs according to the depth of nesting of SRFs in their arguments.  
This is pretty much how we envisioned that working originally, but I blew  
it when it came to implementation.  
  
In passing, optimize the case of target == input_target, which I noticed  
is not only possible but quite common.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/tlist.c
M src/test/regress/expected/subselect.out
M src/test/regress/expected/tsrf.out
M src/test/regress/sql/tsrf.sql

doc: Document result set of CREATE_REPLICATION_SLOT

commit   : ecb814b5cef4971e50ee177eff320d416aa0b882    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 2 Feb 2017 16:04:59 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 2 Feb 2017 16:04:59 -0500    

Click here for diff

From: Marko Tiikkaja <[email protected]>  

M doc/src/sgml/protocol.sgml

Increase upper bound for bgwriter_lru_maxpages.

commit   : 14ca9abfbe4643408ad6ed3279f2f6366cafb3f1    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Feb 2017 14:40:05 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Feb 2017 14:40:05 -0500    

Click here for diff

There is no particularly good reason to limit this value to 1000,  
so increase the limit to INT_MAX / 2, the same limit we use for  
shared_buffers.  It's not clear how much practical effect larger  
settings will have, but there seems no harm in letting people try it.  
  
Jim Nasby, less a comment change I stripped out.  
  
Discussion: http://postgr.es/m/[email protected]  

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

pageinspect: Support hash indexes.

commit   : 08bf6e529587e1e9075d013d859af2649c32a511    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Feb 2017 14:12:58 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Feb 2017 14:12:58 -0500    

Click here for diff

Patch by Jesper Pedersen and Ashutosh Sharma, with some error handling  
improvements by me.  Tests from Peter Eisentraut.  Reviewed by Ɓlvaro  
Herrera, Michael Paquier, Jesper Pedersen, Jeff Janes, Peter  
Eisentraut, Amit Kapila, Mithun Cy, and me.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/pageinspect/Makefile
A contrib/pageinspect/expected/hash.out
A contrib/pageinspect/hashfuncs.c
A contrib/pageinspect/pageinspect–1.5–1.6.sql
M contrib/pageinspect/pageinspect.control
A contrib/pageinspect/sql/hash.sql
M doc/src/sgml/pageinspect.sgml
M src/backend/access/hash/hashovfl.c
M src/include/access/hash.h

Code review for avoidance of direct cross-module links.

commit   : acd73ad1a17f7aed6a914dd9c331f1043d89988d    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 2 Feb 2017 11:21:16 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 2 Feb 2017 11:21:16 -0500    

Click here for diff

Remove $(pkglibdir) from $(rpathdir), since commits  
d51924be886c2a05e691fa05b16cb6b30ab8370f and  
eda04886c1e048d695728206504ab4198462168e removed direct linkage to  
objects stored there.  Users are unlikely to notice the difference.  
Accompany every $(python_libspec) with $(python_additional_libs); this  
doesn't fix a demonstrated bug, but it might do so on rare Python  
configurations.  With these changes, AIX ceases to be a special case.  

M contrib/hstore_plperl/Makefile
M contrib/hstore_plpython/Makefile
M contrib/ltree_plpython/Makefile

Add KOI8-U map files to Makefile.

commit   : 53dd2da257fb5904b087b97dd9c2867390d309c1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Feb 2017 14:12:35 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Feb 2017 14:12:35 +0200    

Click here for diff

These were left out by mistake back when support for KOI8-U encoding was  
added.  
  
Extracted from Kyotaro Horiguchi's larger patch.  

M src/backend/utils/mb/Unicode/Makefile

Silence compiler warning.

commit   : cb695ae993a38a0600a907154cfcc71285a9b9ef    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Feb 2017 10:40:56 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Feb 2017 10:40:56 +0200    

Click here for diff

Not all compilers understand that the elog(ERROR) never returns.  
  
David Rowley  

M src/backend/libpq/crypt.c

Don't count background workers against a user's connection limit.

commit   : f1169ab501ce90e035a7c6489013a1d4c250ac92    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 1 Feb 2017 17:52:35 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 1 Feb 2017 17:52:35 -0500    

Click here for diff

Doing so doesn't seem to be within the purpose of the per user  
connection limits, and has particularly unfortunate effects in  
conjunction with parallel queries.  
  
Backpatch to 9.6 where parallel queries were introduced.  
  
David Rowley, reviewed by Robert Haas and Albe Laurenz.  

M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/create_role.sgml
M src/backend/access/transam/twophase.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/init/postinit.c
M src/include/storage/proc.h
M src/include/storage/procarray.h

Fix CatalogTupleInsert/Update abstraction for case of shared indstate.

commit   : aedd554f84bb3cedb32e6e2a954a70537a4da6b9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Feb 2017 17:18:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Feb 2017 17:18:36 -0500    

Click here for diff

Add CatalogTupleInsertWithInfo and CatalogTupleUpdateWithInfo to let  
callers use the CatalogTupleXXX abstraction layer even in cases where  
we want to share the results of CatalogOpenIndexes across multiple  
inserts/updates for efficiency.  This finishes the job begun in commit  
2f5c9d9c9, by allowing some remaining simple_heap_insert/update  
calls to be replaced.  The abstraction layer is now complete enough  
that we don't have to export CatalogIndexInsert at all anymore.  
  
Also, this fixes several places in which 2f5c9d9c9 introduced performance  
regressions by using retail CatalogTupleInsert or CatalogTupleUpdate even  
though the previous coding had been able to amortize CatalogOpenIndexes  
work across multiple tuples.  
  
A possible future improvement is to arrange for the indexing.c functions  
to cache the CatalogIndexState somewhere, maybe in the relcache, in which  
case we could get rid of CatalogTupleInsertWithInfo and  
CatalogTupleUpdateWithInfo again.  But that's a task for another day.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/catalog/indexing.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_shdepend.c
M src/backend/commands/cluster.c
M src/backend/storage/large_object/inv_api.c
M src/include/catalog/indexing.h

Provide CatalogTupleDelete() as a wrapper around simple_heap_delete().

commit   : ab02896510e26e46b830c87eef2c03dd3c52c09e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Feb 2017 16:13:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Feb 2017 16:13:30 -0500    

Click here for diff

This extends the work done in commit 2f5c9d9c9 to provide a more nearly  
complete abstraction layer hiding the details of index updating for catalog  
changes.  That commit only invented abstractions for catalog inserts and  
updates, leaving nearby code for catalog deletes still calling the  
heap-level routines directly.  That seems rather ugly from here, and it  
does little to help if we ever want to shift to a storage system in which  
indexing work is needed at delete time.  
  
Hence, create a wrapper function CatalogTupleDelete(), and replace calls  
of simple_heap_delete() on catalog tuples with it.  There are now very  
few direct calls of [simple_]heap_delete remaining in the tree.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.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_largeobject.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/commands/amcmds.c
M src/backend/commands/comment.c
M src/backend/commands/dbcommands.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/replication/logical/origin.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/storage/large_object/inv_api.c
M src/include/catalog/indexing.h

Refactor other replication commands to use DestRemoteSimple.

commit   : bbd8550bce146f86e5e883f1232292a975c314fb    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 1 Feb 2017 13:42:41 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 1 Feb 2017 13:42:41 -0500    

Click here for diff

Commit a84069d9350400c860d5e932b50dfd337aa407b0 added a new type of  
DestReceiver to avoid duplicating the existing code for the SHOW  
command, but it turns out we can leverage that new DestReceiver  
type in a few more places, saving some code.  
  
Michael Paquier, reviewed by Andres Freund and by me.  
  
Discussion: http://postgr.es/m/CAB7nPqSdFOQC0evc0r1nJeQyGBqjBrR41MC4rcMqUUpoJaZbtQ%40mail.gmail.com  
Discussion: http://postgr.es/m/CAB7nPqT2K4XFT1JgqufFBjsOc-NUKXg5qBDucHPMbk6Xi1kYaA@mail.gmail.com  

M src/backend/access/common/printsimple.c
M src/backend/access/common/tupdesc.c
M src/backend/replication/walsender.c

Make psql's \set display variables in alphabetical order.

commit   : c3e3844a92fe42109e4106314f7d229f784a7d0a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Feb 2017 11:25:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Feb 2017 11:25:19 -0500    

Click here for diff

"\set" with no arguments displays all defined variables, but it does so  
in the order that they appear in variables.c's list, which previously  
was mostly creation order.  That makes the list ugly and hard to find  
things in, and it exposes some psql implementation details to users.  
(For instance, ordinary variables will move to the bottom of the list  
if unset and set again, but variables that have hooks won't.)  
  
Fix that by keeping the list in alphabetical order at all times, which  
isn't much more complicated than breaking out of the insertion search  
loops once we reach an entry that should be after the one to be inserted.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/variables.c

Improve psql's behavior for \set and \unset of its control variables.

commit   : 86322dc7e013b4062393dcbb74043db003e23ec5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Feb 2017 11:02:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Feb 2017 11:02:40 -0500    

Click here for diff

This commit improves on the results of commit 511ae628f in two ways:  
  
1. It restores the historical behavior that "\set FOO" is interpreted  
as setting FOO to "on", if FOO is a boolean control variable.  We  
already found one test script that was expecting that behavior, and  
the psql documentation certainly does nothing to discourage people  
from assuming that would work, since it often says just "if FOO is set"  
when describing the effects of a boolean variable.  However, now this  
case will result in actually setting FOO to "on", not an empty string.  
  
2. It arranges for an "\unset" of a control variable to set the value  
back to its default value, rather than becoming apparently undefined.  
The control variables are also initialized that way at psql startup.  
  
In combination, these things guarantee that a control variable always  
has a displayable value that reflects what psql is actually doing.  
That is a pretty substantial usability improvement.  
  
The implementation involves adding a second type of variable hook function  
that is able to replace a proposed new value (including NULL) with another  
one.  We could alternatively have complicated the API of the assign hook,  
but this way seems better since many variables can share the same  
substitution hook function.  
  
Also document the actual behavior of these variables more fully,  
including covering assorted behaviors that were there before but  
never documented.  
  
This patch also includes some minor cleanup that should have been in  
511ae628f but was missed.  
  
Patch by me, but it owes a lot to discussions with Daniel VƩritƩ.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/startup.c
M src/bin/psql/variables.c
M src/bin/psql/variables.h
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Replace isMD5() with a more future-proof way to check if pw is encrypted.

commit   : dbd69118c05d73969a1bd52ead6702c6e40b0fee    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 1 Feb 2017 13:11:37 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 1 Feb 2017 13:11:37 +0200    

Click here for diff

The rule is that if pg_authid.rolpassword begins with "md5" and has the  
right length, it's an MD5 hash, otherwise it's a plaintext password. The  
idiom has been to use isMD5() to check for that, but that gets awkward,  
when we add new kinds of verifiers, like the verifiers for SCRAM  
authentication in the pending SCRAM patch set. Replace isMD5() with a new  
get_password_type() function, so that when new verifier types are added, we  
don't need to remember to modify every place that currently calls isMD5(),  
to also recognize the new kinds of verifiers.  
  
Also, use the new plain_crypt_verify function in passwordcheck, so that it  
doesn't need to know about MD5, or in the future, about other kinds of  
hashes or password verifiers.  
  
Reviewed by Michael Paquier and Peter Eisentraut.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/passwordcheck/passwordcheck.c
M src/backend/commands/user.c
M src/backend/libpq/crypt.c
M src/include/commands/user.h
M src/include/common/md5.h
M src/include/libpq/crypt.h

Don't create "holes" in BufFiles, in the new logtape code.

commit   : 7ac4a389a7dbddaa8b19deb228f0a988e79c5795    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 1 Feb 2017 12:17:38 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 1 Feb 2017 12:17:38 +0200    

Click here for diff

The "Simplify tape block format" commit ignored the rule that blocks  
returned by ltsGetFreeBlock() must be written out in the same order, at  
least in the first write pass. To fix, relax that requirement, by making  
ltsWriteBlock() to detect if it's about to create a "hole" in the  
underlying BufFile, and fill it with zeros instead.  
  
Reported, analysed, and reviewed by Peter Geoghegan.  
  
Discussion: https://www.postgresql.org/message-id/CAM3SWZRWdNtkhiG0GyiX_1mUAypiK3dV6-6542pYe2iEL-foTA@mail.gmail.com  

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

Small fixes to the Perl scripts to create unicode conversion tables.

commit   : bc1686f3f653d30847736f2b71d694b98ba5c31d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 1 Feb 2017 11:23:53 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 1 Feb 2017 11:23:53 +0200    

Click here for diff

Add missing semicolons in UCS_to_* perl scripts.  
For consistency, use "$hashref->{key}" style everywhere.  
  
Kyotaro Horiguchi  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/convutils.pm

Move comment about test slightly closer to test.

commit   : 8a815e3fc318b441a5e8a37e4129660d81e1e012    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 31 Jan 2017 17:12:54 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 31 Jan 2017 17:12:54 -0500    

Click here for diff

The addition of a TestForOldSnapshot() call here has made the  
referent of this comment slightly less clear, so move the comment  
to compensate.  
  
Amit Kapila (as part of the parallel index scan patch)  

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

Tweak catalog indexing abstraction for upcoming WARM

commit   : 2f5c9d9c9cec436e55847ec580606d7e88067df6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 31 Jan 2017 18:42:24 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 31 Jan 2017 18:42:24 -0300    

Click here for diff

Split the existing CatalogUpdateIndexes into two different routines,  
CatalogTupleInsert and CatalogTupleUpdate, which do both the heap  
insert/update plus the index update.  This removes over 300 lines of  
boilerplate code all over src/backend/catalog/ and src/backend/commands.  
The resulting code is much more pleasing to the eye.  
  
Also, by encapsulating what happens in detail during an UPDATE, this  
facilitates the upcoming WARM patch, which is going to add a few more  
lines to the update case making the boilerplate even more boring.  
  
The original CatalogUpdateIndexes is removed; there was only one use  
left, and since it's just three lines, we can as well expand it in place  
there.  We could keep it, but WARM is going to break all the UPDATE  
out-of-core callsites anyway, so there seems to be no benefit in doing  
so.  
  
Author: Pavan Deolasee  
Discussion: https://www.postgr.es/m/CABOikdOcFYSZ4vA2gYfs=M2cdXzXX4qGHeEiW3fu9PCfkHLa2A@mail.gmail.com  

M src/backend/catalog/aclchk.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.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_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/toasting.c
M src/backend/commands/alter.c
M src/backend/commands/amcmds.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/comment.c
M src/backend/commands/dbcommands.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/replication/logical/origin.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/indexing.h

pg_dump: Fix handling of ALTER DEFAULT PRIVILEGES

commit   : e2090d9d20d8091c9478a674d9c22fc8006909ce    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 31 Jan 2017 16:24:11 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 31 Jan 2017 16:24:11 -0500    

Click here for diff

In commit 23f34fa, we changed how ACLs were handled to use the new  
pg_init_privs catalog and to dump out the ACL commands as REVOKE+GRANT  
combinations instead of trying to REVOKE all rights always and then  
GRANT back just the ones which were in place.  
  
Unfortunately, the DEFAULT PRIVILEGES system didn't quite get the  
correct treatment with this change and ended up (incorrectly) only  
including positive GRANTs instead of both the REVOKEs and GRANTs  
necessary to preserve the correct privileges.  
  
There are only a couple cases where such REVOKEs are possible because,  
generally speaking, there's few rights which exist on objects by  
default to be revoked.  
  
Examples of REVOKEs which weren't being correctly preserved are when  
privileges are REVOKE'd from the creator/owner, like so:  
  
ALTER DEFAULT PRIVILEGES  
  FOR ROLE myrole  
  REVOKE SELECT ON TABLES FROM myrole;  
  
or when other default privileges are being revoked, such as EXECUTE  
rights granted to public for functions:  
  
ALTER DEFAULT PRIVILEGES  
  FOR ROLE myrole  
  REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;  
  
Fix this by correctly working out what the correct REVOKE statements are  
(if any) and dump them out, just as we do for everything else.  
  
Noticed while developing additional regression tests for pg_dump, which  
will be landing shortly.  
  
Back-patch to 9.6 where the bug was introduced.  

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

perltidy pg_dump TAP tests

commit   : 6af8b89adba16f97bee0d3b01256861e10d0e4f1    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 31 Jan 2017 12:42:16 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 31 Jan 2017 12:42:16 -0500    

Click here for diff

The pg_dump TAP tests have gotten pretty far from what perltidy thinks  
they should be, so fix that, and in passing use long-form argument names  
with arguments passed via "=" in a similar vein to 58da833.  
  
No functional changes here, just whitespace and changing runs from  
"-f" to "--file=", and similar.  

M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/010_dump_connstr.pl

test_pg_dump: perltidy cleanup

commit   : 58da8334308c26107ebb7ee06c99589e14bd882b    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 31 Jan 2017 11:17:38 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 31 Jan 2017 11:17:38 -0500    

Click here for diff

As pointed out by Alvaro, we actually use perltidy on the perl scripts  
in the source tree, so go back to the results of a perltidy run for the  
test_pg_dump TAP script.  
  
To make it look slightly less tragic, I changed most of the independent  
arguments into long-form single arguments (eg: -f file.sql changed to be  
--file=file.sql) to avoid having them confusingly split across lines due  
to perltidy.  
  
Back-patch to 9.6, as the last patch was.  

M src/test/modules/test_pg_dump/t/001_base.pl

Simplify some long-obsolete code in hba.c's next_token().

commit   : 1e5a5d03da14ba9b734c6a2a1a822dcd8af110eb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2017 18:42:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2017 18:42:41 -0500    

Click here for diff

next_token() oddly set its buffer space consumption limit to one before  
the last char position in the buffer, not the last as you'd expect.  
The reason is there was once an ugly kluge to mark keywords by appending  
a newline to them, potentially requiring one more byte.  Commit e5e2fc842  
removed that kluge, but failed to notice that the length limit could be  
increased.  
  
Also, remove some vestigial handling of newline characters in the buffer.  
That was left over from when this function read the file directly using  
getc().  Commit 7f49a67f9 changed it to read from a buffer, from which  
tokenize_file had already removed the only possible occurrence of newline,  
but did not simplify this function in consequence.  
  
Also, ensure that we don't return with *lineptr set to someplace past the  
terminating '\0'; that would be catastrophic if a caller were to ask for  
another token from the same line.  This is just latent since no callers  
actually do call again after a "false" return; but considering that it was  
actually costing us extra code to do it wrong, we might as well make it  
bulletproof.  
  
Noted while reviewing pg_hba_file_rules patch.  

M src/backend/libpq/hba.c

Invent pg_hba_file_rules view to show the content of pg_hba.conf.

commit   : de16ab7238888b16825ad13f0bbe123632915e9b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2017 18:00:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2017 18:00:26 -0500    

Click here for diff

This view is designed along the same lines as pg_file_settings, to wit  
it shows what is currently in the file, not what the postmaster has  
loaded as the active settings.  That allows it to be used to pre-vet  
edits before issuing SIGHUP.  As with the earlier view, go out of our  
way to allow errors in the file to be reflected in the view, to assist  
that use-case.  
  
(We might at some point invent a view to show the current active settings,  
but this is not that patch; and it's not trivial to do.)  
  
Haribabu Kommi, reviewed by Ashutosh Bapat, Michael Paquier, Simon Riggs,  
and myself  
  
Discussion: https://postgr.es/m/CAJrrPGerH4jiwpcXT1-46QXUDmNp2QDrG9+-Tek_xC8APHShYw@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/client-auth.sgml
M src/backend/catalog/system_views.sql
M src/backend/libpq/hba.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/libpq/hba.h
M src/test/regress/expected/rules.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/sysviews.sql

Add a regression test script dedicated to exercising system views.

commit   : d002f16c6ec38f76d1ee97367ba6af3000d441d0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2017 17:15:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2017 17:15:42 -0500    

Click here for diff

Quite a few of our built-in system views were not exercised anywhere  
in the regression tests.  This is perhaps not so exciting for the ones  
that are simple projections/joins of system catalogs, but for the ones  
that are wrappers for set-returning C functions, the omission translates  
directly to lack of test coverage for those functions.  
  
In many cases, the reason for the omission is that the view doesn't have  
much to do with any specific SQL feature, so there's no natural place to  
test it.  To remedy that, invent a new script sysviews.sql that's dedicated  
to testing SRF-based views.  Move a couple of tests that did fit this  
charter into the new script, and add simple "count(*)" based tests of  
other views within the charter.  That's enough to ensure we at least  
exercise the main code path through the SRF, although it does little to  
prove that the output is sane.  
  
More could be done here, no doubt, and I hope someone will think about  
how we can test these views more thoroughly.  But this is a starting  
point.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/rangefuncs.out
A src/test/regress/expected/sysviews.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/rangefuncs.sql
A src/test/regress/sql/sysviews.sql
M src/test/regress/sql/timestamptz.sql

Make psql reject attempts to set special variables to invalid values.

commit   : 511ae628f31b4e791cd5c7836e46cb84dcf145fd    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2017 16:37:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2017 16:37:15 -0500    

Click here for diff

Previously, if the user set a special variable such as ECHO to an  
unrecognized value, psql would bleat but store the new value anyway, and  
then fall back to a default setting for the behavior controlled by the  
variable.  This was agreed to be a not particularly good idea.  With  
this patch, invalid values result in an error message and no change in  
state.  
  
(But this applies only to variables that affect psql's behavior; purely  
informational variables such as ENCODING can still be set to random  
values.)  
  
To do this, modify the API for psql's assign-hook functions so that they  
can return an OK/not OK result, and give them the responsibility for  
printing error messages when they reject a value.  Adjust the APIs for  
ParseVariableBool and ParseVariableNum to support the new behavior  
conveniently.  
  
In passing, document the variable VERSION, which had somehow escaped that.  
And improve the quite-inadequate commenting in psql/variables.c.  
  
Daniel VƩritƩ, reviewed by Rahila Syed, some further tweaking by me  
  
Discussion: https://postgr.es/m/7356e741-fa59-4146-a8eb-cf95fd6b21fb@mm  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/input.c
M src/bin/psql/mainloop.c
M src/bin/psql/startup.c
M src/bin/psql/variables.c
M src/bin/psql/variables.h
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Fix sequence test in cs_CZ locale

commit   : 46aae5949f56580281a0f487c785c745d8856a04    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 30 Jan 2017 13:28:28 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 30 Jan 2017 13:28:28 -0500    

Click here for diff

Rename some objects so that sorted output becomes less locale-dependent.  

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

Additional test coverage for sequences

commit   : d711532b2eb70cf2f56d95efcc608d474266d769    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 30 Jan 2017 12:26:17 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 30 Jan 2017 12:26:17 -0500    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  

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

Update time zone data files to tzdata release 2016j.

commit   : 308d8682740391cf6e94fdbadcdbbecfa02ea208    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2017 11:40:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2017 11:40:22 -0500    

Click here for diff

DST law changes in northern Cyprus (new zone Asia/Famagusta), Russia (new  
zone Europe/Saratov), Tonga, Antarctica/Casey.  Historical corrections for  
Asia/Aqtau, Asia/Atyrau, Asia/Gaza, Asia/Hebron, Italy, Malta.  Replace  
invented zone abbreviation "TOT" for Tonga with numeric UTC offset; but  
as in the past, we'll keep accepting "TOT" for input.  

M src/timezone/data/africa
M src/timezone/data/antarctica
M src/timezone/data/asia
M src/timezone/data/australasia
M src/timezone/data/europe
M src/timezone/known_abbrevs.txt
M src/timezone/tznames/Default
M src/timezone/tznames/Pacific.txt

Remove leftover reference to "indirect blocks" in comment.

commit   : dbeca61c3535af2613000c4492848ca6da8a902f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 30 Jan 2017 10:51:20 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 30 Jan 2017 10:51:20 +0200    

Click here for diff

Peter Geoghegan  

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

Handle ALTER EXTENSION ADD/DROP with pg_init_privs

commit   : e54f75722c720b596ec5e72154cc899da199de5b    
  
author   : Stephen Frost <[email protected]>    
date     : Sun, 29 Jan 2017 23:05:07 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Sun, 29 Jan 2017 23:05:07 -0500    

Click here for diff

In commit 6c268df, pg_init_privs was added to track the initial  
privileges of catalog objects and extensions.  Unfortunately, that  
commit didn't include understanding of ALTER EXTENSION ADD/DROP, which  
allows the objects associated with an extension to be changed after the  
initial CREATE EXTENSION script has been run.  
  
The result of this meant that ACLs for objects added through  
ALTER EXTENSION ADD were not recorded into pg_init_privs and we would  
end up including those ACLs in pg_dump when we shouldn't have.  
  
This commit corrects that by making sure to have pg_init_privs updated  
when ALTER EXTENSION ADD/DROP is run, recording the permissions as they  
are at ALTER EXTENSION ADD time, and removing any if/when ALTER  
EXTENSION DROP is called.  
  
This issue was pointed out by Moshe Jacobson as commentary on bug #14456  
(which was actually a bug about versions prior to 9.6 not handling  
custom ACLs on extensions correctly, an issue now addressed with  
pg_init_privs in 9.6).  
  
Back-patch to 9.6 where pg_init_privs was introduced.  

M src/backend/catalog/aclchk.c
M src/backend/commands/extension.c
M src/include/utils/acl.h
M src/test/modules/test_pg_dump/expected/test_pg_dump.out
M src/test/modules/test_pg_dump/sql/test_pg_dump.sql
M src/test/modules/test_pg_dump/t/001_base.pl

test_pg_dump TAP test whitespace cleanup

commit   : fb94ca77f1400e236b00d432dccfbe4f1124971c    
  
author   : Stephen Frost <[email protected]>    
date     : Sun, 29 Jan 2017 23:05:07 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Sun, 29 Jan 2017 23:05:07 -0500    

Click here for diff

The formatting of the perl hashes used in the TAP tests for test_pg_dump  
was rather horribly inconsistent and made it more difficult than it  
really should have been to add new tests or adjust what tests are for  
what runs, etc.  
  
Reformat to clean that all up.  
  
Whitespace-only changes.  

M src/test/modules/test_pg_dump/t/001_base.pl

Fix typo in comment.

commit   : 4bf371cf2a894abeda672996f24dc6603ceddc3c    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 27 Jan 2017 17:22:40 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 27 Jan 2017 17:22:40 -0500    

Click here for diff

Etsuro Fujita  

M contrib/postgres_fdw/postgres_fdw.c

Refactor bitmap heap scan estimation of heap pages fetched.

commit   : da08a659897347859fdfe258c67e9d2bf680d4dd    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 27 Jan 2017 16:22:11 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 27 Jan 2017 16:22:11 -0500    

Click here for diff

Currently, we only need this logic in order to cost a Bitmap Heap  
Scan.  But a pending patch for Parallel Bitmap Heap Scan also uses  
it to help figure out how many workers to use for the scan, which  
has to be determined prior to costing.  So, move the logic to  
a separate function to make that easier.  
  
Dilip Kumar.  The patch series of which this is a part has been  
reviewed by Andres Freund, Amit Khendekar, Tushar Ahuja, Rafia  
Sabih, Haribabu Kommi, and me; it is not clear from the email  
discussion which of those people have looked specifically at this  
part.  
  
Discussion: http://postgr.es/m/CAFiTN-v3QYNJEZnnmKCeATuLbN-h9tMVfeEF0+BrouYDqjXgwg@mail.gmail.com  

M src/backend/optimizer/path/costsize.c
M src/include/optimizer/cost.h

Restructure hba.c to replace 3 parallel lists with single list of structs.

commit   : 350cb921ae2ced8674e098d0645f2493e5757ad1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Jan 2017 13:43:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Jan 2017 13:43:00 -0500    

Click here for diff

tokenize_file() now returns a single list of TokenizedLine structs,  
carrying the same information as before.  We were otherwise going to grow a  
fourth list to deal with error messages, and that was getting a bit silly.  
  
Haribabu Kommi, revised a bit by me  
  
Discussion: https://postgr.es/m/CAJrrPGfbgbKsjYp=bgZXhMcgxoaGSoBb9fyjrDoOW_YymXv1Kw@mail.gmail.com  

M src/backend/libpq/hba.c

Improve comments about ProcessUtility's queryString parameter.

commit   : fde5c037925b01b937923606c39460d94965672e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Jan 2017 10:02:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Jan 2017 10:02:04 -0500    

Click here for diff

Per discussion with Craig Ringer.  

M src/backend/tcop/utility.c

Orthography fixes for new castNode() macro.

commit   : fefb86b14776321ac153836398eadde867ff31af    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Jan 2017 08:33:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Jan 2017 08:33:58 -0500    

Click here for diff

Clean up hastily-composed comment.  Normalize whitespace.  
  
Erik Rijkers and myself  

M src/include/nodes/nodes.h

commit   : 7afd56c3c6d8360a5bfdfb2de30038b239fd756b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Jan 2017 22:09:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Jan 2017 22:09:34 -0500    

Click here for diff

When I wrote commit ab1f0c822, I really missed the castNode() macro that  
Peter E. had proposed shortly before.  This back-fills the uses I would  
have put it to.  It's probably not all that significant, but there are  
more assertions here than there were before, and conceivably they will  
help catch any bugs associated with those representation changes.  
  
I left behind a number of usages like "(Query *) copyObject(query_var)".  
Those could have been converted as well, but Peter has proposed another  
notational improvement that would handle copyObject cases automatically,  
so I let that be for now.  

M src/backend/catalog/pg_proc.c
M src/backend/commands/createas.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/tablecmds.c
M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_type.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/mmgr/portalmem.c
M src/pl/plpgsql/src/pl_exec.c

Use the new castNode() macro in a number of places.

commit   : 9ba8a9ce4548bb34b7136b7463a61b2c499979a3    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 26 Jan 2017 16:47:03 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 26 Jan 2017 16:47:03 -0800    

Click here for diff

This is far from a pervasive conversion, but it's a good starting  
point.  
  
Author: Peter Eisentraut, with some minor changes by me  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/collationcmds.c
M src/backend/commands/constraint.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dropcmds.c
M src/backend/commands/explain.c
M src/backend/commands/functioncmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/user.c
M src/backend/commands/view.c
M src/backend/executor/execAmi.c
M src/backend/executor/execQual.c
M src/backend/executor/execTuples.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeWorktablescan.c

Add castNode(type, ptr) for safe casting between NodeTag based types.

commit   : 5bcab111426e5aae659a97a66d5de4ab9fe40edf    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 26 Jan 2017 16:47:03 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 26 Jan 2017 16:47:03 -0800    

Click here for diff

The new function allows to cast from one NodeTag based type to  
another, while asserting that the conversion is valid.  This replaces  
the common pattern of doing a cast and a Assert(IsA(ptr, type))  
close-by.  
  
As this seems likely to be used pervasively, we decided to backpatch  
this change the addition of this macro. Otherwise backpatched fixes  
are more likely not to work on back-branches.  
  
On branches before 9.6, where we do not yet rely on inline functions  
being available, the type assertion is only performed if PG_USE_INLINE  
support is detected. The cast obviously is performed regardless.  
  
For the benefit of verifying the macro compiles in the back-branches,  
this commit contains a single use of the new macro. On master, a  
somewhat larger conversion will be committed separately.  
  
Author: Peter Eisentraut and Andres Freund  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.2-  

M src/backend/tcop/postgres.c
M src/include/nodes/nodes.h

Remove test for COMMENT ON DATABASE

commit   : 331f8c311b7ba4b24158071ab2fb2e07bb8377b0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 26 Jan 2017 17:45:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 26 Jan 2017 17:45:22 -0300    

Click here for diff

Our current DDL only allows a database name to be specified in COMMENT  
ON DATABASE, which Andrew Dunstan reports to make this test fail on the  
buildfarm.  Remove the line until we gain a DDL command that allows the  
current database to be operated on without having the specify it by  
name.  
  
Backpatch to 9.5, where these tests appeared.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_ddl_deparse/expected/comment_on.out
M src/test/modules/test_ddl_deparse/sql/comment_on.sql

Fill in no_priv_msg for publications and subscriptions

commit   : e630faacd8a0c998db105a7d3fca063eb29b0eea    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Jan 2017 15:38:13 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Jan 2017 15:38:13 -0500    

Click here for diff

Even though these messages are not used yet, we should keep the list  
complete.  

M src/backend/catalog/aclchk.c

doc: Update privileges documentation

commit   : cdcad6b788a8651af2e48bf7d4160ae591e1f4d7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Jan 2017 15:36:59 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Jan 2017 15:36:59 -0500    

Click here for diff

The CREATE privilege on databases now also enables creating  
publications.  

M doc/src/sgml/ref/grant.sgml

Simplify sequence test

commit   : 9c18104c7448a0cdaa46aed1b9504439879f327e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Jan 2017 15:23:25 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Jan 2017 15:23:25 -0500    

Click here for diff

We maintained two separate expected files because log_cnt could be one  
of two values.  Rewrite the test so that we only need one file.  
  
Reviewed-by: Petr Jelinek <[email protected]>  

M src/test/regress/expected/sequence.out
D src/test/regress/expected/sequence_1.out
M src/test/regress/sql/sequence.sql

Check interrupts during hot standby waits

commit   : e8ee3d6b859a18d7f7375ceb9e04d256eb18aaec    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 26 Jan 2017 18:59:58 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 26 Jan 2017 18:59:58 +0000    

Click here for diff

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

Add object_address tests for publications and subscriptions

commit   : 2a2bdcab2c5c6081a8f53fce8741bc0717b7d2d0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Jan 2017 13:10:22 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Jan 2017 13:10:22 -0500    

Click here for diff

Add test cases to object_address.sql to test the new logical replication  
related object classes, and fix some small bugs discovered by that.  

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/object_address.out
M src/test/regress/sql/object_address.sql

Reset hot standby xmin on master after restart

commit   : ec4b975016b873292ba5e3d645b414acf1b96c06    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 26 Jan 2017 18:14:02 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 26 Jan 2017 18:14:02 +0000    

Click here for diff

Hot_standby_feedback could be reset by reload and worked correctly, but if  
the server was restarted rather than reloaded the xmin was not reset.  
Force reset always if hot_standby_feedback is enabled at startup.  
  
Ants Aasma, Craig Ringer  
  
Reported-by: Ants Aasma  

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

Ensure that a tsquery like '!foo' matches empty tsvectors.

commit   : 9d4ca01314ba0c571139c5560a40ef764ad0feee    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Jan 2017 12:17:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Jan 2017 12:17:47 -0500    

Click here for diff

!foo means "the tsvector does not contain foo", and therefore it should  
match an empty tsvector.  ts_match_vq() overenthusiastically supposed  
that an empty tsvector could never match any query, so it forcibly  
returned FALSE, the wrong answer.  Remove the premature optimization.  
  
Our behavior on this point was inconsistent, because while seqscans and  
GIST index searches both failed to match empty tsvectors, GIN index  
searches would find them, since GIN scans don't rely on ts_match_vq().  
That makes this certainly a bug, not a debatable definition disagreement,  
so back-patch to all supported branches.  
  
Report and diagnosis by Tom Dunstan (bug #14515); added test cases by me.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typo in description for pg_replication_origin_advance function.

commit   : bdadf36eb40e88f93a9daf20ecd005595ebec1cd    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 27 Jan 2017 00:42:33 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 27 Jan 2017 00:42:33 +0900    

Click here for diff

M src/include/catalog/pg_proc.h

Fix typo: pg_statistics -> pg_statistic

commit   : 5a366b4ff4ceceb9793fcc13c3f097ee0d32c56d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 25 Jan 2017 14:35:31 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 25 Jan 2017 14:35:31 -0500    

Click here for diff

M doc/src/sgml/planstats.sgml
M doc/src/sgml/release-7.4.sgml
M doc/src/sgml/release-old.sgml
M src/backend/postmaster/autovacuum.c
M src/backend/utils/cache/lsyscache.c

Introduce convenience macros to hide JsonbContainer header accesses better.

commit   : f7c62462402972b13d10e43f104ca0c0fecb6d08    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Jan 2017 13:28:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Jan 2017 13:28:38 -0500    

Click here for diff

This improves readability a bit and may make future improvements easier.  
  
In passing, make sure that the JB_ROOT_IS_XXX macros deliver boolean (0/1)  
results; the previous coding was a bug hazard, though no actual bugs are  
known.  
  
Nikita Glukhov, extended a bit by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/include/utils/jsonb.h

doc: Fix typo

commit   : 049ac809a790a9bde478e371da2b68d6b18c5df7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 25 Jan 2017 12:49:10 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 25 Jan 2017 12:49:10 -0500    

Click here for diff

M doc/src/sgml/catalogs.sgml

doc: Logical replication documentation improvements

commit   : 98cc5db27c97cccd19c4e67e8e623f2d260a5c35    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 25 Jan 2017 12:42:11 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 25 Jan 2017 12:42:11 -0500    

Click here for diff

From: Erik Rijkers <[email protected]>  

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

commit   : 3d9e73ea5f5bb280be438a81fbe91936f4ff0601    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 25 Jan 2017 12:32:05 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 25 Jan 2017 12:32:05 -0500    

Click here for diff

M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_subscription.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/executor/execReplication.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/worker.c
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_subscription.h
M src/include/commands/publicationcmds.h
M src/include/commands/subscriptioncmds.h
M src/include/replication/logicallauncher.h
M src/include/replication/logicalrelation.h
M src/include/replication/logicalworker.h
M src/include/replication/worker_internal.h
M src/test/subscription/Makefile

Close replication connection when slot creation errors

commit   : 65df150a18d4a24e6870eb4a3db28ac8a6c23603    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 25 Jan 2017 10:47:53 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 25 Jan 2017 10:47:53 -0500    

Click here for diff

From: Petr Jelinek <[email protected]>  

M src/backend/commands/subscriptioncmds.c

Remove vestigial resolveUnknown arguments from transformSortClause etc.

commit   : aebeb4790c750dc808c1c5afb3cb435116244e36    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Jan 2017 09:33:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Jan 2017 09:33:41 -0500    

Click here for diff

There's really no situation where we don't want these unknown-to-text  
conversions to happen.  The alternative is failure anyway, and the one  
caller that was passing "false" did so only because it expected the  
case could not arise.  Might as well simplify the code.  
  
Discussion: https://postgr.es/m/CAH2L28uwwbL9HUM-WR=hromW1Cvamkn7O-g8fPY2m=_7muJ0oA@mail.gmail.com  

M src/backend/parser/analyze.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/include/parser/parse_clause.h

doc: Fix typo

commit   : 87ecf2d14fa236e894267ef5e702ff08b8965f9d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 25 Jan 2017 09:28:38 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 25 Jan 2017 09:28:38 -0500    

Click here for diff

M doc/src/sgml/ref/alter_sequence.sgml

Make UNKNOWN into an actual pseudo-type.

commit   : d8d32d9a56a3cecfb14e8f47ebd50b780edffe60    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Jan 2017 09:27:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Jan 2017 09:27:09 -0500    

Click here for diff

Previously, type "unknown" was labeled as a base type in pg_type, which  
perhaps had some sense to it because you were allowed to create tables with  
unknown-type columns.  But now that we don't allow that, it makes more  
sense to label it a pseudo-type.  This has the additional effects of  
forbidding use of "unknown" as a domain base type, cast source or target  
type, PL function argument or result type, or plpgsql local variable type;  
all of which seem like good holes to plug.  
  
Discussion: https://postgr.es/m/CAH2L28uwwbL9HUM-WR=hromW1Cvamkn7O-g8fPY2m=_7muJ0oA@mail.gmail.com  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/plhandler.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/create_function.sgml
M doc/src/sgml/ref/create_type.sgml
M src/backend/catalog/heap.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_type.h
M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/type_sanity.sql

Change unknown-type literals to type text in SELECT and RETURNING lists.

commit   : 1e7c4bb0049732ece651d993d03bb6772e5d281a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Jan 2017 09:17:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Jan 2017 09:17:18 -0500    

Click here for diff

Previously, we left such literals alone if the query or subquery had  
no properties forcing a type decision to be made (such as an ORDER BY or  
DISTINCT clause using that output column).  This meant that "unknown" could  
be an exposed output column type, which has never been a great idea because  
it could result in strange failures later on.  For example, an outer query  
that tried to do any operations on an unknown-type subquery output would  
generally fail with some weird error like "failed to find conversion  
function from unknown to text" or "could not determine which collation to  
use for string comparison".  Also, if the case occurred in a CREATE VIEW's  
query then the view would have an unknown-type column, causing similar  
failures in queries trying to use the view.  
  
To fix, at the tail end of parse analysis of a query, forcibly convert any  
remaining "unknown" literals in its SELECT or RETURNING list to type text.  
However, provide a switch to suppress that, and use it in the cases of  
SELECT inside a set operation or INSERT command.  In those cases we already  
had type resolution rules that make use of context information from outside  
the subquery proper, and we don't want to change that behavior.  
  
Also, change creation of an unknown-type column in a relation from a  
warning to a hard error.  The error should be unreachable now in CREATE  
VIEW or CREATE MATVIEW, but it's still possible to explicitly say "unknown"  
in CREATE TABLE or CREATE (composite) TYPE.  We want to forbid that because  
it's nothing but a foot-gun.  
  
This change creates a pg_upgrade failure case: a matview that contains an  
unknown-type column can't be pg_upgraded, because reparsing the matview's  
defining query will now decide that the column is of type text, which  
doesn't match the cstring-like storage that the old materialized column  
would actually have.  Add a checking pass to detect that.  While at it,  
we can detect tables or composite types that would fail, essentially  
for free.  Those would fail safely anyway later on, but we might as  
well fail earlier.  
  
This patch is by me, but it owes something to previous investigations  
by Rahila Syed.  Also thanks to Ashutosh Bapat and Michael Paquier for  
review.  
  
Discussion: https://postgr.es/m/CAH2L28uwwbL9HUM-WR=hromW1Cvamkn7O-g8fPY2m=_7muJ0oA@mail.gmail.com  

M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/typeconv.sgml
M src/backend/catalog/heap.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_target.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/version.c
M src/include/parser/analyze.h
M src/include/parser/parse_node.h
M src/include/parser/parse_target.h
M src/test/regress/expected/create_table.out
M src/test/regress/expected/create_view.out
M src/test/regress/expected/matview.out
M src/test/regress/expected/subselect.out
M src/test/regress/expected/with.out
M src/test/regress/output/create_function_1.source
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/create_view.sql
M src/test/regress/sql/matview.sql
M src/test/regress/sql/subselect.sql
M src/test/regress/sql/with.sql

doc: Update ALTER SEQUENCE documentation to match

commit   : 123f03ba2c6e2d85a5a900e79dd5f216bfb37e25    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 25 Jan 2017 08:59:24 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 25 Jan 2017 08:59:24 -0500    

Click here for diff

Update documentation to match change in  
0bc1207aeb3de951bf95a9e9899b1256216d65f5.  

M doc/src/sgml/ref/alter_sequence.sgml

Improve speed of contrib/postgres_fdw regression tests.

commit   : aa7f593b1ffa9717bd5570174944c06c482d1c1f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Jan 2017 08:31:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Jan 2017 08:31:31 -0500    

Click here for diff

Commit 7012b132d added some tests that consumed an excessive amount of  
time, more than tripling the time needed for "make installcheck" for this  
module.  Add filter conditions to reduce the number of rows scanned,  
bringing the runtime down to within hailing distance of what it was before.  
  
Jeevan Chalke and Ashutosh Bapat, per a gripe from me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Be more aggressive in avoiding tuple conversion.

commit   : 3838074f864eda344677fba39c6141ccbcd4104b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 21:53:38 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 21:53:38 -0500    

Click here for diff

According to the comments in tupconvert.c, it's necessary to perform  
tuple conversion when either table has OIDs, and this was previously  
checked by ensuring that the tdtypeid value matched between the tables  
in question.  However, that's overly stringent: we have access to  
tdhasoid and can test directly whether OIDs are present, which lets us  
avoid conversion in cases where the type OIDs are different but the  
tuple descriptors are entirely the same (and neither has OIDs).  This  
is useful to the partitioning code, which can thereby avoid converting  
tuples when inserting into a partition whose columns appear in the  
same order as the parent columns, the normal case.  It's possible  
for the tuple routing code to avoid some additional overhead in this  
case as well, so do that, too.  
  
It's not clear whether it would be OK to skip this when both tables  
have OIDs: do callers count on this to build a new tuple (losing the  
previous OID) in such instances?  Until we figure it out, leave the  
behavior in that case alone.  
  
Amit Langote, reviewed by me.  

M src/backend/access/common/tupconvert.c
M src/backend/catalog/partition.c

Use non-conflicting table names in new regression test case.

commit   : 7fa7bf18e493e130147e62cf7dc33010f164126c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 Jan 2017 19:02:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 Jan 2017 19:02:13 -0500    

Click here for diff

Commit 587cda35c added a test to updatable_views.sql that created  
tables named the same as tables used by the concurrent inherit.sql  
script.  Unsurprisingly, this results in random failures.  
Pick different names.  
  
Per buildfarm.  

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

pg_dump: Fix some schema issues when dumping sequences

commit   : da4d1c0c15ab9afdfeee8bad9a1a9989b6bd59b5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 24 Jan 2017 17:03:56 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 24 Jan 2017 17:03:56 -0500    

Click here for diff

In the new code for selecting sequence data from pg_sequence, set the  
schema to pg_catalog instead of the sequences own schema, and refer to  
the sequence by OID instead of name, which was missing a schema  
qualification.  
  
Reported-by: Stephen Frost <[email protected]>  

M src/bin/pg_dump/pg_dump.c

Allow password file name to be specified as a libpq connection parameter.

commit   : ba005f193d88a8404e81db3df223cf689d64d75e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 Jan 2017 17:06:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 Jan 2017 17:06:21 -0500    

Click here for diff

Formerly an alternate password file could only be selected via the  
environment variable PGPASSFILE; now it can also be selected via a  
new connection parameter "passfile", corresponding to the conventions  
for most other connection parameters.  There was some concern about  
this creating a security weakness, but it was agreed that that argument  
was pretty thin, and there are clear use-cases for handling password  
files this way.  
  
Julian Markwort, reviewed by Fabien Coelho, some adjustments by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add a SHOW command to the replication command language.

commit   : d1ecd539477fe640455dc890216a7c1561e047b4    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 16:59:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 16:59:18 -0500    

Click here for diff

This is useful infrastructure for an upcoming proposed patch to  
allow the WAL segment size to be changed at initdb time; tools like  
pg_basebackup need the ability to interrogate the server setting.  
But it also doesn't seem like a bad thing to have independently of  
that; it may find other uses in the future.  
  
Robert Haas and Beena Emerson.  (The original patch here was by  
Beena, but I rewrote it to such a degree that most of the code  
being committed here is mine.)  
  
Discussion: http://postgr.es/m/CA+TgmobNo4qz06wHEmy9DszAre3dYx-WNhHSCbU9SAwf+9Ft6g@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M src/backend/access/common/tupdesc.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/walsender.c
M src/backend/utils/misc/guc.c
M src/include/access/tupdesc.h

Add a new DestReceiver for printing tuples without catalog access.

commit   : a84069d9350400c860d5e932b50dfd337aa407b0    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 16:53:56 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 16:53:56 -0500    

Click here for diff

If you create a DestReciver of type DestRemote and try to use it from  
a replication connection that is not bound to a specific daabase, or  
any other hypothetical type of backend that is not bound to a specific  
database, it will fail because it doesn't have a pg_proc catalog to  
look up properties of the types being printed.  In general, that's  
an unavoidable problem, but we can hardwire the properties of a few  
builtin types in order to support utility commands.  This new  
DestReceiver of type DestRemoteSimple does just that.  
  
Patch by me, reviewed by Michael Paquier.  
  
Discussion: http://postgr.es/m/CA+TgmobNo4qz06wHEmy9DszAre3dYx-WNhHSCbU9SAwf+9Ft6g@mail.gmail.com  

M src/backend/access/common/Makefile
A src/backend/access/common/printsimple.c
M src/backend/tcop/dest.c
A src/include/access/printsimple.h
M src/include/tcop/dest.h

Extend index AM API for parallel index scans.

commit   : 7b4ac19982a77a1a2a6f096c4a11ee7325a14d2c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 16:42:58 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 16:42:58 -0500    

Click here for diff

This patch doesn't actually make any index AM parallel-aware, but it  
provides the necessary functions at the AM layer to do so.  
  
Rahila Syed, Amit Kapila, Robert Haas  

M contrib/bloom/blutils.c
M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgutils.c
M src/include/access/amapi.h
M src/include/access/genam.h
M src/include/access/relscan.h
M src/include/c.h
M src/tools/pgindent/typedefs.list

Fix things so that updatable views work with partitioned tables.

commit   : 587cda35ca331128db6c61d406d312654572834a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 15:46:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 15:46:50 -0500    

Click here for diff

Previously, ExecInitModifyTable was missing handling for WITH CHECK  
OPTION, and view_query_is_auto_updatable was missing handling for  
RELKIND_PARTITIONED_TABLE.  
  
Amit Langote, reviewed by me.  

M src/backend/executor/nodeModifyTable.c
M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/updatable_views.sql

Set ecxt_scantuple correctly for tuple routing.

commit   : 132488bfee687865375b5410f18a78fb55bd7015    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 15:34:39 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 15:34:39 -0500    

Click here for diff

In 2ac3ef7a01df859c62d0a02333b646d65eaec5ff, we changed things so that  
it's possible for a different TupleTableSlot to be used for partitioned  
tables at successively lower levels.  If we do end up changing the slot  
from the original, we must update ecxt_scantuple to point to the new one  
for partition key of the tuple to be computed correctly.  
  
Reported by Rajkumar Raghuwanshi.  Patch by Amit Langote.  
  
Discussion: http://postgr.es/m/CAKcux6%3Dm1qyqB2k6cjniuMMrYXb75O-MB4qGQMu8zg-iGGLjDw%40mail.gmail.com  

M src/backend/catalog/partition.c
M src/backend/executor/execMain.c
M src/test/regress/expected/insert.out
M src/test/regress/sql/insert.sql

Reindent table partitioning code.

commit   : 27cdb3414b3fb4c8fcc069572568390450bb04c9    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 10:20:02 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 10:20:02 -0500    

Click here for diff

We've accumulated quite a bit of stuff with which pgindent is not  
quite happy in this code; clean it up to provide a less-annoying base  
for future pgindent runs.  

M src/backend/catalog/heap.c
M src/backend/catalog/partition.c
M src/backend/commands/copy.c
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/nodeModifyTable.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/heap.h
M src/include/catalog/indexing.h
M src/include/catalog/partition.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_proc.h
M src/include/commands/defrem.h
M src/include/nodes/parsenodes.h
M src/include/utils/rel.h

Fix incorrect comment: pgtime's tm_mon is 1-based, not 0-based.

commit   : 96e0ccc2b589eda26585ed2a8dabf34b16747c1a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 09:36:17 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 09:36:17 -0500    

Click here for diff

The comments in formatting.c already said that tm_mon was 1-based not  
0-based, but the comments here disagreed.  
  
Dmitry Fedin  

M src/include/pgtime.h

Remove unused variable.

commit   : 52df3420cd241b1411da3e4b24318db12bf22cba    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 09:08:13 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 09:08:13 -0500    

Click here for diff

This was intended to be included in the previous commit,  
but I goofed.  

M src/backend/catalog/partition.c

Don't invoke arbitrary code inside a possibly-aborted transaction.

commit   : 289992c462b504ffa289202ce8fc34a56b4048c3    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 08:57:10 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 08:57:10 -0500    

Click here for diff

The code here previously tried to call the partitioning operator, but  
really the right thing to do (and the safe thing to do) is use  
datumIsEqual().  
  
Amit Langote, but I expanded the comment and fixed a compiler warning.  

M src/backend/catalog/partition.c
M src/backend/utils/adt/datum.c

Fix interaction of partitioned tables with BulkInsertState.

commit   : b1ecb9b3fcfb76edb3461ce561d049c8fb9e710d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 08:50:16 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2017 08:50:16 -0500    

Click here for diff

When copying into a partitioned table, the target heap may change from  
one tuple to next.  We must ask ReadBufferBI() to get a new buffer  
every time such change occurs.  To do that, use new function  
ReleaseBulkInsertStatePin().  This fixes the bug that tuples ended up  
being inserted into the wrong partition, which occurred exactly  
because the wrong buffer was used.  
  
Amit Langote, per a suggestion from Robert Haas.  Some cosmetic  
adjustments by me.  
  
Reports by 高增ē¦ (Gao Zengqi), Venkata B Nagothi, and  
Ragnar Ouchterlony.  
  
Discussion: http://postgr.es/m/CAFmBtr32FDOqofo8yG-4mjzL1HnYHxXK5S9OGFJ%3D%3DcJpgEW4vA%40mail.gmail.com  
Discussion: http://postgr.es/m/CAEyp7J9WiX0L3DoiNcRrY-9iyw%3DqP%2Bj%3DDLsAnNFF1xT2J1ggfQ%40mail.gmail.com  
Discussion: http://postgr.es/m/16d73804-c9cd-14c5-463e-5caad563ff77%40agama.tv  
Discussion: http://postgr.es/m/CA+TgmoaiZpDVUUN8LZ4jv1qFE_QyR+H9ec+79f5vNczYarg5Zg@mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/commands/copy.c
M src/include/access/heapam.h

Mention logical replication tests in src/test/README.

commit   : 3eaf03b5d331b7a06d79e5ad2be7e36c4a9c3d72    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 24 Jan 2017 12:57:25 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 24 Jan 2017 12:57:25 +0900    

Click here for diff

Craig Ringer  

M src/test/README

Be sure to release the lock on failure to launch logical replication worker.

commit   : dc82f5a6406dfef21ae1668b1c69a32c8a68c670    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 24 Jan 2017 12:41:09 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 24 Jan 2017 12:41:09 +0900    

Click here for diff

Petr Jelinek  

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

Fix comments in StrategyNotifyBgWriter().

commit   : 73293ebae2e48782804029211622d16ed39952ae    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Tue, 24 Jan 2017 09:39:11 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Tue, 24 Jan 2017 09:39:11 +0900    

Click here for diff

The interface for the function was changed in  
d72731a70450b5e7084991b9caa15cb58a2820df but the comments of the  
function was not updated.  
  
Patch by Yugo Nagata.  

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

Fix parallel make issue with new fmgrprotos.h

commit   : 1a2d9a655a5de1c8c9d479c77d6351b878094606    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 15:36:27 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 15:36:27 -0500    

Click here for diff

The make rules needed further refinement so that we don't run multiple  
generations per build.  
  
reported by Tom Lane  

M src/backend/Makefile
M src/backend/utils/Makefile

Fix default minimum value for descending sequences

commit   : 0bc1207aeb3de951bf95a9e9899b1256216d65f5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 14:00:58 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 14:00:58 -0500    

Click here for diff

For some reason that is lost in history, a descending sequence would  
default its minimum value to -2^63+1 (-PG_INT64_MAX) instead of  
-2^63 (PG_INT64_MIN), even though explicitly specifying a minimum value  
of -2^63 would work.  Fix this inconsistency by using the full range by  
default.  
  
Reported-by: Daniel Verite <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/ref/create_sequence.sgml
M src/backend/commands/sequence.c
M src/bin/pg_dump/pg_dump.c
M src/include/pg_config_manual.h

Don't error when no system locales were found

commit   : 46d482814cd4a9c474540a9c4f040ce1cd514f46    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 13:45:32 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 13:45:32 -0500    

Click here for diff

initdb used to warn about that, but it was changed to an error in  
pg_import_system_locales, but some build farm members failed because of  
that.  Change it back to a warning.  

M src/backend/commands/collationcmds.c

Fix NULL pointer access in logical replication workers

commit   : 70c56a014e1813b5ab0f91581833bc7cb6c02958    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 12:33:27 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 12:33:27 -0500    

Click here for diff

From: Petr Jelinek <[email protected]>  

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

Fix pointer confusion

commit   : 6cffe54aef0a02a52692e32125eb3a5e135e7359    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 11:55:06 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 11:55:06 -0500    

Click here for diff

get_object_address_publication_rel() needed to check *relation, not  
relation.  Rename the variables to match style used nearby to avoid the  
confusion.  

M src/backend/catalog/objectaddress.c

Fix memory leaks in libpqwalreceiver

commit   : 16a61884b5956778cae64a5746f4cdd9ae1ae01b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 11:06:30 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 11:06:30 -0500    

Click here for diff

The results of the libpq functions PQescapeIdentifier() and  
PQescapeLiteral() must be freed explicitly.  Also handle errors in these  
functions better.  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Prefetch blocks during lazy vacuum's truncation scan

commit   : 7e26e02eec90370dd222f35f00042f8188488ac4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 23 Jan 2017 12:55:18 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 23 Jan 2017 12:55:18 -0300    

Click here for diff

Vacuum truncation scan can be sped up on rotating media by prefetching  
blocks in forward direction.  That makes the blocks already present in  
memory by the time they are needed, while also letting OS read-ahead  
kick in.  
  
The truncate scan has been measured to be five times faster than without  
this patch (that was on a slow disk, but it shouldn't hurt on fast  
disks.)  
  
Author: Ɓlvaro Herrera, loosely based on a submission by Claudio Freire  
Discussion: https://postgr.es/m/CAGTBQpa6NFGO_6g_y_7zQx8L9GcHDSQKYdo1tGuh791z6PYgEg@mail.gmail.com  

M src/backend/commands/vacuumlazy.c

Fix example plan in optimizer/README.

commit   : 3c821466abcdb8120ab0dfbce02f3bbae3b62025    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Jan 2017 09:38:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Jan 2017 09:38:36 -0500    

Click here for diff

Joining three tables only takes two join nodes.  I think when I (tgl)  
wrote this, I was envisioning possible additional joins; but since the  
example doesn't show any fourth table, it's just confusing to write  
a third join node.  
  
Etsuro Fujita  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/README

Volatile-ize some plperl variables that must survive into PG_CATCH blocks.

commit   : c0ef456b9714215cae0ce3561c7c83629a7301cf    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Jan 2017 09:15:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Jan 2017 09:15:49 -0500    

Click here for diff

This appears to be necessary to fix a failure seen on buildfarm member  
sittella.  It shouldn't be necessary according to the letter of the C  
standard, because we don't change the values of these variables within  
the PG_TRY blocks; but somehow gcc 4.7.2 is dropping the ball.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plperl/plperl.c

pg_dump: Fix minor memory leak

commit   : 366d2a3d8808ad92436a830c32e73ce17affe5b6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 08:28:39 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 08:28:39 -0500    

Click here for diff

Missing a destroyPQExpBuffer() in the early exit branch.  The early  
exits aren't really necessary.  Most similar functions just proceed  
running the rest of the code zero times and clean up at the end.  

M src/bin/pg_dump/pg_dump.c

Fix typo

commit   : 56549129079465a9d25fd6e5abc1439363922b7c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 08:26:31 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2017 08:26:31 -0500    

Click here for diff

M src/bin/pg_dump/pg_dump.c

Relocate static function declarations to be after typedefs in jsonfuncs.c.

commit   : 90992e0e2f9fc4aa0f6402f0327604e5fef4630c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 22 Jan 2017 14:08:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 22 Jan 2017 14:08:26 -0500    

Click here for diff

Project style is to put things in this order, for the good and sufficient  
reason that you often need the typedefs in the function declarations.  
There already was one function declaration that needed a typedef, which  
was randomly placed away from all the other static function declarations  
in consequence.  And the submitted patch for better json_populate_record  
functionality jumped through even more hoops in order to preserve this  
bad idea.  
  
This patch only moves lines from point A to point B, no other changes.  

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

Remove no-longer-needed loop in ExecGather().

commit   : 0a8b9d3b2c57028f7100078cd711370f396d5a81    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 22 Jan 2017 11:47:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 22 Jan 2017 11:47:38 -0500    

Click here for diff

Coverity complained quite properly that commit ea15e1867 had introduced  
unreachable code into ExecGather(); to wit, it was no longer possible to  
iterate the final for-loop more or less than once.  So remove the for().  
  
In passing, clean up a couple of comments, and make better use of a local  
variable.  

M src/backend/executor/nodeGather.c

Add missing break

commit   : 8f164e1eeaf31438f6706ed45efee607a2c7a21b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 22 Jan 2017 06:40:04 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 22 Jan 2017 06:40:04 -0500    

Click here for diff

M src/backend/catalog/objectaddress.c

Add more includes so header files are self-contained

commit   : b48008676002895c284c9a7a3d4fc7210b58044d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 21 Jan 2017 15:49:53 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 21 Jan 2017 15:49:53 -0500    

Click here for diff

M src/include/catalog/pg_subscription.h
M src/include/commands/publicationcmds.h
M src/include/commands/subscriptioncmds.h
M src/include/replication/pgoutput.h
M src/include/replication/worker_internal.h

Fix cross-shlib linking in temporary installs on HPUX 10.

commit   : d2ab1176160e30543da1e48f7e0d17564852b693    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Jan 2017 15:15:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Jan 2017 15:15:39 -0500    

Click here for diff

Turns out this has been broken for years and we'd not noticed.  The one  
case that was getting exercised in the buildfarm, or probably anywhere  
else, was postgres_fdw.sl's reference to libpq.sl; and it turns out that  
that was always going to libpq.sl in the actual installation directory  
not the temporary install.  We'd not noticed because the buildfarm script  
does "make install" before it tests contrib.  However, the recent addition  
of a logical-replication test to the core regression scripts resulted in  
trying to use libpqwalreceiver.sl before "make install" happens, and that  
failed for lack of finding libpq.sl, as shown by failures on buildfarm  
members gaur and pademelon.  
  
There are two changes needed to fix it: the magic environment variable to  
specify shlib search path at runtime is SHLIB_PATH not LD_LIBRARY_PATH,  
and the shlib link command needs to specify the +s switch else the library  
will not honor SHLIB_PATH.  
  
I'm not quite sure why buildfarm members anole and gharial (HPUX 11) didn't  
show the same failure.  Consulting man pages on the web says that HPUX 11  
honors both LD_LIBRARY_PATH and SHLIB_PATH, which would explain half of it,  
and the rather confusing wording I've been able to find suggests that +s  
might effectively be the default in HPUX 11.  But it seems at least as  
likely that there's just a libpq.so installed in /usr/lib on that machine;  
as long as it's not too ancient, that would satisfy the test.  In any case  
I do not think this patch will break HPUX 11.  
  
At the moment I don't see a need to back-patch this, since it only matters  
for testing purposes, not to mention that HPUX 10 is probably dead in the  
real world anyway.  

M src/Makefile.global.in
M src/Makefile.shlib
M src/bin/pg_upgrade/test.sh

Move some things from builtins.h to new header files

commit   : f21a563d25dbae153937aec062161184189478b8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 20 Jan 2017 20:29:53 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 20 Jan 2017 20:29:53 -0500    

Click here for diff

This avoids that builtins.h has to include additional header files.  

M contrib/bloom/blvalidate.c
M contrib/citext/citext.c
M contrib/dblink/dblink.c
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/rawpage.c
M contrib/pgrowlocks/pgrowlocks.c
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/pgstattuple.c
M contrib/postgres_fdw/option.c
M contrib/tsearch2/tsearch2.c
M contrib/unaccent/unaccent.c
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/spgtextproc.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/extension.c
M src/backend/commands/indexcmds.c
M src/backend/commands/sequence.c
M src/backend/commands/tablespace.c
M src/backend/commands/variable.c
M src/backend/parser/parse_relation.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/wparser.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/regproc.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/tsvector_op.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/rls.c
M src/include/utils/builtins.h
A src/include/utils/regproc.h
A src/include/utils/varlena.h
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_handler.c

Avoid useless respawining the autovacuum launcher at high speed.

commit   : c6a389792e08980e395055ac219303cf4357ba33    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 20 Jan 2017 15:55:45 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 20 Jan 2017 15:55:45 -0500    

Click here for diff

When (1) autovacuum = off and (2) there's at least one database with  
an XID age greater than autovacuum_freeze_max_age and (3) all tables  
in that database that need vacuuming are already being processed by a  
worker and (4) the autovacuum launcher is started, a kind of infinite  
loop occurs.  The launcher starts a worker and immediately exits.  The  
worker, finding no worker to do, immediately starts the launcher,  
supposedly so that the next database can be processed.  But because  
datfrozenxid for that database hasn't been advanced yet, the new  
worker gets put right back into the same database as the old one,  
where it once again starts the launcher and exits.  High-speed ping  
pong ensues.  
  
There are several possible ways to break the cycle; this seems like  
the safest one.  
  
Amit Khandekar (code) and Robert Haas (comments), reviewed by  
Ɓlvaro Herrera.  
  
Discussion: http://postgr.es/m/CAJ3gD9eWejf72HKquKSzax0r+epS=nAbQKNnykkMA0E8c+rMDg@mail.gmail.com  

M src/backend/postmaster/autovacuum.c

Fix comparison logic in partition_bounds_equal for non-finite bounds.

commit   : 6546ffb35db78365d9f0011d75d16625e6040437    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 20 Jan 2017 15:47:31 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 20 Jan 2017 15:47:31 -0500    

Click here for diff

If either bound is infinite, then we shouldn't even try to perform a  
comparison of the values themselves.  Rearrange the logic so that  
we don't.  
  
Per buildfarm member skink and Tom Lane.  

M src/backend/catalog/partition.c

Record dependencies on owners for logical replication objects

commit   : 50cf1c80e6be80cc620749824fe9e3cd7f6c118e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 Jan 2017 16:45:02 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 Jan 2017 16:45:02 -0300    

Click here for diff

This was forgotten in 665d1fad99e7b11678b0d5fa24d2898424243cd6 and  
caused the whole buildfarm to become red for a little while.  
  
Author: Petr JelĆ­nek  
  
Also fix a typo in a nearby error message.  

M src/backend/commands/publicationcmds.c
M src/backend/commands/subscriptioncmds.c

tests: Use the right Perl operator

commit   : a600ee9e3fcc43d4497d18d837f1e86148ca7580    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 Jan 2017 15:03:27 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 Jan 2017 15:03:27 -0300    

Click here for diff

We were using != to compare strings, for which "ne" is the right thing.  
It's not clear why it works everywhere except on Pavan's machine, but  
it's clearly bogus anyway.  
  
Author and reporter: Pavan Deolasee  
Discussion: https://postgr.es/m/CABOikdPhsHM+pX8skoEY1_T0OtKdO1udzUj4VCjU5VEt+bj4eA@mail.gmail.com  

M src/test/modules/commit_ts/t/004_restart.pl

Try to fix non-MSVC Windows builds in the wake of logical replication.

commit   : 0502e854640bd024f349c0df46b7dd6812b8c05c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Jan 2017 12:51:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Jan 2017 12:51:31 -0500    

Click here for diff

pgoutput evidently needs to be built without -DBUILDING_DLL.  (It seems  
like a pretty bad idea that these makefiles need to know exactly where  
all the shlibs are in the tree, or maybe what's bad is putting them under  
src/backend/.  But right now is not the time to redesign that.)  
  
Also, remove "override CPPFLAGS" in pgoutput's Makefile.  I don't think  
that that actually has any bad consequences, but it's certainly useless  
in a directory that has no .h files, and it might be contributing to the  
failure somehow.  
  
Per buildfarm.  

M src/backend/replication/pgoutput/Makefile
M src/makefiles/Makefile.cygwin
M src/makefiles/Makefile.win32

Allow backslash line continuations in pgbench's meta commands.

commit   : cdc2a70470bdbe3663dc464deb753d6d931bba61    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Jan 2017 11:10:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Jan 2017 11:10:02 -0500    

Click here for diff

A pgbench meta command can now be continued onto additional line(s) of a  
script file by writing backslash-return.  The continuation marker is  
equivalent to white space in that it separates tokens.  
  
Eventually it'd be nice to have the same thing in psql, but that will  
be a much larger project.  
  
Fabien Coelho, reviewed by Rafia Sabih  
  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1610031049310.19411@lancre  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/exprscan.l

Add description of temporary column into pg_replication_slots doc.

commit   : 954737095061e5b5f1d87fb8cc43f7f8afff64c6    
  
author   : Fujii Masao <[email protected]>    
date     : Sat, 21 Jan 2017 00:55:36 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sat, 21 Jan 2017 00:55:36 +0900    

Click here for diff

Ayumi Ishii  

M doc/src/sgml/catalogs.sgml

Paper over pg_upgrade test failure

commit   : 6c488ea13634897df5f9b5769eb26bbc3d926ce0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 20 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 20 Jan 2017 12:00:00 -0500    

Click here for diff

The publication test didn't drop all the publications it was creating  
when it was probably intending to do that.  There is still a bug with  
dependency tracking in there, but this should at least quiet down the  
build farm.  

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

Bump catversion

commit   : e4c27f5befbfc80a1bf96fc93256dce08b148238    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 20 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 20 Jan 2017 12:00:00 -0500    

Click here for diff

M src/include/catalog/catversion.h

Logical replication

commit   : 665d1fad99e7b11678b0d5fa24d2898424243cd6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Jan 2017 12:00:00 -0500    

Click here for diff

- Add PUBLICATION catalogs and DDL  
- Add SUBSCRIPTION catalog and DDL  
- Define logical replication protocol and output plugin  
- Add logical replication workers  
  
From: Petr Jelinek <[email protected]>  
Reviewed-by: Steve Singer <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Erik Rijkers <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/func.sgml
A doc/src/sgml/logical-replication.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/allfiles.sgml
A doc/src/sgml/ref/alter_publication.sgml
A doc/src/sgml/ref/alter_subscription.sgml
A doc/src/sgml/ref/create_publication.sgml
A doc/src/sgml/ref/create_subscription.sgml
A doc/src/sgml/ref/drop_publication.sgml
A doc/src/sgml/ref/drop_subscription.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/reference.sgml
M src/Makefile
M src/backend/access/transam/xact.c
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
A src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_shdepend.c
A src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/Makefile
M src/backend/commands/alter.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
A src/backend/commands/publicationcmds.c
A src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/executor/Makefile
M src/backend/executor/execMain.c
A src/backend/executor/execReplication.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/Makefile
A src/backend/replication/logical/launcher.c
A src/backend/replication/logical/proto.c
A src/backend/replication/logical/relation.c
A src/backend/replication/logical/worker.c
A src/backend/replication/pgoutput/Makefile
A src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/walreceiver.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/tcop/utility.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_dump/common.c
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_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/command.c
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/tab-complete.c
M src/include/catalog/dependency.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_proc.h
A src/include/catalog/pg_publication.h
A src/include/catalog/pg_publication_rel.h
A src/include/catalog/pg_subscription.h
M src/include/commands/defrem.h
A src/include/commands/publicationcmds.h
A src/include/commands/subscriptioncmds.h
M src/include/executor/executor.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/pgstat.h
A src/include/replication/logicallauncher.h
A src/include/replication/logicalproto.h
A src/include/replication/logicalrelation.h
A src/include/replication/logicalworker.h
A src/include/replication/pgoutput.h
M src/include/replication/walreceiver.h
A src/include/replication/worker_internal.h
M src/include/storage/sinval.h
M src/include/utils/acl.h
M src/include/utils/inval.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/syscache.h
M src/test/Makefile
M src/test/perl/PostgresNode.pm
A src/test/regress/expected/publication.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out
A src/test/regress/expected/subscription.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/publication.sql
A src/test/regress/sql/subscription.sql
A src/test/subscription/.gitignore
A src/test/subscription/Makefile
A src/test/subscription/README
A src/test/subscription/t/001_rep_changes.pl
A src/test/subscription/t/002_types.pl

Avoid core dump for empty prepared statement in an aborted transaction.

commit   : ba61a04bc7fefeee03416d9911eb825c4897c223    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Jan 2017 19:52:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Jan 2017 19:52:13 -0500    

Click here for diff

Brown-paper-bag bug in commit ab1f0c822: the old code here coped with  
null CachedPlanSource.raw_parse_tree, the new code not so much.  
Per report from Dave Cramer.  
  
No regression test, because our core testing infrastructure doesn't  
provide any easy way to exercise this path.  Fortunately, the JDBC  
crew test it regularly.  
  
Discussion: https://postgr.es/m/CADK3HH+Ug3xCysKqw_dZOnaNnytZ1Rh5yP05hjO-e4NoyRxVvA@mail.gmail.com  

M src/backend/tcop/postgres.c

Fix Assert failure induced by commit 215b43cdc.

commit   : d479e37e3d20efad8b178e0f1e468c086a7519a8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Jan 2017 18:20:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Jan 2017 18:20:48 -0500    

Click here for diff

I'd somehow talked myself into believing that set_append_rel_size  
doesn't need to worry about getting back an AND clause when it applies  
eval_const_expressions to the result of adjust_appendrel_attrs (that is,  
transposing the appendrel parent's restriction clauses for one child).  
But that is nonsense, and Andreas Seltenreich's fuzz tester soon  
turned up a counterexample.  Put back the make_ands_implicit step  
that was there before, and add a regression test covering the case.  
  
Report: https://postgr.es/m/[email protected]  

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

Fix platform dependant regression output triggered by 69f4b9c85f16.

commit   : 182200531a92204b0547d337f50b665d222af168    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 19 Jan 2017 14:21:26 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 19 Jan 2017 14:21:26 -0800    

Click here for diff

Due to the changed costing in that commit hash-aggregates started to  
be used, which results in big-endian vs. little-endian output  
differences.  Disable hash-aggs for those tests.  
  
Author: Andres Freund, with input from Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

Remove obsoleted code relating to targetlist SRF evaluation.

commit   : ea15e18677fc2eff3135023e27f69ed8821554ed    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 19 Jan 2017 14:12:38 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 19 Jan 2017 14:12:38 -0800    

Click here for diff

Since 69f4b9c plain expression evaluation (and thus normal projection)  
can't return sets of tuples anymore. Thus remove code dealing with  
that possibility.  
  
This will require adjustments in external code using  
ExecEvalExpr()/ExecProject() - that should neither be hard nor very  
common.  
  
Author: Andres Freund and Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/catalog/index.c
M src/backend/catalog/partition.c
M src/backend/commands/copy.c
M src/backend/commands/prepare.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/execAmi.c
M src/backend/executor/execQual.c
M src/backend/executor/execScan.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/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/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/predtest.c
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/xml.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/pl/plpgsql/src/pl_exec.c

Fix race condition in reading commit timestamps

commit   : 8eace46d34ab6ac0d887aa4d3504bc4222c2e448    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 19 Jan 2017 18:23:09 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 19 Jan 2017 18:23:09 -0300    

Click here for diff

If a user requests the commit timestamp for a transaction old enough  
that its data is concurrently being truncated away by vacuum at just the  
right time, they would receive an ugly internal file-not-found error  
message from slru.c rather than the expected NULL return value.  
  
In a primary server, the window for the race is very small: the lookup  
has to occur exactly between the two calls by vacuum, and there's not a  
lot that happens between them (mostly just a multixact truncate).  In a  
standby server, however, the window is larger because the truncation is  
executed as soon as the WAL record for it is replayed, but the advance  
of the oldest-Xid is not executed until the next checkpoint record.  
  
To fix in the primary, simply reverse the order of operations in  
vac_truncate_clog.  To fix in the standby, augment the WAL truncation  
record so that the standby is aware of the new oldest-XID value and can  
apply the update immediately.  WAL version bumped because of this.  
  
No backpatch, because of the low importance of the bug and its rarity.  
  
Author: Craig Ringer  
Reviewed-By: Petr JelĆ­nek, Peter Eisentraut  
Discussion: https://postgr.es/m/CAMsr+YFhVtRQT1VAwC+WGbbxZZRzNou=N9Ed-FrCqkwQ8H8oJQ@mail.gmail.com  

M src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/transam/commit_ts.c
M src/backend/commands/vacuum.c
M src/include/access/commit_ts.h
M src/include/access/xlog_internal.h

initdb: Fix for mixed-case superuser names

commit   : 8b0fec93ecc788c8d8b329d41ab795712d8dcc5a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Jan 2017 12:00:00 -0500    

Click here for diff

The previous coding did not properly quote the user name before casting  
it to regrole.  To avoid all that, just pass in BOOTSTRAP_SUPERUSERID  
numerically.  
  
Also fix one place where the BOOTSTRAP_SUPERUSERID was hardcoded as 10.  

M src/bin/initdb/initdb.c

Teach partitioning tests not to use DROP TABLE ... CASCADE.

commit   : c3978149536a9c3fb837524407c58dec2b103c60    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 19 Jan 2017 14:15:40 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 19 Jan 2017 14:15:40 -0500    

Click here for diff

This occasionally causes failures; the order in which the affected  
objects are listed is not 100% consistent.  
  
Amit Langote  

M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql

Avoid some code duplication in map_partition_varattnos().

commit   : cc144155f7cdd51e19984f82da6625dc75de9fda    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 19 Jan 2017 14:13:15 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 19 Jan 2017 14:13:15 -0500    

Click here for diff

Code to map attribute numbers in map_partition_varattnos() duplicates  
what convert_tuples_by_name_map() does.  Avoid that.  
  
Amit Langote, per a report from Ɓlvaro Herrera.  
  
Discussion: http://postgr.es/m/9ce97382-54c8-deb3-9ee9-a2ec271d866b%40lab.ntt.co.jp  

M src/backend/catalog/partition.c

Fix some problems in check_new_partition_bound().

commit   : 8a8afe2f54c27dbb47df3853803158c5205d41ce    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 19 Jan 2017 13:56:13 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 19 Jan 2017 13:56:13 -0500    

Click here for diff

Account for the fact that the highest bound less than or equal to the  
upper bound might be either the lower or the upper bound of the  
overlapping partition, depending on whether the proposed partition  
completely contains the existing partition or merely overlaps it.  
  
Also, we need not continue searching for even greater bound in  
partition_bound_bsearch() once we find the first bound that is *equal*  
to the probe, because we don't have duplicate datums.  That spends  
cycles needlessly.  
  
Amit Langote, per a report from Amul Sul.  Cosmetic changes by me.  
  
Discussion: http://postgr.es/m/CAAJ_b94XgbqVoXMyxxs63CaqWoMS1o2gpHiU0F7yGnJBnvDc_A%40mail.gmail.com  

M src/backend/catalog/partition.c
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Fix RETURNING to work correctly with partition tuple routing.

commit   : 05bd889904e03479a7169b1c36e0e1db13fff7cb    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 19 Jan 2017 13:20:11 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 19 Jan 2017 13:20:11 -0500    

Click here for diff

In ExecInsert(), do not switch back to the root partitioned table  
ResultRelInfo until after we finish ExecProcessReturning(), so that  
RETURNING projection is done using the partition's descriptor.  For  
the projection to work correctly, we must initialize the same for each  
leaf partition during ModifyTableState initialization.  
  
Amit Langote  

M src/backend/catalog/partition.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execMain.c
M src/backend/executor/nodeModifyTable.c
M src/include/catalog/partition.h
M src/test/regress/expected/insert.out
M src/test/regress/sql/insert.sql

Fix failure to enforce partitioning contraint for internal partitions.

commit   : 39162b2030fb0a35a6bb28dc636b5a71b8df8d1c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 19 Jan 2017 12:30:27 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 19 Jan 2017 12:30:27 -0500    

Click here for diff

When a tuple is inherited into a partitioning root, no partition  
constraints need to be enforced; when it is inserted into a leaf, the  
parent's partitioning quals needed to be enforced.  The previous  
coding got both of those cases right.  When a tuple is inserted into  
an intermediate level of the partitioning hierarchy (i.e. a table  
which is both a partition itself and in turn partitioned), it must  
enforce the partitioning qual inherited from its parent.  That case  
got overlooked; repair.  
  
Amit Langote  

M src/backend/commands/copy.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execMain.c
M src/include/executor/executor.h
M src/test/regress/expected/insert.out
M src/test/regress/sql/insert.sql

Dump sequence data based on the TableDataInfo flag

commit   : bec96c82f8ff4fcf7ef0f070f6f7447edf106de3    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 19 Jan 2017 12:06:21 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 19 Jan 2017 12:06:21 -0500    

Click here for diff

When considering a sequence's Data entry in dumpSequenceData, we were  
actually looking at the sequence definition's dump flag to decide if we  
should dump the data or not.  That's generally fine, except for when the  
sequence data entry was created by processExtensionTables() because it's  
a config sequence.  In that case, the sequence itself won't be marked as  
dumping data because it's part of an extension, leading to the need for  
processExtensionTables() to create the sequence data entry.  
  
This leads to extension config sequence data not being included in the  
dump when it should be.  Fix this by looking at the sequence data's dump  
flag instead, just as dumpTableData() was doing for tables (which is why  
config tables were correctly being handled), and add a regression test  
to make sure we don't break it moving forward.  
  
All of this is a bit round-about since we can now represent which  
components of a given dump item should be dumped out through the dump  
flag.  A future improvement might be to change checkExtensionMembership()  
to check for config sequences/tables and set the dump flag based on that  
directly, possibly removing the need for processExtensionTables().  
  
Bug found by Daniele Varrazzo.  
  
Discussion: https://postgr.es/m/CA+mi_8ZmxQM7+nZ7pJ8uyfxc9V3o=UAG14dVqvftdmvw8OJ3gQ@mail.gmail.com  
  
Patch by Michael Paquier, with some tweaking of the regression tests by  
me.  
  
Back-patch to 9.6 where the bug was introduced.  

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

Allow negative years in make_date to represent BC years

commit   : 30bcebbdcf23eb8b78e553c4b3b5eb847410ef19    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 19 Jan 2017 09:45:38 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 19 Jan 2017 09:45:38 -0300    

Click here for diff

There doesn't seem to be any reason not to allow negative years to be  
interpreted as BC, so do that.  
  
The documentation is pretty vague on the details of this function, so  
nothing needs to change there.  
  
Reported-by: Andy Abelisto, in bug #14446  

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

Adapt python regression tests to 69f4b9c85f16.

commit   : 8b07aee8c5d803801c00103f0d61e32356aaf29c    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 18 Jan 2017 16:11:19 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 18 Jan 2017 16:11:19 -0800    

Click here for diff

Hopefully this'll unbreak the buildfarm.  

M src/pl/plpython/expected/plpython_setof.out

Doc: improve documentation of new SRF-in-tlist behavior.

commit   : f13a1277aa2df301583c6db9c2989d2e9d7f6483    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2017 18:10:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2017 18:10:23 -0500    

Click here for diff

Correct a misstatement about how things used to work: we did allow nested  
SRFs before, as long as no function had more than one set-returning input.  
  
Also, attempt to document the fact that the new implementation changes the  
behavior for SRFs within conditional constructs (eg CASE): the conditional  
construct no longer gates whether the SRF is run, and thus cannot affect  
the number of rows emitted.  We might want to change this behavior, but  
first it behooves us to see if we can explain it.  
  
Minor other wordsmithing on what I wrote yesterday, too.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/xfunc.sgml

Move targetlist SRF handling from expression evaluation to new executor node.

commit   : 69f4b9c85f168ae006929eec44fc44d569e846b9    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 18 Jan 2017 12:46:50 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 18 Jan 2017 12:46:50 -0800    

Click here for diff

Evaluation of set returning functions (SRFs_ in the targetlist (like SELECT  
generate_series(1,5)) so far was done in the expression evaluation (i.e.  
ExecEvalExpr()) and projection (i.e. ExecProject/ExecTargetList) code.  
  
This meant that most executor nodes performing projection, and most  
expression evaluation functions, had to deal with the possibility that an  
evaluated expression could return a set of return values.  
  
That's bad because it leads to repeated code in a lot of places. It also,  
and that's my (Andres's) motivation, made it a lot harder to implement a  
more efficient way of doing expression evaluation.  
  
To fix this, introduce a new executor node (ProjectSet) that can evaluate  
targetlists containing one or more SRFs. To avoid the complexity of the old  
way of handling nested expressions returning sets (e.g. having to pass up  
ExprDoneCond, and dealing with arguments to functions returning sets etc.),  
those SRFs can only be at the top level of the node's targetlist.  The  
planner makes sure (via split_pathtarget_at_srfs()) that SRF evaluation is  
only necessary in ProjectSet nodes and that SRFs are only present at the  
top level of the node's targetlist. If there are nested SRFs the planner  
creates multiple stacked ProjectSet nodes.  The ProjectSet nodes always get  
input from an underlying node.  
  
We also discussed and prototyped evaluating targetlist SRFs using ROWS  
FROM(), but that turned out to be more complicated than we'd hoped.  
  
While moving SRF evaluation to ProjectSet would allow to retain the old  
"least common multiple" behavior when multiple SRFs are present in one  
targetlist (i.e.  continue returning rows until all SRFs are at the end of  
their input at the same time), we decided to instead only return rows till  
all SRFs are exhausted, returning NULL for already exhausted ones.  We  
deemed the previous behavior to be too confusing, unexpected and actually  
not particularly useful.  
  
As a side effect, the previously prohibited case of multiple set returning  
arguments to a function, is now allowed. Not because it's particularly  
desirable, but because it ends up working and there seems to be no argument  
for adding code to prohibit it.  
  
Currently the behavior for COALESCE and CASE containing SRFs has changed,  
returning multiple rows from the expression, even when the SRF containing  
"arm" of the expression is not evaluated. That's because the SRFs are  
evaluated in a separate ProjectSet node.  As that's quite confusing, we're  
likely to instead prohibit SRFs in those places.  But that's still being  
discussed, and the code would reside in places not touched here, so that's  
a task for later.  
  
There's a lot of, now superfluous, code dealing with set return expressions  
around. But as the changes to get rid of those are verbose largely boring,  
it seems better for readability to keep the cleanup as a separate commit.  
  
Author: Tom Lane and Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/xfunc.sgml
M src/backend/commands/explain.c
M src/backend/executor/Makefile
M src/backend/executor/execAmi.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execQual.c
A src/backend/executor/nodeProjectSet.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/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/tlist.c
M src/include/executor/executor.h
A src/include/executor/nodeProjectSet.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/clauses.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/tlist.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/limit.out
M src/test/regress/expected/portals.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/expected/subselect.out
M src/test/regress/expected/tsrf.out
M src/test/regress/expected/union.out

Improve comment in hashsearch.c.

commit   : e37360d5df240443bb6e997d26d54f59146283fc    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 18 Jan 2017 16:36:48 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 18 Jan 2017 16:36:48 -0500    

Click here for diff

Typo fix from Mithun Cy; other improvements by me.  

M src/backend/access/hash/hashsearch.c

Reset the proper GUC in create_index test.

commit   : 1586317c3f57e619e0cde674c6da406f9d73aaff    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2017 16:33:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2017 16:33:18 -0500    

Click here for diff

Thinko in commit a4523c5aa.  It doesn't really affect anything at  
present, but it would be a problem if any tests added later in this  
file ought to get index-only-scan plans.  Back-patch, like the previous  
commit, just to avoid surprises in case we add such a test and then  
back-patch it.  
  
Nikita Glukhov  
  
Discussion: https://postgr.es/m/[email protected]  

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

Change some test macros to return true booleans

commit   : 594e61a1de03ab93779e7e3d853edb7859d5c3cf    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 Jan 2017 18:06:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 Jan 2017 18:06:13 -0300    

Click here for diff

These macros work fine when they are used directly in an "if" test or  
similar, but as soon as the return values are assigned to boolean  
variables (or passed as boolean arguments to some function), they become  
bugs, hopefully caught by compiler warnings.  To avoid future problems,  
fix the definitions so that they return actual booleans.  
  
To further minimize the risk that somebody uses them in back-patched  
fixes that only work correctly in branches starting from the current  
master and not in old ones, back-patch the change to supported branches  
as appropriate.  
  
See also commit af4472bcb88ab36b9abbe7fd5858e570a65a2d1a, and the long  
discussion (and larger patch) in the thread mentioned in its commit  
message.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/htup_details.h

Implement array version of jsonb_delete and operator

commit   : d00ca333c338b40911e89939c3cc771025978595    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 18 Jan 2017 21:37:59 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 18 Jan 2017 21:37:59 +0100    

Click here for diff

This makes it possible to delete multiple keys from a jsonb value by  
passing in an array of text values, which makes the operaiton much  
faster than individually deleting the keys (which would require copying  
the jsonb structure over and over again.  
  
Reviewed by Dmitry Dolgov and Michael Paquier  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/jsonfuncs.c
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/jsonb.sql

Disable transforms that replaced AT TIME ZONE with RelabelType.

commit   : c22ecc6562aac895f0f0529707d7bdb460fd2a49    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2017 15:21:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2017 15:21:52 -0500    

Click here for diff

These resulted in wrong answers if the relabeled argument could be matched  
to an index column, as shown in bug #14504 from Evgeniy Kozlov.  We might  
be able to resurrect these optimizations by adjusting the planner's  
treatment of RelabelType, or by adjusting btree's rules for selecting  
comparison functions, but either solution will take careful analysis  
and does not sound like a fit candidate for backpatching.  
  
I left the catalog infrastructure in place and just reduced the transform  
functions to always-return-NULL.  This would be necessary anyway in the  
back branches, and it doesn't seem important to be more invasive in HEAD.  
  
Bug introduced by commit b8a18ad48.  Back-patch to 9.5 where that came in.  
  
Report: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid use of DROP TABLE .. CASCADE in partitioning tests.

commit   : e509e7f9e3c565043e1186f5a83122d71653d111    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 18 Jan 2017 14:56:15 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 18 Jan 2017 14:56:15 -0500    

Click here for diff

This isn't really guaranteed to always produce exactly the same  
output; the order can change from run to run.  
  
See related cleanup in 257d8157205a7be5f9799e8941b922521d678a25.  

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

Add some more tests for tuple routing.

commit   : d26fa4fd47ae5f09c214e954ae9cf8a890bd3c35    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 18 Jan 2017 14:43:14 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 18 Jan 2017 14:43:14 -0500    

Click here for diff

Commit a25665088d812d08bb888e961f208eaebf522050 fixed some issues with  
how PartitionDispatch related code handled multi-level partitioned  
tables, but didn't add any tests.  
  
Discussion: http://postgr.es/m/CA%2BTgmoZ86v1G%2Bzx9etMiSQaBBvYMKfU-iitqZArSh5z0n8Q4cA%40mail.gmail.com  
  
Amit Langote, per a complaint from me.  

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

Update information_schema queries and system views for new relkind.

commit   : 262e821deced47337d6d807515997567bb45fd7d    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 18 Jan 2017 14:03:48 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 18 Jan 2017 14:03:48 -0500    

Click here for diff

The original table partitioning patch overlooked this.  
  
Discussion: http://postgr.es/m/CAG1_KcDJiZB=L6yOUO_bVufj2q2851_xdkfhw0JdcD_2VtKssw@mail.gmail.com  
  
Keith Fiske and Amit Langote, adjusted by me.  

M src/backend/catalog/information_schema.sql
M src/backend/catalog/system_views.sql
M src/test/regress/expected/rules.out

Make messages mentioning type names more uniform

commit   : 9a34123bc315e55b33038464422ef1cd2b67dab2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 Jan 2017 16:08:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 Jan 2017 16:08:20 -0300    

Click here for diff

This avoids additional translatable strings for each distinct type, as  
well as making our quoting style around type names more consistent  
(namely, that we don't quote type names).  This continues what started  
as f402b9950120.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/hstore_plperl/expected/create_transform.out
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/commands/functioncmds.c
M src/backend/commands/proclang.c
M src/backend/commands/trigger.c
M src/backend/parser/parse_coerce.c
M src/backend/utils/adt/bool.c
M src/backend/utils/adt/cash.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/nabstime.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/pg_lsn.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/txid.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varlena.c
M src/test/regress/expected/rangefuncs.out
M src/test/regress/expected/uuid.out

Factor out logic for computing number of parallel workers.

commit   : 716c7d4b242f0a64ad8ac4dc48c6fed6557ba12c    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 18 Jan 2017 13:50:35 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 18 Jan 2017 13:50:35 -0500    

Click here for diff

Forthcoming patches to allow other types of parallel scans will  
need this logic, or something like it.  
  
Dilip Kumar  

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

Avoid conflicts with collation aliases generated by stripping.

commit   : 0333a7340054c3356940759b1ab2391eed572171    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2017 13:44:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2017 13:44:19 -0500    

Click here for diff

This resulted in failures depending on the order of "locale -a" output.  
The original coding in initdb sorted the results, but that should be  
unnecessary as long as "locale -a" doesn't print duplicate names.  The  
original entries will then all be non-dups, and while we might generate  
duplicate aliases by stripping, they should be for different encodings and  
thus not conflict.  Even if the latter assumption fails somehow, it won't  
be fatal because we're using if_not_exists mode for the aliases.  
  
Discussion: https://postgr.es/m/26116.1484751196%40sss.pgh.pa.us  

M src/backend/commands/collationcmds.c

Improve RLS planning by marking individual quals with security levels.

commit   : 215b43cdc8d6b4a1700886a39df1ee735cb0274d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2017 12:58:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2017 12:58:20 -0500    

Click here for diff

In an RLS query, we must ensure that security filter quals are evaluated  
before ordinary query quals, in case the latter contain "leaky" functions  
that could expose the contents of sensitive rows.  The original  
implementation of RLS planning ensured this by pushing the scan of a  
secured table into a sub-query that it marked as a security-barrier view.  
Unfortunately this results in very inefficient plans in many cases, because  
the sub-query cannot be flattened and gets planned independently of the  
rest of the query.  
  
To fix, drop the use of sub-queries to enforce RLS qual order, and instead  
mark each qual (RestrictInfo) with a security_level field establishing its  
priority for evaluation.  Quals must be evaluated in security_level order,  
except that "leakproof" quals can be allowed to go ahead of quals of lower  
security_level, if it's helpful to do so.  This has to be enforced within  
the ordering of any one list of quals to be evaluated at a table scan node,  
and we also have to ensure that quals are not chosen for early evaluation  
(i.e., use as an index qual or TID scan qual) if they're not allowed to go  
ahead of other quals at the scan node.  
  
This is sufficient to fix the problem for RLS quals, since we only support  
RLS policies on simple tables and thus RLS quals will always exist at the  
table scan level only.  Eventually these qual ordering rules should be  
enforced for join quals as well, which would permit improving planning for  
explicit security-barrier views; but that's a task for another patch.  
  
Note that FDWs would need to be aware of these rules --- and not, for  
example, send an insecure qual for remote execution --- but since we do  
not yet allow RLS policies on foreign tables, the case doesn't arise.  
This will need to be addressed before we can allow such policies.  
  
Patch by me, reviewed by Stephen Frost and Dean Rasheed.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/README
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/tidpath.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/Makefile
M src/backend/optimizer/prep/prepjointree.c
D src/backend/optimizer/prep/prepsecurity.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/include/nodes/relation.h
M src/include/optimizer/planmain.h
M src/include/optimizer/prep.h
M src/include/optimizer/restrictinfo.h
M src/test/modules/test_rls_hooks/expected/test_rls_hooks.out
M src/test/regress/expected/equivclass.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/equivclass.sql
M src/test/regress/sql/updatable_views.sql

Add function to import operating system collations

commit   : aa17c06fb58533d09c79c68a4d34a6f56687ee38    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 18 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 18 Jan 2017 12:00:00 -0500    

Click here for diff

Move this logic out of initdb into a user-callable function.  This  
simplifies the code and makes it possible to update the standard  
collations later on if additional operating system collations appear.  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Euler Taveira <[email protected]>  

M doc/src/sgml/charset.sgml
M doc/src/sgml/func.sgml
M src/backend/catalog/pg_collation.c
M src/backend/commands/collationcmds.c
M src/bin/initdb/initdb.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_collation_fn.h
M src/include/catalog/pg_proc.h

Remove dead code in bootstrap

commit   : 193a7d791ebe2adf32b36d5538e4602a90c3e0fb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 17 Jan 2017 16:54:40 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 17 Jan 2017 16:54:40 -0300    

Click here for diff

The bootstrap scanner/parser contains code to parse floating point  
values, but this is not exercised anywhere, so remove it.  
  
Reviewed-by: Jim Nasby  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l

Fix typo

commit   : 593c75d5c38a47096f11e318cdb3321a5780753f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 17 Jan 2017 16:49:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 17 Jan 2017 16:49:20 -0300    

Click here for diff

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

Fix typo

commit   : dda7c34555ca3696fd2a8b93d9aabad333c6cb4e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 17 Jan 2017 16:33:10 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 17 Jan 2017 16:33:10 -0300    

Click here for diff

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

Correct include file path

commit   : 063ef8308b148e3581ddb626fdb397f7a5a48303    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 17 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 17 Jan 2017 12:00:00 -0500    

Click here for diff

Mistake in 352a24a1f9d6f7d4abb1175bfd22acc358f43140, not clear why it  
worked for some before.  

M src/include/utils/builtins.h

Generate fmgr prototypes automatically

commit   : 352a24a1f9d6f7d4abb1175bfd22acc358f43140    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2016 12:00:00 -0500    

Click here for diff

Gen_fmgrtab.pl creates a new file fmgrprotos.h, which contains  
prototypes for all functions registered in pg_proc.h.  This avoids  
having to manually maintain these prototypes across a random variety of  
header files.  It also automatically enforces a correct function  
signature, and since there are warnings about missing prototypes, it  
will detect functions that are defined but not registered in  
pg_proc.h (or otherwise used).  
  
Reviewed-by: Pavel Stehule <[email protected]>  

M contrib/btree_gist/btree_bit.c
M contrib/btree_gist/btree_bytea.c
M contrib/btree_gist/btree_date.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_time.c
M contrib/intarray/_int_selfuncs.c
M contrib/lo/lo.c
M contrib/spi/moddatetime.c
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/gin/ginfast.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/index/amapi.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/namespace.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/define.c
M src/backend/executor/nodeSamplescan.c
M src/backend/foreign/foreign.c
M src/backend/storage/smgr/smgrtype.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/ts_selfuncs.c
M src/backend/utils/.gitignore
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/Makefile
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/geo_selfuncs.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/varbit.c
M src/include/Makefile
M src/include/access/amapi.h
M src/include/access/brin.h
M src/include/access/gin_private.h
M src/include/access/gist_private.h
M src/include/access/hash.h
M src/include/access/nbtree.h
M src/include/access/spgist.h
D src/include/access/xlog_fn.h
M src/include/catalog/pg_proc.h
M src/include/commands/async.h
M src/include/commands/sequence.h
M src/include/commands/trigger.h
M src/include/libpq/be-fsstubs.h
M src/include/replication/logicalfuncs.h
M src/include/replication/origin.h
M src/include/replication/slot.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/storage/smgr.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/.gitignore
M src/include/utils/acl.h
M src/include/utils/array.h
M src/include/utils/ascii.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h
M src/include/utils/cash.h
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/include/utils/formatting.h
M src/include/utils/geo_decls.h
M src/include/utils/inet.h
M src/include/utils/int8.h
M src/include/utils/json.h
M src/include/utils/jsonb.h
M src/include/utils/nabstime.h
M src/include/utils/pg_lsn.h
M src/include/utils/rangetypes.h
M src/include/utils/selfuncs.h
M src/include/utils/snapmgr.h
M src/include/utils/timestamp.h
M src/include/utils/varbit.h
M src/include/utils/xml.h
M src/tools/msvc/Solution.pm
M src/tools/msvc/clean.bat

Register missing money operators in system catalogs

commit   : 323b96aa34239b5a8fe773d614a6ee50d731a683    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2016 12:00:00 -0500    

Click here for diff

The operators money*int8, int8*money, and money/int8 were implemented in  
code but not registered in pg_operator or pg_proc.  
  
Reviewed-by: Pavel Stehule <[email protected]>  

M src/include/catalog/catversion.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/money.out
M src/test/regress/sql/money.sql

Add more tests for money type

commit   : 09e35315ccafb83c52da2e0fd6a0a9be410ce6a4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jan 2017 12:00:00 -0500    

Click here for diff

Add tests for functions currently not covered at all.  
  
Reviewed-by: Pavel Stehule <[email protected]>  

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

Rename C symbols for backend lo_ functions

commit   : 6fc547960dbe0b8bd6cefae5ab7ec3605a5c46fc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 27 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 27 Dec 2016 12:00:00 -0500    

Click here for diff

Rename the C symbols for lo_* to be_lo_*, so they don't conflict with  
libpq prototypes.  
  
Reviewed-by: Pavel Stehule <[email protected]>  

M contrib/lo/lo.c
M src/backend/libpq/be-fsstubs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/libpq/be-fsstubs.h

Remove unnecessary include

commit   : 30b9a4495a8ec1f20ba518b34d679c700eadab16    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Nov 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Nov 2016 12:00:00 -0500    

Click here for diff

Between 6eeb95f0f56bb5e8a0a9328aeec04c9e6de87272 and  
7b1c2a0f2066672b24f6257ec9b8d78a1754f494, builtins.h contained  
additional prototypes that have now been moved elsewhere, so we don't  
need to include nodes/parsenodes.h anymore.  
  
Fix some files that were relying on builtins.h implicitly pulling in  
some unrelated stuff they needed.  
  
Reviewed-by: Pavel Stehule <[email protected]>  

M src/backend/catalog/pg_enum.c
M src/backend/utils/adt/oid.c
M src/include/utils/builtins.h

Remove unnecessary prototypes in loadable modules

commit   : 5d7c9c906a0b888dcfd3b0a2f2170e1f5ca366c4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jan 2017 12:00:00 -0500    

Click here for diff

Reviewed-by: Pavel Stehule <[email protected]>  

M contrib/intarray/_int_selfuncs.c
M contrib/sepgsql/sepgsql.h

doc: Update URL for Microsoft download site

commit   : 6181c34da882544c4842e7442189a7ea1dd03032    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 17 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 17 Jan 2017 12:00:00 -0500    

Click here for diff

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

Add compression support to pg_receivexlog

commit   : cada1af31d769a6b607018d68894f2c879ff275f    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 17 Jan 2017 12:10:26 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 17 Jan 2017 12:10:26 +0100    

Click here for diff

Author: Michael Paquier, review and small changes by me  

M doc/src/sgml/ref/pg_receivexlog.sgml
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h

commit   : 974ece58bbb3c0ef185a9d44b1cedae51cd56b04    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 17 Jan 2017 17:27:32 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 17 Jan 2017 17:27:32 +0900    

Click here for diff

Previously multiple sessions could execute pg_start_backup() and  
pg_stop_backup() to start and stop an exclusive backup at the same time.  
This could trigger the assertion failure of  
"FailedAssertion("!(XLogCtl->Insert.exclusiveBackup)".  
This happend because, even while pg_start_backup() was starting  
an exclusive backup, other session could run pg_stop_backup()  
concurrently and mark the backup as not-in-progress unconditionally.  
  
This patch introduces ExclusiveBackupState indicating the state of  
an exclusive backup. This state is used to ensure that there is only  
one session running pg_start_backup() or pg_stop_backup() at  
the same time, to avoid the assertion failure.  
  
Back-patch to all supported versions.  
  
Author: Michael Paquier  
Reviewed-By: Kyotaro Horiguchi and me  
Reported-By: Andreas Seltenreich  
Discussion: <[email protected]>  

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

Fix check_srf_call_placement() to handle VALUES cases correctly.

commit   : d43a619c60405ecda275ca9e3ac9ead242e20ecb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Jan 2017 15:23:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Jan 2017 15:23:11 -0500    

Click here for diff

INSERT ... VALUES with a single VALUES row is implemented quite differently  
from the general VALUES case.  A user-visible implication of that is that  
we accept SRFs in the single-row case, but not in the multi-row case.  
That's a historical artifact no doubt, but in view of the lack of field  
complaints, I'm not excited about fixing it right now.  
  
However, check_srf_call_placement() needs to know about this, first because  
it should throw an error in the unsupported case, and second because it  
should set p_hasTargetSRFs in the single-row case (because we treat that  
like a SELECT tlist).  That's an oversight in commit a4c35ea1c.  
  
To fix, split EXPR_KIND_VALUES into two values.  So far as I can see,  
this is the only place where we need to distinguish the two cases at  
present; but there might be more later.  
  
Patch by me, per report from Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/analyze.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/include/parser/parse_node.h
M src/test/regress/expected/tsrf.out

Fix NULL pointer dereference in tuplesort.c.

commit   : 4e46c97fde42fa8ca57d29b9b47f2ebd11ab8105    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Jan 2017 13:53:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Jan 2017 13:53:40 -0500    

Click here for diff

Oversight in commit e94568ecc.  This could cause a crash when an external  
datum tuplesort of a pass-by-value type required multiple passes.  
Per report from Mithun Cy.  
  
Peter Geoghegan  
  
Discussion: https://postgr.es/m/CAD__OujuhfWFULGFSt1fyHqUb8N-XafjJhudwt88V0Qs2o84qg@mail.gmail.com  

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

Fix incorrect comparison due to bad merge

commit   : fcf708623e860b7a1efef11a5d5661900307b6fc    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 16 Jan 2017 18:20:57 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 16 Jan 2017 18:20:57 +0100    

Click here for diff

Noted by Fujii Masao  

M src/bin/pg_basebackup/pg_basebackup.c

Make pg_basebackup use temporary replication slots

commit   : e7b020f786bf3b344f81d70aa423525fd4f44dfa    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 16 Jan 2017 13:56:43 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 16 Jan 2017 13:56:43 +0100    

Click here for diff

Temporary replication slots will be used by default when wal streaming  
is used and no slot name is specified with -S. If a slot name is  
specified, then a permanent slot with that name is used. If --no-slot is  
specified, then no permanent or temporary slot will be used.  
  
Temporary slots are only used on 10.0 and newer, of course.  

M doc/src/sgml/ref/pg_basebackup.sgml
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_basebackup/t/010_pg_basebackup.pl

Fix typos in comments.

commit   : 8fa6019b405f9d39539a77c6f5f11fe640ddf955    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 16 Jan 2017 18:55:34 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 16 Jan 2017 18:55:34 +0900    

Click here for diff

Masahiko Sawada  

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

Fix matching of boolean index columns to sort ordering.

commit   : 0777f7a2e8e0a51f0f60cfe164d538bb459bf9f2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Jan 2017 14:09:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Jan 2017 14:09:35 -0500    

Click here for diff

Normally, if we have a WHERE clause like "indexcol = constant",  
the planner will figure out that that index column can be ignored  
when determining whether the index has a desired sort ordering.  
But this failed to work for boolean index columns, because a  
condition like "boolcol = true" is canonicalized to just "boolcol"  
which does not give rise to an EquivalenceClass.  Add a check to  
allow the same type of deduction to be made in this case too.  
  
Per a complaint from Dima Pavlov.  Arguably this is a bug, but given the  
limited impact and the small number of complaints so far, I won't risk  
destabilizing plans in stable branches by back-patching.  
  
Patch by me, reviewed by Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/pathkeys.c
M src/include/optimizer/paths.h
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Teach contrib/pg_stat_statements to handle multi-statement commands better.

commit   : 83f2061dd037477ec8479ee160367840e203a722    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Jan 2017 16:17:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Jan 2017 16:17:30 -0500    

Click here for diff

Make use of the statement boundary info added by commit ab1f0c822  
to let pg_stat_statements behave more sanely when multiple SQL queries  
are jammed into one query string.  It now records just the relevant  
part of the source string, not the whole thing, for each individual  
query.  
  
Even when no multi-statement strings are involved, users may notice small  
changes in the output: leading and trailing whitespace and semicolons will  
be stripped from statements, which did not happen before.  
  
Also, significantly expand pg_stat_statements' regression test script.  
  
Fabien Coelho, reviewed by Craig Ringer and Kyotaro Horiguchi,  
some mods by me  
  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1612200926310.29821@lancre  

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

Change representation of statement lists, and add statement location info.

commit   : ab1f0c8225714aaa18d2f9ca4f80cd009f145421    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Jan 2017 16:02:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Jan 2017 16:02:35 -0500    

Click here for diff

This patch makes several changes that improve the consistency of  
representation of lists of statements.  It's always been the case  
that the output of parse analysis is a list of Query nodes, whatever  
the types of the individual statements in the list.  This patch brings  
similar consistency to the outputs of raw parsing and planning steps:  
  
* The output of raw parsing is now always a list of RawStmt nodes;  
the statement-type-dependent nodes are one level down from that.  
  
* The output of pg_plan_queries() is now always a list of PlannedStmt  
nodes, even for utility statements.  In the case of a utility statement,  
"planning" just consists of wrapping a CMD_UTILITY PlannedStmt around  
the utility node.  This list representation is now used in Portal and  
CachedPlan plan lists, replacing the former convention of intermixing  
PlannedStmts with bare utility-statement nodes.  
  
Now, every list of statements has a consistent head-node type depending  
on how far along it is in processing.  This allows changing many places  
that formerly used generic "Node *" pointers to use a more specific  
pointer type, thus reducing the number of IsA() tests and casts needed,  
as well as improving code clarity.  
  
Also, the post-parse-analysis representation of DECLARE CURSOR is changed  
so that it looks more like EXPLAIN, PREPARE, etc.  That is, the contained  
SELECT remains a child of the DeclareCursorStmt rather than getting flipped  
around to be the other way.  It's now true for both Query and PlannedStmt  
that utilityStmt is non-null if and only if commandType is CMD_UTILITY.  
That allows simplifying a lot of places that were testing both fields.  
(I think some of those were just defensive programming, but in many places,  
it was actually necessary to avoid confusing DECLARE CURSOR with SELECT.)  
  
Because PlannedStmt carries a canSetTag field, we're also able to get rid  
of some ad-hoc rules about how to reconstruct canSetTag for a bare utility  
statement; specifically, the assumption that a utility is canSetTag if and  
only if it's the only one in its list.  While I see no near-term need for  
relaxing that restriction, it's nice to get rid of the ad-hocery.  
  
The API of ProcessUtility() is changed so that what it's passed is the  
wrapper PlannedStmt not just the bare utility statement.  This will affect  
all users of ProcessUtility_hook, but the changes are pretty trivial; see  
the affected contrib modules for examples of the minimum change needed.  
(Most compilers should give pointer-type-mismatch warnings for uncorrected  
code.)  
  
There's also a change in the API of ExplainOneQuery_hook, to pass through  
cursorOptions instead of expecting hook functions to know what to pick.  
This is needed because of the DECLARE CURSOR changes, but really should  
have been done in 9.6; it's unlikely that any extant hook functions  
know about using CURSOR_OPT_PARALLEL_OK.  
  
Finally, teach gram.y to save statement boundary locations in RawStmt  
nodes, and pass those through to Query and PlannedStmt nodes.  This allows  
more intelligent handling of cases where a source query string contains  
multiple statements.  This patch doesn't actually do anything with the  
information, but a follow-on patch will.  (Passing this information through  
cleanly is the true motivation for these changes; while I think this is all  
good cleanup, it's unlikely we'd have bothered without this end goal.)  
  
catversion bump because addition of location fields to struct Query  
affects stored rules.  
  
This patch is by me, but it owes a good deal to Fabien Coelho who did  
a lot of preliminary work on the problem, and also reviewed the patch.  
  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1612200926310.29821@lancre  

M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/sepgsql/hooks.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/schemacmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/view.c
M src/backend/executor/execParallel.c
M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_type.c
M src/backend/parser/parser.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/mmgr/portalmem.c
M src/include/catalog/catversion.h
M src/include/commands/copy.h
M src/include/commands/explain.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h
M src/include/commands/schemacmds.h
M src/include/commands/view.h
M src/include/executor/execdesc.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/parser/analyze.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/pl/plpgsql/src/pl_exec.c

Throw suitable error for COPY TO STDOUT/FROM STDIN in a SQL function.

commit   : 75abb955dfef064f2fbc5c043f37fff8d0262ffe    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Jan 2017 13:27:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Jan 2017 13:27:47 -0500    

Click here for diff

A client copy can't work inside a function because the FE/BE wire protocol  
doesn't support nesting of a COPY operation within query results.  (Maybe  
it could, but the protocol spec doesn't suggest that clients should support  
this, and libpq for one certainly doesn't.)  
  
In most PLs, this prohibition is enforced by spi.c, but SQL functions don't  
use SPI.  A comparison of _SPI_execute_plan() and init_execution_state()  
shows that rejecting client COPY is the only discrepancy in what they  
allow, so there's no other similar bugs.  
  
This is an astonishingly ancient oversight, so back-patch to all supported  
branches.  
  
Report: https://postgr.es/m/BY2PR05MB2309EABA3DEFA0143F50F0D593780@BY2PR05MB2309.namprd05.prod.outlook.com  

M src/backend/executor/functions.c

Change default values for backup and replication parameters

commit   : f6d6d2920d2cddc4b381cbbf2915db9d985d20a9    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 14 Jan 2017 17:14:56 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 14 Jan 2017 17:14:56 +0100    

Click here for diff

This changes the default values of the following parameters:  
  
wal_level = replica  
max_wal_senders = 10  
max_replication_slots = 10  
  
in order to make it possible to make a backup and set up simple  
replication on the default settings, without requiring a system restart.  
  
Discussion: https://postgr.es/m/CABUevEy4PR_EAvZEzsbF5s+V0eEvw7shJ2t-AUwbHOjT+yRb3A@mail.gmail.com  
  
Reviewed by Peter Eisentraut. Benchmark help from Tomas Vondra.  

M doc/src/sgml/backup.sgml
M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
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/006_logical_decoding.pl
M src/test/recovery/t/008_fsm_truncation.pl

pg_ctl: Change default to wait for all actions

commit   : 05cd12ed5bc74c853a161c5a138a0cb6f9b0cb8a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 Jan 2017 12:00:00 -0500    

Click here for diff

The different actions in pg_ctl had different defaults for -w and -W,  
mostly for historical reasons.  Most users will want the -w behavior, so  
make that the default.  
  
Remove the -w option in most example and test code, so avoid confusion  
and reduce verbosity.  pg_upgrade is not touched, so it can continue to  
work with older installations.  
  
Reviewed-by: Beena Emerson <[email protected]>  
Reviewed-by: Ryan Murphy <[email protected]>  

M contrib/start-scripts/freebsd
M contrib/start-scripts/linux
M contrib/start-scripts/osx/PostgreSQL
M doc/src/sgml/ref/pg_ctl-ref.sgml
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/003_promote.pl
M src/test/modules/commit_ts/t/003_standby_2.pl
M src/test/perl/PostgresNode.pm
M src/tools/msvc/vcregress.pl

Updates to reflect that pg_ctl stop -m fast is the default

commit   : e574f15d6295b12c03ef8810c00976b65933711a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 Jan 2017 12:00:00 -0500    

Click here for diff

Various example and test code used -m fast explicitly, but since it's  
the default, this can be omitted now or should be replaced by a better  
example.  
  
pg_upgrade is not touched, so it can continue to operate with older  
installations.  

M contrib/start-scripts/freebsd
M contrib/start-scripts/linux
M contrib/start-scripts/osx/PostgreSQL
M doc/src/sgml/ref/pg_ctl-ref.sgml
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/test/regress/pg_regress.c
M src/tools/msvc/vcregress.pl

Fix some more regression test row-order-instability issues.

commit   : 5ad966ab1c50e829462f2b3e3ffa59e2d95479e6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Jan 2017 17:32:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Jan 2017 17:32:37 -0500    

Click here for diff

Commit 0563a3a8b just introduced another instance of the same unsafe  
testing methodology that appeared in 2ac3ef7a0, which I corrected in  
257d81572.  Robert/Amit, please stop doing that.  
  
Also look through the rest of f0e44751d's test cases, and correct some  
other queries with underdetermined ordering of results from the system  
catalogs.  These haven't failed in the buildfarm yet, but I don't  
have any confidence in that staying true.  
  
Per multiple buildfarm members.  

M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql

In PL/Tcl tests, don't choke if optional error fields are missing.

commit   : 5b29e6b688d1e783a098aa24f9e795f8de798a87    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Jan 2017 16:59:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Jan 2017 16:59:52 -0500    

Click here for diff

This fixes a portability issue introduced by commit 961bed020: with a  
compiler that doesn't support PG_FUNCNAME_MACRO, the "funcname" field of  
errorCode won't be provided, leading to a failure of the unset command.  
I added -nocomplain to the unset commands for filename and lineno too, just  
in case, though I know of no platform that wouldn't populate those fields.  
(BTW, -nocomplain is new in Tcl 8.4, but fortunately we dropped support  
for pre-8.4 Tcl some time ago.)  
  
Per buildfarm member pademelon.  

M src/pl/tcl/expected/pltcl_setup.out
M src/pl/tcl/sql/pltcl_setup.sql

pg_upgrade: Fix for changed pg_ctl default stop mode

commit   : 7f5b043d69a83e44e22a6b42f902e3e268b80a24    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 Jan 2017 12:00:00 -0500    

Click here for diff

In 9.5, the default pg_ctl stop mode was changed from "smart" to "fast".  
pg_upgrade still thought the default mode was "smart" and only specified  
the mode when "fast" was asked for.  This results in using "fast" all  
the time.  It's not clear what the effect in practice is, but fix it  
nonetheless to restore the previous behavior.  

M src/bin/pg_upgrade/server.c

Fix a bug in how we generate partition constraints.

commit   : 0563a3a8b59150bf3cc8b2b7077f684e0eaf8aff    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 13 Jan 2017 14:03:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 13 Jan 2017 14:03:52 -0500    

Click here for diff

Move the code for doing parent attnos to child attnos mapping for Vars  
in partition constraint expressions to a separate function  
map_partition_varattnos() and call it from the appropriate places.  
Doing it in get_qual_from_partbound(), as is now, would produce wrong  
result in certain multi-level partitioning cases, because it only  
considers the current pair of parent-child relations.  In certain  
multi-level partitioning cases, attnums for the same key attribute(s)  
might differ between various levels causing the same attribute to be  
numbered differently in different instances of the Var corresponding  
to a given attribute.  
  
With this commit, in generate_partition_qual(), we first generate the  
the whole partition constraint (considering all levels of partitioning)  
and then do the mapping, so that Vars in the final expression are  
numbered according the leaf relation (to which it is supposed to apply).  
  
Amit Langote, reviewed by me.  

M src/backend/catalog/partition.c
M src/backend/commands/tablecmds.c
M src/include/catalog/partition.h
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Fix cardinality estimates for parallel joins.

commit   : 0c2070cefa0e5d097b715c9a3b9b5499470019aa    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 13 Jan 2017 13:29:31 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 13 Jan 2017 13:29:31 -0500    

Click here for diff

For a partial path, the cardinality estimate needs to reflect the  
number of rows we think each worker will see, rather than the total  
number of rows; otherwise, costing will go wrong.  The previous coding  
got this completely wrong for parallel joins.  
  
Unfortunately, this change may destabilize plans for users of 9.6 who  
have enabled parallel query, but since 9.6 is still fairly new I'm  
hoping expectations won't be too settled yet.  Also, this is really a  
brown-paper-bag bug, so leaving it unfixed for the entire lifetime of  
9.6 seems unwise.  
  
Related reports (whose import I initially failed to recognize) by  
Tomas Vondra and Tom Lane.  
  
Discussion: http://postgr.es/m/CA+TgmoaDxZ5z5Kw_oCQoymNxNoVaTCXzPaODcOuao=CzK8dMZw@mail.gmail.com  

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

Fix field order in struct catcache.

commit   : e2117e4ab0d7fcb76f20cbf2e52541998d639d9e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Jan 2017 18:59:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Jan 2017 18:59:46 -0500    

Click here for diff

Somebody failed to grasp the point of having the #ifdef CATCACHE_STATS  
fields at the end of the struct.  Put that back the way it should be,  
and add a comment making it more explicit why it should be that way.  

M src/include/utils/catcache.h

Fix mistake in comment

commit   : 750c59d7ec573f9443af2eb7d9186946bc7e008c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 12 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 12 Jan 2017 12:00:00 -0500    

Click here for diff

The node->restart() function doesn't take a mode argument.  

M src/test/perl/PostgresNode.pm

Make whitespace consistent inside some script files

commit   : da0dbea9c30e7c91e9e78d72ab3dbee77d7ca0cd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 12 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 12 Jan 2017 12:00:00 -0500    

Click here for diff

I don't know what the global standard might be, but at least adjacent  
code should use the same whitespace.  

M contrib/start-scripts/linux
M contrib/start-scripts/osx/PostgreSQL

Fix incorrect function name in comment.

commit   : 76568d37865c5c21ae154008b2c681e3e32ac880    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 12 Jan 2017 09:05:14 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 12 Jan 2017 09:05:14 -0500    

Click here for diff

Amit Langote  

M src/backend/executor/execParallel.c

pg_restore: Don't allow non-positive number of jobs

commit   : e72059f3757594c5530ce321acdbe67f0da5da13    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 11 Jan 2017 15:45:50 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 11 Jan 2017 15:45:50 -0500    

Click here for diff

pg_restore will currently accept invalid values for the number of  
parallel jobs to run (eg: -1), unlike pg_dump which does check that the  
value provided is reasonable.  
  
Worse, '-1' is actually a valid, independent, parameter (as an alias for  
--single-transaction), leading to potentially completely unexpected  
results from a command line such as:  
  
  -> pg_restore -j -1  
  
Where a user would get neither parallel jobs nor a single-transaction.  
  
Add in validity checking of the parallel jobs option, as we already have  
in pg_dump, before we try to open up the archive.  Also move the check  
that we haven't been asked to run more parallel jobs than possible on  
Windows to the same place, so we do all the option validity checking  
before opening the archive.  
  
Back-patch all the way, though for 9.2 we're adding the Windows-specific  
check against MAXIMUM_WAIT_OBJECTS as that check wasn't back-patched  
originally.  
  
Discussion: https://www.postgresql.org/message-id/20170110044815.GC18360%40tamriel.snowman.net  

M src/bin/pg_dump/pg_restore.c

Fix some typos in comments

commit   : 268f9e3d9292af1d6ca9aa66b42daac2ef1a0987    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 11 Jan 2017 10:03:03 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 11 Jan 2017 10:03:03 +0100    

Click here for diff

Masahiko Sawada  

M src/backend/utils/mmgr/dsa.c

pg_xlogdump: document --path behavior

commit   : 73f8d7331343cefaaa97a0039421158fc8462c81    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 Jan 2017 22:38:14 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 Jan 2017 22:38:14 -0500    

Click here for diff

The previous --path documentation and --help output were wrong in both  
its meaning and the defaults.  
  
Reviewed-by: Michael Paquier  
  
Backpatch-through: 9.6  

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

pg_dump: Strict names with no matching schema

commit   : abfd0095c1e1a2e3fad2696516b64871895334ec    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 10 Jan 2017 11:34:51 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 10 Jan 2017 11:34:51 -0500    

Click here for diff

When using pg_dump --strict-names and a schema pattern which doesn't  
match any schemas (eg: --schema='nonexistant*'), we were incorrectly  
throwing an error claiming no tables were found when, really, there  
were no schemas found:  
  
  -> pg_dump --strict-names --schema='nonexistant*'  
  pg_dump: no matching tables were found for pattern "nonexistant*"  
  
Fix that by changing the error message to say 'schemas' instead, since  
that is what we are actually complaining about.  
  
Noticed while testing pg_dump error cases.  
  
Back-patch to 9.6 where --strict-names and this error message were  
introduced.  

M src/bin/pg_dump/pg_dump.c

Fix overflow check in StringInfo; add missing casts

commit   : 42f50cb8fa9848bbbc6776bcea03293a6b28b2d4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 10 Jan 2017 11:41:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 10 Jan 2017 11:41:13 -0300    

Click here for diff

A few thinkos I introduced in fa2fa9955280.  Also, amend a similarly  
broken comment.  
  
Report by Daniel VƩritƩ.  
Authors: Daniel VƩritƩ, Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/lib/stringinfo.c

Improve coding in _hash_addovflpage.

commit   : e898437460f55b49623d1aea435cd92e0011d54d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 10 Jan 2017 08:26:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 10 Jan 2017 08:26:52 -0500    

Click here for diff

Instead of relying on the page contents to know whether we have  
advanced from the primary bucket page to an overflow page, track  
that explicitly.  
  
Amit Kapila, per a complaint by me.  

M src/backend/access/hash/hashovfl.c

Fix invalid-parallel-jobs error message

commit   : 2ef6fe9cbae9fe7789a35cbc5fa1bbf78c163d42    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 9 Jan 2017 23:09:29 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 9 Jan 2017 23:09:29 -0500    

Click here for diff

Including the program name twice is not helpful:  
  
-> pg_dump -j -1  
pg_dump: pg_dump: invalid number of parallel jobs  
  
Correct by removing the progname from the exit_horribly() call used when  
validating the number of parallel jobs.  
  
Noticed while testing various pg_dump error cases.  
  
Back-patch to 9.3 where parallel pg_dump was added.  

M src/bin/pg_dump/pg_dump.c

Fix error handling in pltcl_returnnext.

commit   : 8c5722948e831c1862a39da2bb5d793a6f2aabab    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Jan 2017 17:47:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Jan 2017 17:47:02 -0500    

Click here for diff

We can't throw elog(ERROR) out of a Tcl command procedure; we have  
to catch the error and return TCL_ERROR to the Tcl interpreter.  
pltcl_returnnext failed to meet this requirement, so that errors  
detected by pltcl_build_tuple_result or other functions called here  
led to longjmp'ing out of the Tcl interpreter and thereby leaving it  
in a bad state.  Use the existing subtransaction support to prevent  
that.  Oversight in commit 26abb50c4, found more or less accidentally  
by the buildfarm thanks to the tests added in 961bed020.  
  
Report: https://postgr.es/m/[email protected]  

M src/pl/tcl/pltcl.c

Fix ALTER TABLE / SET TYPE for irregular inheritance

commit   : 3957b58b8885441c8d03bc1cfc00e47cf8cd7975    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 9 Jan 2017 19:26:58 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 9 Jan 2017 19:26:58 -0300    

Click here for diff

If inherited tables don't have exactly the same schema, the USING clause  
in an ALTER TABLE / SET DATA TYPE misbehaves when applied to the  
children tables since commit 9550e8348b79.  Starting with that commit,  
the attribute numbers in the USING expression are fixed during parse  
analysis.  This can lead to bogus errors being reported during  
execution, such as:  
   ERROR:  attribute 2 has wrong type  
   DETAIL:  Table has type smallint, but query expects integer.  
  
Since it wouldn't do to revert to the original coding, we now apply a  
transformation to map the attribute numbers to the correct ones for each  
child.  
  
Reported by Justin Pryzby  
Analysis by Tom Lane; patch by me.  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/tupconvert.c
M src/backend/commands/tablecmds.c
M src/include/access/tupconvert.h
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

BRIN revmap pages are not standard pages ...

commit   : 7403561c0f6a8c62b79b6ddf0364ae6c01719068    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 9 Jan 2017 18:19:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 9 Jan 2017 18:19:29 -0300    

Click here for diff

... and therefore we ought not to tell XLogRegisterBuffer the opposite,  
when writing XLog for a brin update that moves the index tuple to a  
different page.  Otherwise, xlog insertion would try to "compress the  
hole" when producing a full-page image for it; but since we don't update  
pd_lower/upper, the hole covers the whole page.  On WAL replay, the  
revmap page becomes empty and so the entire portion of the index is  
useless and needs to be recomputed.  
  
This is low-probability: a BRIN update only moves an index tuple to a  
different page when the summary tuple is larger than the existing one,  
which doesn't happen with fixed-width datatypes.  Also, the revmap  
page must be first after a checkpoint.  
  
Report and patch: Kuntal Ghosh  
Bug is alleged to have detected by a WAL-consistency-checking tool.  
Discussion: https://postgr.es/m/CAGz5QCJ=00UQjScSEFbV=0qO5ShTZB9WWz_Fm7+Wd83zPs9Geg@mail.gmail.com  
  
I posted a test case demonstrating the problem, but I'm refraining from  
adding it to the test suite; if the WAL consistency tool makes it in,  
that will be a better way to catch this from regressing.  (We should  
definitely have someting that causes not-same-page updates, though.)  

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

Expand the regression tests for PL/Tcl.

commit   : 961bed0208912a929a47c5a30190ff76748f3a03    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Jan 2017 10:10:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Jan 2017 10:10:08 -0500    

Click here for diff

This raises the test coverage (by line count) in pltcl.c from about 70%  
to 86%.  
  
Karl Lehenbauer and Jim Nasby  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/tcl/expected/pltcl_queries.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

Use an enum instead of two bools to indicate wal inclusion in base backups

commit   : 534b6f3ef29a11d19deeef6cef3bc8d4984de3c8    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 9 Jan 2017 16:03:47 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 9 Jan 2017 16:03:47 +0100    

Click here for diff

This makes the code easier to read as it becomes more explicit what the  
different allowed combinations really are.  
  
Suggested by Michael Paquier  

M src/bin/pg_basebackup/pg_basebackup.c

Get rid of ParseState.p_value_substitute; use a columnref hook instead.

commit   : 7c3abe3c92fd3a14a70bc2f888f936cd6fe28c0f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Jan 2017 16:02:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Jan 2017 16:02:16 -0500    

Click here for diff

I noticed that p_value_substitute, which is a single-purpose kluge I added  
in 2002 (commit b0422b215), could be replaced by having domainAddConstraint  
install a parser hook that looks for the name "value".  The parser hook  
code only dates back to 2009, so it's not surprising that we had to kluge  
this in 2002, but we can do it more cleanly now.  

M src/backend/commands/typecmds.c
M src/backend/parser/parse_expr.c
M src/include/parser/parse_node.h

Improve documentation of struct ParseState.

commit   : 3c40594e6eeabb3a8ad22aee93de3a19c41efdc2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Jan 2017 15:34:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Jan 2017 15:34:28 -0500    

Click here for diff

I got annoyed about how some fields of ParseState were documented in the  
struct's block comment and some weren't; not all of the latter are trivial.  
Fix that.  Also reorder a couple of fields that seem to have been placed  
rather randomly, or maybe with an idea of avoiding padding space; but there  
are never so many ParseStates in existence at one time that we ought to  
value pad space over readability.  

M src/include/parser/parse_node.h

Add basic pg_dumpall/pg_restore TAP tests

commit   : 9b815a8ff227e62442259e0fbabc5cf37e433df9    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 Jan 2017 16:29:31 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 Jan 2017 16:29:31 -0500    

Click here for diff

For reasons unknown, pg_dumpall and pg_restore managed to escape the  
basic set of TAP tests that were added for pg_dump in 6bd356c3, so  
let's get them added now.  A few minor adjustments are also made to the  
dump/restore tests to improve code coverage for pg_restore/pg_dumpall.  

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

Merge two copies of tuple-building code in pltcl.c.

commit   : de5fed0d0c704e3d1a928bf420663319d898cee4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Jan 2017 16:21:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Jan 2017 16:21:57 -0500    

Click here for diff

Make pltcl_trigger_handler() construct modified tuples using  
pltcl_build_tuple_result(), rather than its own copy of essentially  
the same logic.  This results in slightly different message wording for  
the error cases, and in one case a different SQLSTATE, but it seems  
unlikely that any existing applications are depending on any of those  
details.  
  
While at it, fix a typo in commit 26abb50c4: pltcl_build_tuple_result was  
applying encoding conversion in the wrong direction.  That would be a  
back-patchable bug fix, except the code hasn't shipped yet.  
  
Jim Nasby, reviewed by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/tcl/pltcl.c

Protect against NULL-dereference in pg_dump

commit   : d74ecbc8d85eb7a2aa1d5516c5c38d6ab0cbbd82    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 Jan 2017 15:27:47 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 Jan 2017 15:27:47 -0500    

Click here for diff

findTableByOid() is allowed to return NULL and we should therefore be  
checking for that case.  getOwnedSeqs() and dumpSequence() shouldn't  
ever actually see this happen, but given odd circumstances it might and  
commit f9e439b1 probably shouldn't have removed that check.  
  
Pointed out by Coverity.  Initial patch from Michael Paquier.  
  
Back-patch to 9.6, where that commit had removed the check.  

M src/bin/pg_dump/pg_dump.c

Invalidate cached plans on FDW option changes.

commit   : c52d37c8b3674f1ca9ead297480ade0ac9c54174    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Jan 2017 14:12:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Jan 2017 14:12:52 -0500    

Click here for diff

This fixes problems where a plan must change but fails to do so,  
as seen in a bug report from Rajkumar Raghuwanshi.  
  
For ALTER FOREIGN TABLE OPTIONS, do this through the standard method of  
forcing a relcache flush on the table.  For ALTER FOREIGN DATA WRAPPER  
and ALTER SERVER, just flush the whole plan cache on any change in  
pg_foreign_data_wrapper or pg_foreign_server.  That matches the way  
we handle some other low-probability cases such as opclass changes, and  
it's unclear that the case arises often enough to be worth working harder.  
Besides, that gives a patch that is simple enough to back-patch with  
confidence.  
  
Back-patch to 9.3.  In principle we could apply the code change to 9.2 as  
well, but (a) we lack postgres_fdw to test it with, (b) it's doubtful that  
anyone is doing anything exciting enough with FDWs that far back to need  
this desperately, and (c) the patch doesn't apply cleanly.  
  
Patch originally by Amit Langote, reviewed by Etsuro Fujita and Ashutosh  
Bapat, who each contributed substantial changes as well.  
  
Discussion: https://postgr.es/m/CAKcux6m5cA6rRPTKkqVdJ-R=KKDfe35Q_ZuUqxDSV_4hwga=og@mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/commands/tablecmds.c
M src/backend/utils/cache/plancache.c

Repair commit b81b5a96f424531b97cdd1dba97d9d1b9c9d372e.

commit   : 0355e6f3107a5be9b5f0873f08527bad361d9d8f    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Jan 2017 09:34:26 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Jan 2017 09:34:26 -0500    

Click here for diff

This commit purported to use a variable hash seed for Partial  
HashAggregate, but actually did the opposite - it made us use a  
variable seed for any HashAggregate that is NOT partial.  Woops.  

M src/backend/executor/nodeAgg.c

Fix possible leak of semaphore count.

commit   : e5b7451ea36d52815085cc2d9f2434c35b837978    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 5 Jan 2017 13:12:16 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 5 Jan 2017 13:12:16 -0500    

Click here for diff

Commit 4aec49899e5782247e134f94ce1c6ee926f88e1c reorganized the order  
of operations here so that we no longer increment the number of "extra  
waits" before locking the semaphore, but it did not change the  
starting value of extraWaits from 0 to -1 to compensate.  In the worst  
case, this could leak a semaphore count, but that seems to be unlikely  
in practice.  
  
Discussion: http://postgr.es/m/CAA4eK1JyVqXiMba+-a589Rk0pyHsyKkGxeumVKjU6Y74hdrVLQ@mail.gmail.com  
  
Amit Kapila, per an off-list report by Dilip Kumar.  Reviewed by me.  

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

Use 'use strict' in all Perl programs

commit   : 933b46644c787ed0b763532951961361e9304095    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 4 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 4 Dec 2016 12:00:00 -0500    

Click here for diff

M contrib/seg/seg-validate.pl
M contrib/seg/sort-segments.pl
M doc/src/sgml/mk_feature_tables.pl
M src/pl/plperl/plc_perlboot.pl
M src/test/locale/sort-test.pl
M src/tools/msvc/build.pl
M src/tools/msvc/gendef.pl
M src/tools/msvc/pgflex.pl
M src/tools/pginclude/pgcheckdefines
M src/tools/version_stamp.pl

Fix possible crash reading pg_stat_activity.

commit   : 175ff6598e014b2fe84c06fa443161294fc2eed0    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 5 Jan 2017 12:27:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 5 Jan 2017 12:27:09 -0500    

Click here for diff

With the old code, a backend that read pg_stat_activity without ever  
having executed a parallel query might see a backend in the midst of  
executing one waiting on a DSA LWLock, resulting in a crash.  The  
solution is for backends to register the tranche at startup time, not  
the first time a parallel query is executed.  
  
Report by Andreas Seltenreich.  Patch by me, reviewed by Thomas Munro.  

M src/backend/executor/execParallel.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/mmgr/dsa.c
M src/include/utils/dsa.h

Fix handling of empty arrays in array_fill().

commit   : 82f8107b92c9104ec9d9465f3f6a4c6dab4c124a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 Jan 2017 11:33:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 Jan 2017 11:33:51 -0500    

Click here for diff

array_fill(..., array[0]) produced an empty array, which is probably  
what users expect, but it was a one-dimensional zero-length array  
which is not our standard representation of empty arrays.  Also, for  
no very good reason, it rejected empty input arrays; that case should  
be allowed and produce an empty output array.  
  
In passing, remove the restriction that the input array(s) have lower  
bound 1.  That seems rather pointless, and it would have needed extra  
complexity to make the check deal with empty input arrays.  
  
Per bug #14487 from Andrew Gierth.  It's been broken all along, so  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix format for TAP test docs

commit   : 2e44f379bc0219f6864dbfb901129796e6feec44    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 5 Jan 2017 10:07:59 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 5 Jan 2017 10:07:59 +0000    

Click here for diff

Small number of fixes to perl docs for TAP tests.  
Plus two comments that use "xlog" rather than WAL  
  
Michael Paquier  

M src/test/perl/PostgresNode.pm

Handle OID column inheritance correctly in ALTER TABLE ... INHERIT.

commit   : d86f40009b6b019f794819a9af9038cff0cac6f3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 4 Jan 2017 18:00:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 4 Jan 2017 18:00:11 -0500    

Click here for diff

Inheritance operations must treat the OID column, if any, much like  
regular user columns.  But MergeAttributesIntoExisting() neglected to  
do that, leading to weird results after a table with OIDs is associated  
to a parent with OIDs via ALTER TABLE ... INHERIT.  
  
Report and patch by Amit Langote, reviewed by Ashutosh Bapat, some  
adjustments by me.  It's been broken all along, so back-patch to  
all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve documentation of timestamp internal representation.

commit   : 44f7afba79348883da110642d230a13003b75f62    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 4 Jan 2017 16:30:16 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 4 Jan 2017 16:30:16 -0500    

Click here for diff

Be more clear that we represent timestamps in microseconds when  
integer timestamps are used, and in fractional seconds when  
floating-point timestamps are used.  
  
Discussion: http://postgr.es/m/[email protected]  
  
Report by Alexander Alekseev.  Wording by me with a suggestion  
from Tom Lane.  

M doc/src/sgml/datatype.sgml

Assorted code improvements for table partitioning.

commit   : 3633b3f65686d3e74ab868e33bc25bec8bcdc7c6    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 4 Jan 2017 15:59:00 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 4 Jan 2017 15:59:00 -0500    

Click here for diff

Michael Paquier, per Coverity.  

M src/backend/catalog/heap.c
M src/backend/catalog/partition.c
M src/bin/pg_dump/pg_dump.c

Remove unnecessary arguments from partitioning functions.

commit   : 18fc5192a631441a73e6a3b911ecb14765140389    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 4 Jan 2017 14:56:37 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 4 Jan 2017 14:56:37 -0500    

Click here for diff

RelationGetPartitionQual() and generate_partition_qual() are always  
called with recurse = true, so we don't need an argument for that.  
  
Extracted by me from a larger patch by Amit Langote.  

M src/backend/catalog/partition.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execMain.c
M src/backend/optimizer/util/plancat.c
M src/include/catalog/partition.h

Fix reporting of constraint violations for table partitioning.

commit   : f1b4c771ea74f42447dccaed42ffcdcccf3aa694    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 4 Jan 2017 14:36:34 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 4 Jan 2017 14:36:34 -0500    

Click here for diff

After a tuple is routed to a partition, it has been converted from the  
root table's row type to the partition's row type.  ExecConstraints  
needs to report the failure using the original tuple and the parent's  
tuple descriptor rather than the ones for the selected partition.  
  
Amit Langote  

M src/backend/commands/copy.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execMain.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/test/regress/expected/insert.out
M src/test/regress/sql/insert.sql

Add new TAP tests for pg_recvlogical

commit   : 3e353a7bc2dd6a9edfffe7e045c810b421f7ecc4    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 4 Jan 2017 19:06:45 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 4 Jan 2017 19:06:45 +0000    

Click here for diff

Craig Ringer, reviewed by Euler Taveira and Naoki Okano  

M src/bin/pg_basebackup/Makefile
A src/bin/pg_basebackup/t/030_pg_recvlogical.pl

Add pg_recvlogical ā€”-endpos=LSN

commit   : 7c030783a5bd07cadffc2a1018bc33119a4c7505    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 4 Jan 2017 19:02:07 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 4 Jan 2017 19:02:07 +0000    

Click here for diff

Allow pg_recvlogical to specify an ending LSN, complementing  
the existing -ā€”startpos=LSN option.  
  
Craig Ringer, reviewed by Euler Taveira and Naoki Okano  

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

Prefer int-wide pg_atomic_flag over char-wide when using gcc intrinsics.

commit   : 698127a4a9bc3c74659bf0e5383b1ed99aeb1570    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 4 Jan 2017 13:36:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 4 Jan 2017 13:36:44 -0500    

Click here for diff

configure can only probe the existence of gcc intrinsics, not how well  
they're implemented, and unfortunately the answer is sometimes "badly".  
In particular we've found that multiple compilers fail to implement  
char-width __sync_lock_test_and_set() correctly on PPC; and even a correct  
implementation would necessarily be pretty inefficient, since that hardware  
has only a word-wide primitive to work with.  
  
Given the knowledge we've accumulated in s_lock.h, it appears that it's  
best to rely on int-width TAS operations on most non-Intel architectures.  
Hence, pick int not char when both are nominally available to us in  
generic-gcc.h (note that that code is not used for x86[_64]).  
  
Back-patch to fix regression test failures on FreeBSD/PPC.  Ordinarily  
back-patching a change like this would be verboten because of ABI breakage.  
But since pg_atomic_flag is not yet used in any Postgres data structure,  
there's no ABI to break.  It seems safer to back-patch to avoid possible  
gotchas, if someday we do back-patch something that uses pg_atomic_flag.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Move partition_tuple_slot out of EState.

commit   : 345b2dcf070bd8fbccde643b1b2856027623e9e5    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 4 Jan 2017 13:05:29 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 4 Jan 2017 13:05:29 -0500    

Click here for diff

Commit 2ac3ef7a01df859c62d0a02333b646d65eaec5ff added a TupleTapleSlot  
for partition tuple slot to EState (es_partition_tuple_slot) but it's  
more logical to have it as part of ModifyTableState  
(mt_partition_tuple_slot) and CopyState (partition_tuple_slot).  
  
Discussion: http://postgr.es/m/[email protected]  
  
Amit Langote, per a gripe from me  

M src/backend/commands/copy.c
M src/backend/executor/execMain.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h

Re-allow SSL passphrase prompt at server start, but not thereafter.

commit   : 6667d9a6d77b9a6eac89638ac363b6d03da253c1    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 4 Jan 2017 12:43:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 4 Jan 2017 12:43:52 -0500    

Click here for diff

Leave OpenSSL's default passphrase collection callback in place during  
the first call of secure_initialize() in server startup.  Although that  
doesn't work terribly well in daemon contexts, some people feel we should  
not break it for anyone who was successfully using it before.  We still  
block passphrase demands during SIGHUP, meaning that you can't adjust SSL  
configuration on-the-fly if you used a passphrase, but this is no worse  
than what it was before commit de41869b6.  And we block passphrase demands  
during EXEC_BACKEND reloads; that behavior wasn't useful either, but at  
least now it's documented.  
  
Tweak some related log messages for more readability, and avoid issuing  
essentially duplicate messages about reload failure caused by a passphrase.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/runtime.sgml
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/postmaster/postmaster.c
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq.h

Update obsolete comments in lwlock.h.

commit   : 0fad355beca9f73687c0b27647ea570ce10c7ae3    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 4 Jan 2017 12:03:40 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 4 Jan 2017 12:03:40 -0500    

Click here for diff

The typical size of an LWLock is now 16 bytes even on 64-bit platforms,  
and the size of slock_t is now irrelevant.  But pg_atomic_uint32 can  
(perhaps surprisingly) still be larger than 4 bytes, so there's still  
some marginal point to allowing LWLOCK_MINIMAL_SIZE == 64.  
  
Commit 008608b9d51061b1f598c197477b3dc7be9c4a64 made the changes  
that led to the need for these updates.  

M src/include/storage/lwlock.h

Add 18 new recovery TAP tests

commit   : 0813216cb416bf9173ddc7ff3cf495755d943743    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 4 Jan 2017 16:54:28 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 4 Jan 2017 16:54:28 +0000    

Click here for diff

Add new tests for physical repl slots and hot standby feedback.  
  
Craig Ringer, reviewed by Aleksander Alekseev and Simon Riggs  

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

Allow PostgresNode.pm tests to wait for catchup

commit   : fb093e4cb36fe40a1c3f87618fb8362845dae0f0    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 4 Jan 2017 16:50:23 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 4 Jan 2017 16:50:23 +0000    

Click here for diff

Add methods to the core test framework PostgresNode.pm to allow us to  
test that standby nodes have caught up with the master, as well as  
basic LSN handling.  Used in tests recovery/t/001_stream_rep.pl and  
recovery/t/004_timeline_switch.pl  
  
Craig Ringer, reviewed by Aleksander Alekseev and Simon Riggs  

M src/test/perl/PostgresNode.pm
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/004_timeline_switch.pl

Better fix for sequence access in hot standby test

commit   : 579f700911794d33d95628266f8ed700f113ee16    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jan 2017 12:00:00 -0500    

Click here for diff

The purpose of the test was to check access to the sequence relation on  
a hot standby, so change the test to read a different column from the  
sequence, instead of just reading the catalog.  
  
From: Andreas Karlsson <[email protected]>  

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

Attempt to handle pending-delete files on Windows

commit   : 9951741bbeb3ec37ca50e9ce3df1808c931ff6a6    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 4 Jan 2017 10:48:30 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 4 Jan 2017 10:48:30 +0100    

Click here for diff

These files are deleted but not yet gone from the filesystem. Operations  
on them will return ERROR_DELETE_PENDING.  
  
With this we start treating that as ENOENT, meaning files does not  
exist (which is the state it will soon reach). This should be safe in  
every case except when we try to recreate a file with exactly the same  
name. This is an operation that PostgreSQL does very seldom, so  
hopefully that won't happen much -- and even if it does, this treatment  
should be no worse than treating it as an unhandled error.  
  
We've been un able to reproduce the bug reliably, so pushing this to  
master to get buildfarm coverage and other testing. Once it's proven to  
be stable, it should be considered for backpatching.  
  
Discussion: https://postgr.es/m/20160712083220.1426.58667%40wrigleys.postgresql.org  
  
Patch by me and Michael Paquier  

M src/port/dirmod.c
M src/port/win32error.c

Make wal streaming the default mode for pg_basebackup

commit   : 9a4d51077c96c10322582211781bb969b51822ff    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 4 Jan 2017 10:40:38 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 4 Jan 2017 10:40:38 +0100    

Click here for diff

Since streaming is now supported for all output formats, make this the  
default as this is what most people want.  
  
To get the old behavior, the parameter -X none can be specified to turn  
it off.  
  
This also removes the parameter -x for fetch, now requiring -X fetch to  
be specified to use that.  
  
Reviewed by Vladimir Rusinov, Michael Paquier and Simon Riggs  

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/PostgresNode.pm

commit   : 1d25779284fe1ba08ecd57e647292a9deb241376    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Jan 2017 13:48:53 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Jan 2017 13:48:53 -0500    

Click here for diff

M configure
M configure.in
M contrib/adminpack/adminpack.c
M contrib/auth_delay/auth_delay.c
M contrib/auto_explain/auto_explain.c
M contrib/bloom/blcost.c
M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/bloom/blvalidate.c
M contrib/dblink/dblink.c
M contrib/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/pg_visibility/pg_visibility.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/shippable.c
M contrib/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/launcher
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h
M contrib/sepgsql/uavc.c
M contrib/tablefunc/tablefunc.c
M contrib/tablefunc/tablefunc.h
M contrib/tcn/tcn.c
M contrib/test_decoding/test_decoding.c
M contrib/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/lobj.sgml
M src/backend/Makefile
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/common/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/ginvalidate.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashsort.c
M src/backend/access/hash/hashutil.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/syncscan.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/index/amapi.c
M src/backend/access/index/amvalidate.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/brindesc.c
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/logicalmsgdesc.c
M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/relmapdesc.c
M src/backend/access/rmgrdesc/replorigindesc.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/tblspcdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c
M src/backend/access/tablesample/tablesample.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/transam.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/twophase_rmgr.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaccess.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_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/amcmds.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/discard.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/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/ifaddr.c
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqformat.c
M src/backend/libpq/pqmq.c
M src/backend/libpq/pqsignal.c
M src/backend/main/main.c
M src/backend/nodes/bitmapset.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/extensible.c
M src/backend/nodes/list.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/nodes.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/print.c
M src/backend/nodes/read.c
M src/backend/nodes/readfuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/nodes/value.c
M src/backend/optimizer/geqo/geqo_copy.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_misc.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_random.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/prep/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/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/solaris.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/win32/crashdump.c
M src/backend/port/win32/mingwcompat.c
M src/backend/port/win32/signal.c
M src/backend/port/win32/socket.c
M src/backend/port/win32/timer.c
M src/backend/port/win32_sema.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/regex/regc_pg_locale.c
M src/backend/regex/regexport.c
M src/backend/regex/regprefix.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/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/syncrep_gram.y
M src/backend/replication/syncrep_scanner.l
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/rewrite/rowsecurity.c
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/snowball.sql.in
M src/backend/snowball/snowball_func.sql.in
M src/backend/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/latch.c
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/shm_toc.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/shmqueue.c
M src/backend/storage/ipc/sinval.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/large_object/inv_api.c
M src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/s_lock.c
M src/backend/storage/lmgr/spin.c
M src/backend/storage/page/bufpage.c
M src/backend/storage/page/checksum.c
M src/backend/storage/page/itemptr.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/storage/smgr/smgrtype.c
M src/backend/tcop/dest.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/tsearch/Makefile
M src/backend/tsearch/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/regis.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/Gen_dummy_probes.sed
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/bool.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/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/geo_spgist.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/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/network_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/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_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c
M src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
M src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c
M src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
M src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
M src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
M src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c
M src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
M src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
M src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/backend_random.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/help_config.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/pg_rusage.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/misc/rls.c
M src/backend/utils/misc/sampling.c
M src/backend/utils/misc/superuser.c
M src/backend/utils/misc/timeout.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/backend/utils/mmgr/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_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_config/Makefile
M src/bin/pg_config/pg_config.c
M src/bin/pg_controldata/Makefile
M src/bin/pg_ctl/Makefile
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_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/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/crosstabview.c
M src/bin/psql/crosstabview.h
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/help.h
M src/bin/psql/input.c
M src/bin/psql/input.h
M src/bin/psql/large_obj.c
M src/bin/psql/large_obj.h
M src/bin/psql/mainloop.c
M src/bin/psql/mainloop.h
M src/bin/psql/prompt.c
M src/bin/psql/prompt.h
M src/bin/psql/psqlscanslash.h
M src/bin/psql/psqlscanslash.l
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/stringutils.c
M src/bin/psql/stringutils.h
M src/bin/psql/tab-complete.c
M src/bin/psql/tab-complete.h
M src/bin/psql/variables.c
M src/bin/psql/variables.h
M src/bin/scripts/Makefile
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createdb.c
M src/bin/scripts/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/config_info.c
M src/common/controldata_utils.c
M src/common/exec.c
M src/common/fe_memutils.c
M src/common/file_utils.c
M src/common/ip.c
M src/common/keywords.c
M src/common/md5.c
M src/common/pg_lzcompress.c
M src/common/pgfnames.c
M src/common/psprintf.c
M src/common/relpath.c
M src/common/restricted_token.c
M src/common/rmtree.c
M src/common/string.c
M src/common/username.c
M src/common/wait_error.c
M src/fe_utils/Makefile
M src/fe_utils/mbprint.c
M src/fe_utils/print.c
M src/fe_utils/psqlscan.l
M src/fe_utils/simple_list.c
M src/fe_utils/string_utils.c
M src/include/access/amapi.h
M src/include/access/amvalidate.h
M src/include/access/attnum.h
M src/include/access/brin.h
M src/include/access/brin_internal.h
M src/include/access/brin_page.h
M src/include/access/brin_pageops.h
M src/include/access/brin_revmap.h
M src/include/access/brin_tuple.h
M src/include/access/brin_xlog.h
M src/include/access/clog.h
M src/include/access/commit_ts.h
M src/include/access/genam.h
M src/include/access/generic_xlog.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/hash.h
M src/include/access/hash_xlog.h
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/hio.h
M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/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/partition.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_constraint_fn.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_init_privs.h
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_operator_fn.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.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/progress.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/config_info.h
M src/include/common/controldata_utils.h
M src/include/common/fe_memutils.h
M src/include/common/file_utils.h
M src/include/common/ip.h
M src/include/common/keywords.h
M src/include/common/md5.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/fe_utils/mbprint.h
M src/include/fe_utils/print.h
M src/include/fe_utils/psqlscan.h
M src/include/fe_utils/psqlscan_int.h
M src/include/fe_utils/simple_list.h
M src/include/fe_utils/string_utils.h
M src/include/fmgr.h
M src/include/foreign/fdwapi.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/getaddrinfo.h
M src/include/getopt_long.h
M src/include/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/ifaddr.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq-fs.h
M src/include/libpq/libpq.h
M src/include/libpq/pqcomm.h
M src/include/libpq/pqformat.h
M src/include/libpq/pqmq.h
M src/include/libpq/pqsignal.h
M src/include/mb/pg_wchar.h
M src/include/miscadmin.h
M src/include/nodes/bitmapset.h
M src/include/nodes/execnodes.h
M src/include/nodes/extensible.h
M src/include/nodes/lockoptions.h
M src/include/nodes/makefuncs.h
M src/include/nodes/memnodes.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/print.h
M src/include/nodes/readfuncs.h
M src/include/nodes/relation.h
M src/include/nodes/replnodes.h
M src/include/nodes/tidbitmap.h
M src/include/nodes/value.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_copy.h
M src/include/optimizer/geqo_gene.h
M src/include/optimizer/geqo_misc.h
M src/include/optimizer/geqo_mutation.h
M src/include/optimizer/geqo_pool.h
M src/include/optimizer/geqo_random.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/orclauses.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/optimizer/predtest.h
M src/include/optimizer/prep.h
M src/include/optimizer/restrictinfo.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/include/optimizer/var.h
M src/include/parser/analyze.h
M src/include/parser/gramparse.h
M src/include/parser/kwlist.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_collate.h
M src/include/parser/parse_cte.h
M src/include/parser/parse_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/message.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/block.h
M src/include/storage/buf.h
M src/include/storage/buf_internals.h
M src/include/storage/buffile.h
M src/include/storage/bufmgr.h
M src/include/storage/bufpage.h
M src/include/storage/checksum.h
M src/include/storage/checksum_impl.h
M src/include/storage/condition_variable.h
M src/include/storage/copydir.h
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h
M src/include/storage/fd.h
M src/include/storage/freespace.h
M src/include/storage/fsm_internals.h
M src/include/storage/indexfsm.h
M src/include/storage/ipc.h
M src/include/storage/item.h
M src/include/storage/itemid.h
M src/include/storage/itemptr.h
M src/include/storage/large_object.h
M src/include/storage/latch.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/lockdefs.h
M src/include/storage/lwlock.h
M src/include/storage/off.h
M src/include/storage/pg_sema.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/proclist.h
M src/include/storage/proclist_types.h
M src/include/storage/procsignal.h
M src/include/storage/reinit.h
M src/include/storage/relfilenode.h
M src/include/storage/s_lock.h
M src/include/storage/shm_mq.h
M src/include/storage/shm_toc.h
M src/include/storage/shmem.h
M src/include/storage/sinval.h
M src/include/storage/sinvaladt.h
M src/include/storage/smgr.h
M src/include/storage/spin.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/include/tcop/deparse_utility.h
M src/include/tcop/dest.h
M src/include/tcop/fastpath.h
M src/include/tcop/pquery.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/tsearch/dicts/regis.h
M src/include/tsearch/dicts/spell.h
M src/include/tsearch/ts_cache.h
M src/include/tsearch/ts_locale.h
M src/include/tsearch/ts_public.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/aclchk_internal.h
M src/include/utils/array.h
M src/include/utils/arrayaccess.h
M src/include/utils/ascii.h
M src/include/utils/attoptcache.h
M src/include/utils/backend_random.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h
M src/include/utils/catcache.h
M src/include/utils/combocid.h
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/include/utils/datum.h
M src/include/utils/dsa.h
M src/include/utils/dynahash.h
M src/include/utils/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/freepage.h
M src/include/utils/geo_decls.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/help_config.h
M src/include/utils/hsearch.h
M src/include/utils/index_selfuncs.h
M src/include/utils/inet.h
M src/include/utils/int8.h
M src/include/utils/inval.h
M src/include/utils/json.h
M src/include/utils/jsonapi.h
M src/include/utils/jsonb.h
M src/include/utils/logtape.h
M src/include/utils/lsyscache.h
M src/include/utils/memdebug.h
M src/include/utils/memutils.h
M src/include/utils/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/relptr.h
M src/include/utils/reltrigger.h
M src/include/utils/resowner.h
M src/include/utils/resowner_private.h
M src/include/utils/rls.h
M src/include/utils/ruleutils.h
M src/include/utils/sampling.h
M src/include/utils/selfuncs.h
M src/include/utils/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/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/interfaces/libpq/pthread-win32.c
M src/interfaces/libpq/test/uri-regress.c
M src/interfaces/libpq/win32.c
M src/pl/plperl/plperl.h
M src/pl/plpgsql/src/generate-plerrcodes.pl
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/generate-spiexceptions.pl
M src/pl/plpython/plpython.h
M src/pl/tcl/generate-pltclerrcodes.pl
M src/port/chklocale.c
M src/port/dirent.c
M src/port/dirmod.c
M src/port/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/pg_strong_random.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/win32security.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_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_parser/test_parser.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/test_rls_hooks/test_rls_hooks.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/test_shm_mq/worker.c
M src/test/modules/worker_spi/worker_spi.c
M src/test/perl/Makefile
M src/test/recovery/Makefile
M src/test/regress/GNUmakefile
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h
M src/test/regress/pg_regress_main.c
M src/test/regress/regress.c
M src/test/ssl/Makefile
M src/test/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

commit   : 60f1e514ad0db017bc583b0e15d056b777bd9626    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Jan 2017 13:45:17 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Jan 2017 13:45:17 -0500    

Click here for diff

M doc/src/sgml/legal.sgml
M src/interfaces/libpq/libpq.rc.in

commit   : 7090eed3b3e476d6ac20ba8e5f6e3914f18f9632    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Jan 2017 12:37:53 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Jan 2017 12:37:53 -0500    

Click here for diff

Backpatch-through: certain files through 9.2  

M COPYRIGHT
M doc/src/sgml/legal.sgml

Disable prompting for passphrase while (re)loading SSL config files.

commit   : 1e942c7474d7b5e4bfa04918d2f68d95902f17b3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Jan 2017 12:33:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Jan 2017 12:33:29 -0500    

Click here for diff

OpenSSL's default behavior when loading a passphrase-protected key file  
is to open /dev/tty and demand the password from there.  It was kinda  
sorta okay to allow that to happen at server start, but really that was  
never workable in standard daemon environments.  And it was a complete  
fail on Windows, where the same thing would happen at every backend launch.  
Yesterday's commit de41869b6 put the final nail in the coffin by causing  
that to happen at every SIGHUP; even if you've still got a terminal acting  
as the server's TTY, having the postmaster freeze until you enter the  
passphrase again isn't acceptable.  
  
Hence, override the default behavior with a callback that returns an empty  
string, ensuring failure.  Change the documentation to say that you can't  
have a passphrase-protected server key, period.  
  
If we can think of a production-grade way of collecting a passphrase from  
somewhere, we might do that once at server startup and use this callback  
to feed it to OpenSSL, but it's far from clear that anyone cares enough  
to invest that much work in the feature.  The lack of complaints about  
the existing fractionally-baked behavior suggests nobody's using it anyway.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/runtime.sgml
M src/backend/libpq/be-secure-openssl.c

Fix hot standby tests for sequence catalog change

commit   : 3d54c16c24d7fd73c9fdfa4b2f946899f7f85e58    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Jan 2017 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Jan 2017 12:00:00 -0500    

Click here for diff

From: Kuntal Ghosh <[email protected]>  

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

Remove bogus notice that older clients might not work with MD5 passwords.

commit   : 31c54096a18f5ae4ebf8ac9e86963b2b36f2abb5    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 3 Jan 2017 14:09:01 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 3 Jan 2017 14:09:01 +0200    

Click here for diff

That was written when we still had "crypt" authentication, and it was  
referring to the fact that an older client might support "crypt"  
authentication but not "md5". But we haven't supported "crypt" for years.  
(As soon as we add a new authentication mechanism that doesn't work with  
MD5 hashes, we'll need a similar notice again. But this text as it's worded  
now is just wrong.)  
  
Backpatch to all supported versions.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/ref/create_role.sgml

Allow SSL configuration to be updated at SIGHUP.

commit   : de41869b64d57160f58852eab20a27f248188135    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Jan 2017 21:37:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Jan 2017 21:37:12 -0500    

Click here for diff

It is no longer necessary to restart the server to enable, disable,  
or reconfigure SSL.  Instead, we just create a new SSL_CTX struct  
(by re-reading all relevant files) whenever we get SIGHUP.  Testing  
shows that this is fast enough that it shouldn't be a problem.  
  
In conjunction with that, downgrade the logic that complains about  
pg_hba.conf "hostssl" lines when SSL isn't active: now that's just  
a warning condition not an error.  
  
An issue that still needs to be addressed is what shall we do with  
passphrase-protected server keys?  As this stands, the server would  
demand the passphrase again on every SIGHUP, which is certainly  
impractical.  But the case was only barely supported before, so that  
does not seem a sufficient reason to hold up committing this patch.  
  
Andreas Karlsson, reviewed by Michael Banck and Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/client-auth.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/runtime.sgml
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/hba.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq.h
M src/test/ssl/ServerSetup.pm

Use clock_gettime(), if available, in instr_time measurements.

commit   : 1d63f7d2d180c8708bc12710254eb7b45823440f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Jan 2017 13:41:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Jan 2017 13:41:51 -0500    

Click here for diff

The advantage of clock_gettime() is that the API allows the result to  
be precise to nanoseconds, not just microseconds as in gettimeofday().  
Now that it's routinely possible to do tens of plan node executions  
in 1us, we really need more precision than gettimeofday() can offer  
for EXPLAIN ANALYZE to accumulate statistics with.  
  
Some research shows that clock_gettime() is available on pretty nearly  
every modern Unix-ish platform, and as far as I have been able to test,  
it has about the same execution time as gettimeofday(), so there's no  
loss in switching over.  (By the same token, this doesn't do anything  
to fix the fact that we really wish clock readings were faster.  But  
there's enough win here to justify changing anyway.)  
  
A small side benefit is that on most platforms, we can use CLOCK_MONOTONIC  
instead of CLOCK_REALTIME and thereby render EXPLAIN impervious to  
concurrent resets of the system clock.  (This means that code must not  
assume that the contents of struct instr_time have any well-defined  
interpretation as timestamps, but really that was true before.)  
  
Some platforms offer nonstandard clock IDs that might be of interest.  
This patch knows we should use CLOCK_MONOTONIC_RAW on macOS, because it  
provides more precision and is faster to read than their CLOCK_MONOTONIC.  
If there turn out to be many more cases where we need special rules, it  
might be appropriate to handle the selection of clock ID in configure,  
but for the moment that doesn't seem worth the trouble.  
  
Discussion: https://postgr.es/m/[email protected]  

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

In pgbench logging, avoid assuming that instr_times match Unix timestamps.

commit   : 67a875355e4a6db294e9652af5a883876ddeb4a5    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Jan 2017 12:26:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Jan 2017 12:26:03 -0500    

Click here for diff

For aggregated logging, pg_bench supposed that printing the integer part of  
INSTR_TIME_GET_DOUBLE() would produce a Unix timestamp.  That was already  
broken on Windows, and it's about to get broken on most other platforms as  
well.  As in commit 74baa1e3b, we can remove the entanglement at the price  
of one extra syscall per transaction; though here it seems more convenient  
to use time(NULL) instead of gettimeofday(), since we only need  
integral-second precision.  
  
I took the time to do some wordsmithing on the documentation about  
pgbench's logging features, too.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid assuming that instr_time == struct timeval in pgbench logging.

commit   : 74baa1e3b89c1651ade1afeffc715cac24041e2f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 1 Jan 2017 15:17:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 1 Jan 2017 15:17:08 -0500    

Click here for diff

This code was presuming undue familiarity with the contents of the  
instr_time struct.  That was already broken on Windows, and it's about  
to get broken on most other platforms as well.  The simplest solution  
that preserves the current output definition is to just do our own  
gettimeofday() call here.  Realistically, the extra cost is probably  
negligible in comparison to everything else that's going on in a  
pgbench transaction, so it's not worth sweating over.  
  
On Windows, the precision delivered by gettimeofday() is lower than  
one could wish, but this is still a big improvement over printing  
zeroes, as the code did before.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

Fix unstable regression test results.

commit   : 257d8157205a7be5f9799e8941b922521d678a25    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 31 Dec 2016 18:39:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 31 Dec 2016 18:39:08 -0500    

Click here for diff

Commit 2ac3ef7a0 added a query with an underdetermined output row order;  
it has failed multiple times in the buildfarm since then.  Add an ORDER BY  
to fix.  Also, don't rely on a DROP CASCADE to drop in a well-determined  
order; that hasn't failed yet but I don't trust it much, and we're not  
saving any typing by using CASCADE anyway.  

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

Remove manual breaks in NodeTag assignments to fix duplicate tag numbers.

commit   : 80a7298b9eb7f108ef20be6ee00d9513a43c61a0    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Dec 2016 16:57:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Dec 2016 16:57:41 -0500    

Click here for diff

Commit f0e44751d added new node tags at a place in the tag numbering  
where there was no daylight left before the next hard-coded number,  
resulting in some duplicate tag assignments.  This doesn't seem to have  
caused any big problem so far, but it's surely trouble waiting to happen.  
  
We could adjust the manually assigned breakpoints to make more room,  
but that just leaves the same hazard waiting to strike again in future.  
What seems like a better idea is to get rid of the manual assignments  
and leave NodeTags to be automatically assigned, consecutively from one  
on up.  This means that any change in the tag list forces a backend-wide  
recompile, but realistically that's usually needed anyway.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/nodes/nodes.h

Fix typo in comment

commit   : db779d941e0a05ea4647455d0b386b38ef58983b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 29 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Dec 2016 12:00:00 -0500    

Click here for diff

M src/backend/commands/tablecmds.c

Expand ad-hoc unit abbreviations in function descriptions

commit   : 27866bd1e88c7b564b42394a0d5b069b015666c4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 29 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Dec 2016 12:00:00 -0500    

Click here for diff

There is no need to use abbreviations here, so just write it out for  
consistency.  

M src/include/catalog/pg_proc.h

Make more use of RoleSpec struct

commit   : 2e254130d1d3f16575f2d72952ab23b4e27d035a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2016 12:00:00 -0500    

Click here for diff

Most code was casting this through a generic Node.  By declaring  
everything as RoleSpec appropriately, we can remove a bunch of casts and  
ad-hoc node type checking.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  

M src/backend/catalog/aclchk.c
M src/backend/commands/policy.c
M src/backend/commands/user.c
M src/backend/parser/gram.y
M src/backend/utils/adt/acl.c
M src/include/nodes/parsenodes.h
M src/include/utils/acl.h

Fix interval_transform so it doesn't throw away non-no-op casts.

commit   : f0774abde868e0b5a2acbe75b5028884752f739d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2016 15:43:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2016 15:43:54 -0500    

Click here for diff

interval_transform() contained two separate bugs that caused it to  
sometimes mistakenly decide that a cast from interval to restricted  
interval is a no-op and throw it away.  
  
First, it was wrong to rely on dt.h's field type macros to have an  
ordering consistent with the field's significance; in one case they do  
not.  This led to mistakenly treating YEAR as less significant than MONTH,  
so that a cast from INTERVAL MONTH to INTERVAL YEAR was incorrectly  
discarded.  
  
Second, fls(1<<k) produces k+1 not k, so comparing its output directly  
to SECOND was wrong.  This led to supposing that a cast to INTERVAL  
MINUTE was really a cast to INTERVAL SECOND and so could be discarded.  
  
To fix, get rid of the use of fls(), and make a function based on  
intervaltypmodout to produce a field ID code adapted to the need here.  
  
Per bug #14479 from Piotr Stefaniak.  Back-patch to 9.2 where transform  
functions were introduced, because this code was born broken.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Explain unaccounted for space in pgstattuple.

commit   : 71f996d22125eb6cfdbee6094f44370aa8dec610    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 27 Dec 2016 11:23:46 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 27 Dec 2016 11:23:46 -0500    

Click here for diff

In addition to space accounted for by tuple_len, dead_tuple_len and  
free_space, the table_len includes page overhead, the item pointers  
table and padding bytes.  
  
Backpatch to live branches.  

M doc/src/sgml/pgstattuple.sgml

Don't rename .partial files in pg_receivexlog if an error occured

commit   : 3ea56fffd66fe2c5857f36359ae16d4cabcdeef6    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 27 Dec 2016 10:37:11 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 27 Dec 2016 10:37:11 +0100    

Click here for diff

In 56c7d8d the behavior to keep .partial segments around  
(considered corrupt) in case an connection failure occurs was  
accidentally removed. This would lead to an incomplete segment  
being considered complete.  
  
Author: Michael Paquier  

M src/bin/pg_basebackup/receivelog.c

Fix typo comments

commit   : 6cfa54e384700d4a2124e5c4d7a1eb91e8e0eeb7    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 27 Dec 2016 10:24:21 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 27 Dec 2016 10:24:21 +0100    

Click here for diff

Erik Rijkers  

M src/backend/commands/tablecmds.c

Remove triggerable Assert in hashname().

commit   : 54386f3578258caa5a1de97c434eee2c9ee2ab06    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Dec 2016 14:58:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Dec 2016 14:58:02 -0500    

Click here for diff

hashname() asserted that the key string it is given is shorter than  
NAMEDATALEN.  That should surely always be true if the input is in fact a  
regular value of type "name".  However, for reasons of coding convenience,  
we allow plain old C strings to be treated as "name" values in many places.  
Some SQL functions accept arbitrary "text" inputs, convert them to C  
strings, and pass them otherwise-untransformed to syscache lookups for name  
columns, allowing an overlength input value to trigger hashname's Assert.  
  
This would be a DOS problem, except that it only happens in assert-enabled  
builds which aren't recommended for production.  In a production build,  
you'll just get a name lookup error, since regardless of the hash value  
computed by hashname, the later equality comparison checks can't match.  
Likewise, if the catalog lookup is done by seqscan or indexscan searches,  
there will just be a lookup error, since the name comparison functions  
don't contain any similar length checks, and will see an overlength input  
as unequal to any stored entry.  
  
After discussion we concluded that we should simply remove this Assert.  
It's inessential to hashname's own functionality, and having such an  
assertion in only some paths for name lookup is more of a foot-gun than  
a useful check.  There may or may not be a case for the affected callers  
to do something other than let the name lookup fail, but we'll consider  
that separately; in any case we probably don't want to change such  
behavior in the back branches.  
  
Per report from Tushar Ahuja.  Back-patch to all supported branches.  
  
Report: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/hash/hashfunc.c

Fix incorrect error reporting for duplicate data in \crosstabview.

commit   : a3aef88e6a9c5822eb4a5ad0744b15dc6e8a5d86    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Dec 2016 16:04:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Dec 2016 16:04:31 -0500    

Click here for diff

\crosstabview's complaint about multiple entries for the same crosstab  
cell quoted the wrong row and/or column values.  It would accidentally  
appear to work if the data had been in strcmp() order to start with,  
which probably explains how we missed noticing this during development.  
  
This could be fixed in more than one way, but the way I chose was to  
hang onto both result pointers from bsearch() and use those to get at  
the value names.  
  
In passing, avoid casting away const in the bsearch comparison functions.  
No bug there, just poor style.  
  
Per bug #14476 from Tomonari Katsumata.  Back-patch to 9.6 where  
\crosstabview was introduced.  
  
Report: https://postgr.es/m/[email protected]  

M src/bin/psql/crosstabview.c
M src/test/regress/expected/psql_crosstab.out
M src/test/regress/sql/psql_crosstab.sql

pg_dumpall: Include --verbose option in --help output

commit   : 86d216c77549e200b95bed487b6fb87d99a1e789    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 24 Dec 2016 01:41:59 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 24 Dec 2016 01:41:59 -0500    

Click here for diff

The -v/--verbose option was not included in the output from --help for  
pg_dumpall even though it's in the pg_dumpall documentation and has  
apparently been around since pg_dumpall was reimplemented in C in 2002.  
  
Fix that by adding it.  
  
Pointed out by Daniel Westermann.  
  
Back-patch to all supported branches.  
  
Discussion: https://www.postgresql.org/message-id/2020970042.4589542.1482482101585.JavaMail.zimbra%40dbi-services.com  

M src/bin/pg_dump/pg_dumpall.c

Fix tab completion in psql for ALTER DEFAULT PRIVILEGES

commit   : f3fd531a51df2a73d8517a542e6999e0186e586b    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 23 Dec 2016 21:01:29 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 23 Dec 2016 21:01:29 -0500    

Click here for diff

When providing tab completion for ALTER DEFAULT PRIVILEGES, we are  
including the list of roles as possible options for completion after the  
GRANT or REVOKE.  Further, we accept FOR ROLE/IN SCHEMA at the same time  
and in either order, but the tab completion was only working for one or  
the other.  Lastly, we weren't using the actual list of allowed kinds of  
objects for default privileges for completion after the 'GRANT X ON' but  
instead were completeing to what 'GRANT X ON' supports, which isn't the  
ssame at all.  
  
Address these issues by improving the forward tab-completion for ALTER  
DEFAULT PRIVILEGES and then constrain and correct how the tail  
completion is done when it is for ALTER DEFAULT PRIVILEGES.  
  
Back-patch the forward/tail tab-completion to 9.6, where we made it easy  
to handle such cases.  
  
For 9.5 and earlier, correct the initial tab-completion to at least be  
correct as far as it goes and then add a check for GRANT/REVOKE to only  
tab-complete when the GRANT/REVOKE is the start of the command, so we  
don't try to do tab-completion after we get to the GRANT/REVOKE part of  
the ALTER DEFAULT PRIVILEGES command, which is better than providing  
incorrect completions.  
  
Initial patch for master and 9.6 by Gilles Darold, though I cleaned it  
up and added a few comments.  All bugs in the 9.5 and earlier patch are  
mine.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Replace enum InhOption with simple boolean.

commit   : fe591f8bf68db9bf81f278acce6239ee68cd4ed6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Dec 2016 13:35:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Dec 2016 13:35:11 -0500    

Click here for diff

Now that it has only INH_NO and INH_YES values, it's just weird that  
it's not a plain bool, so make it that way.  
  
Also rename RangeVar.inhOpt to "inh", to be like RangeTblEntry.inh.  
My recollection is that we gave it a different name specifically because  
it had a different representation than the derived bool value, but it  
no longer does.  And this is a good forcing function to be sure we  
catch any places that are affected by the change.  
  
Bump catversion because of possible effect on stored RangeVar nodes.  
I'm not exactly convinced that we ever store RangeVar on disk, but  
we have a readfuncs function for it, so be cautious.  (If we do do so,  
then commit e13486eba was in error not to bump catversion.)  
  
Follow-on to commit e13486eba.  
  
Discussion: http://postgr.es/m/CA+TgmoYe+EG7LdYX6pkcNxr4ygkP4+A=jm9o-CPXyOvRiCNwaQ@mail.gmail.com  

M src/backend/commands/lockcmds.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/include/catalog/catversion.h
M src/include/nodes/primnodes.h

Remove unnecessary casts of makeNode() result

commit   : 158df30359025d74daee74a3b927fd07c3b1a413    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Dec 2016 12:00:00 -0500    

Click here for diff

makeNode() is already a macro that has the right result pointer type, so  
casting it again to the same type is unnecessary.  

M src/backend/commands/tablecmds.c
M src/backend/executor/execQual.c
M src/backend/replication/repl_gram.y
M src/backend/rewrite/rowsecurity.c

Doc: improve index entry for "median".

commit   : 3c9d398484fb6e188e665be8299d6e5e89924c94    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Dec 2016 12:53:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Dec 2016 12:53:09 -0500    

Click here for diff

We had an index entry for "median" attached to the percentile_cont function  
entry, which was pretty useless because a person following the link would  
never realize that that function was the one they were being hinted to use.  
  
Instead, make the index entry point at the example in syntax-aggregates,  
and add a <seealso> link to "percentile".  
  
Also, since that example explicitly claims to be calculating the median,  
make it use percentile_cont not percentile_disc.  This makes no difference  
in terms of the larger goals of that section, but so far as I can find,  
nearly everyone thinks that "median" means the continuous not discrete  
calculation.  
  
Per gripe from Steven Winfield.  Back-patch to 9.4 where we introduced  
percentile_cont.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/syntax.sgml

Spellcheck: s/descendent/descendant/g

commit   : ff33d1456ea098e160cbbc74b332656c06abc2ab    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Dec 2016 11:53:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Dec 2016 11:53:35 -0500    

Click here for diff

I got a little annoyed by reading documentation paragraphs containing  
both spellings within a few lines of each other.  My dictionary says  
"descendant" is the preferred spelling, and it's certainly the majority  
usage in our tree, so standardize on that.  
  
For one usage in parallel.sgml, I thought it better to rewrite to avoid  
the term altogether.  

M doc/src/sgml/parallel.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/alter_table.sgml
M src/backend/executor/execParallel.c

pg_dump: Remove obsolete handling of sequence names

commit   : 3e6639a465a5702d0aa98fc756b5ab8c7f97cde8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Dec 2016 12:00:00 -0500    

Click here for diff

There was code that attempted to check whether the sequence name stored  
inside the sequence was the same as the name in pg_class.  But that code  
was already ifdef'ed out, and now that the sequence no longer stores its  
own name, it's altogether obsolete, so remove it.  

M src/bin/pg_dump/pg_dump.c

Remove sql_inheritance GUC.

commit   : e13486eba05cc46951a34263d19b65d1eca0176b    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 23 Dec 2016 07:35:01 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 23 Dec 2016 07:35:01 -0500    

Click here for diff

This backward-compatibility GUC is long overdue for removal.  
  
Discussion: http://postgr.es/m/CA+TgmoYe+EG7LdYX6pkcNxr4ygkP4+A=jm9o-CPXyOvRiCNwaQ@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/queries.sgml
M src/backend/commands/lockcmds.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/makefuncs.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/nodes/primnodes.h
M src/include/parser/parse_clause.h
M src/include/utils/guc.h

Remove _hash_chgbufaccess().

commit   : 7819ba1ef6c5297b7e27878d2b3d30c5bcef8939    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 23 Dec 2016 07:14:37 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 23 Dec 2016 07:14:37 -0500    

Click here for diff

This is basically for the same reasons I got rid of _hash_wrtbuf()  
in commit 25216c98938495fd741bf585dcbef45b3a9ffd40: it's not  
convenient to have a function which encapsulates MarkBufferDirty(),  
especially as we move towards having hash indexes be WAL-logged.  
  
Patch by me, reviewed (but not entirely endorsed) by Amit Kapila.  

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/include/access/hash.h

Improve RLS documentation with respect to COPY

commit   : 0a85c102254b72ec7ce16bc504206a1a5c84bd76    
  
author   : Joe Conway <[email protected]>    
date     : Thu, 22 Dec 2016 17:56:50 -0800    
  
committer: Joe Conway <[email protected]>    
date     : Thu, 22 Dec 2016 17:56:50 -0800    

Click here for diff

Documentation for pg_restore said COPY TO does not support row security  
when in fact it should say COPY FROM. Fix that.  
  
While at it, make it clear that "COPY FROM" does not allow RLS to be  
enabled and INSERT should be used instead. Also that SELECT policies  
will apply to COPY TO statements.  
  
Back-patch to 9.5 where RLS first appeared.  
  
Author: Joe Conway  
Reviewed-By: Dean Rasheed and Robert Haas  
Discussion: https://postgr.es/m/5744FA24.3030008%40joeconway.com  

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

Fix tuple routing in cases where tuple descriptors don't match.

commit   : 2ac3ef7a01df859c62d0a02333b646d65eaec5ff    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Dec 2016 17:31:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Dec 2016 17:31:52 -0500    

Click here for diff

The previous coding failed to work correctly when we have a  
multi-level partitioned hierarchy where tables at successive levels  
have different attribute numbers for the partition key attributes.  To  
fix, have each PartitionDispatch object store a standalone  
TupleTableSlot initialized with the TupleDesc of the corresponding  
partitioned table, along with a TupleConversionMap to map tuples from  
the its parent's rowtype to own rowtype.  After tuple routing chooses  
a leaf partition, we must use the leaf partition's tuple descriptor,  
not the root table's.  To that end, a dedicated TupleTableSlot for  
tuple routing is now allocated in EState.  
  
Amit Langote  

M src/backend/catalog/partition.c
M src/backend/commands/copy.c
M src/backend/executor/nodeModifyTable.c
M src/include/catalog/partition.h
M src/include/nodes/execnodes.h
M src/test/regress/expected/insert.out
M src/test/regress/sql/insert.sql

Use TSConfigRelationId in AlterTSConfiguration()

commit   : 12bd7dd317e8f4346fb3507578aca790ede6ebea    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 22 Dec 2016 17:08:43 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 22 Dec 2016 17:08:43 -0500    

Click here for diff

When we are altering a text search configuration, we are getting the  
tuple from pg_ts_config and using its OID, so use TSConfigRelationId  
when invoking any post-alter hooks and setting the object address.  
  
Further, in the functions called from AlterTSConfiguration(), we're  
saving information about the command via  
EventTriggerCollectAlterTSConfig(), so we should be setting  
commandCollected to true.  Also add a regression test to  
test_ddl_deparse for ALTER TEXT SEARCH CONFIGURATION.  
  
Author: Artur Zakirov, a few additional comments by me  
Discussion: https://www.postgresql.org/message-id/57a71eba-f2c7-e7fd-6fc0-2126ec0b39bd%40postgrespro.ru  
  
Back-patch the fix for the InvokeObjectPostAlterHook() call to 9.3 where  
it was introduced, and the fix for the ObjectAddressSet() call and  
setting commandCollected to true to 9.5 where those changes to  
ProcessUtilitySlow() were introduced.  

M src/backend/commands/tsearchcmds.c
M src/backend/tcop/utility.c
M src/test/modules/test_ddl_deparse/Makefile
A src/test/modules/test_ddl_deparse/expected/alter_ts_config.out
A src/test/modules/test_ddl_deparse/sql/alter_ts_config.sql

Fix CREATE TABLE ... LIKE ... WITH OIDS.

commit   : 1ead0208b2178089b024caa2d1465a3f3056a45c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Dec 2016 16:23:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Dec 2016 16:23:33 -0500    

Click here for diff

Having a WITH OIDS specification should result in the creation of an OID  
column, but commit b943f502b broke that in the case that there were LIKE  
tables without OIDS.  Commentary in that patch makes it look like this was  
intentional, but if so it was based on a faulty reading of what inheritance  
does: the parent tables can add an OID column, but they can't subtract one.  
AFAICS, the behavior ought to be that you get an OID column if any of the  
inherited tables, LIKE tables, or WITH clause ask for one.  
  
Also, revert that patch's unnecessary split of transformCreateStmt's loop  
over the tableElts list into two passes.  That seems to have been based on  
a misunderstanding as well: we already have two-pass processing here,  
we don't need three passes.  
  
Per bug #14474 from Jeff Dafoe.  Back-patch to 9.6 where the misbehavior  
was introduced.  
  
Report: https://postgr.es/m/[email protected]  

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

Update sequence_1.out for recent changes

commit   : 22434dd06bbc5774c7bbffa5bf2bef3ead50c2f2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Dec 2016 12:00:00 -0500    

Click here for diff

M src/test/regress/expected/sequence_1.out

doc: Further speed improvements for HTML XSLT build

commit   : 909cb78a8cce73c9678ddb3269b56e31b56e084b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Dec 2016 12:00:00 -0500    

Click here for diff

M doc/src/sgml/stylesheet-speedup-common.xsl
M doc/src/sgml/stylesheet-speedup-xhtml.xsl

Fix handling of expanded objects in CoerceToDomain and CASE execution.

commit   : cd1b215692d2cadf499936dba05f1f60bce59344    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Dec 2016 15:01:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Dec 2016 15:01:27 -0500    

Click here for diff

When the input value to a CoerceToDomain expression node is a read-write  
expanded datum, we should pass a read-only pointer to any domain CHECK  
expressions and then return the original read-write pointer as the  
expression result.  Previously we were blindly passing the same pointer to  
all the consumers of the value, making it possible for a function in CHECK  
to modify or even delete the expanded value.  (Since a plpgsql function  
will absorb a passed-in read-write expanded array as a local variable  
value, it will in fact delete the value on exit.)  
  
A similar hazard of passing the same read-write pointer to multiple  
consumers exists in domain_check() and in ExecEvalCase, so fix those too.  
  
The fix requires adding MakeExpandedObjectReadOnly calls at the appropriate  
places, which is simple enough except that we need to get the data type's  
typlen from somewhere.  For the domain cases, solve this by redefining  
DomainConstraintRef.tcache as okay for callers to access; there wasn't any  
reason for the original convention against that, other than not wanting the  
API of typcache.c to be any wider than it had to be.  For CASE, there's  
no good solution except to add a syscache lookup during executor start.  
  
Per bug #14472 from Marcos Castedo.  Back-patch to 9.5 where expanded  
values were introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execQual.c
M src/backend/utils/adt/domains.c
M src/include/nodes/execnodes.h
M src/include/utils/typcache.h
M src/test/regress/expected/case.out
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/case.sql
M src/test/regress/sql/plpgsql.sql

Skip checkpoints, archiving on idle systems.

commit   : 6ef2eba3f57f17960b7cd4958e18aa79e357de2f    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 22 Dec 2016 11:31:50 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 22 Dec 2016 11:31:50 -0800    

Click here for diff

Some background activity (like checkpoints, archive timeout, standby  
snapshots) is not supposed to happen on an idle system. Unfortunately  
so far it was not easy to determine when a system is idle, which  
defeated some of the attempts to avoid redundant activity on an idle  
system.  
  
To make that easier, allow to make individual WAL insertions as not  
being "important". By checking whether any important activity happened  
since the last time an activity was performed, it now is easy to check  
whether some action needs to be repeated.  
  
Use the new facility for checkpoints, archive timeout and standby  
snapshots.  
  
The lack of a facility causes some issues in older releases, but in my  
opinion the consequences (superflous checkpoints / archived segments)  
aren't grave enough to warrant backpatching.  
  
Author: Michael Paquier, editorialized by Andres Freund  
Reviewed-By: Andres Freund, David Steele, Amit Kapila, Kyotaro HORIGUCHI  
Bug: #13685  
Discussion:  
    https://www.postgresql.org/message-id/[email protected]  
    https://www.postgresql.org/message-id/CAB7nPqQcPqxEM3S735Bd2RzApNqSNJVietAC=6kfkYv_45dKwA@mail.gmail.com  
Backpatch: -  

M doc/src/sgml/config.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xloginsert.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/replication/logical/message.c
M src/backend/storage/ipc/standby.c
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xloginsert.h

Fix broken error check in _hash_doinsert.

commit   : 097e41439d69e11fb870e009b1ac64dda4f01c3d    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Dec 2016 13:54:40 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Dec 2016 13:54:40 -0500    

Click here for diff

You can't just cast a HashMetaPage to a Page, because the meta page  
data is stored after the page header, not at offset 0.  Fortunately,  
this didn't break anything because it happens to find hashm_bsize  
at the offset at which it expects to find pd_pagesize_version, and  
the values are close enough to the same that this works out.  
  
Still, it's a bug, so back-patch to all supported versions.  
  
Mithun Cy, revised a bit by me.  

M src/backend/access/hash/hashinsert.c

commit   : 2f802d95b4904dbed3dfdca1b3a607cd085d2e20    
  
author   : Joe Conway <[email protected]>    
date     : Thu, 22 Dec 2016 09:48:05 -0800    
  
committer: Joe Conway <[email protected]>    
date     : Thu, 22 Dec 2016 09:48:05 -0800    

Click here for diff

When libpq encounters a connection-level error, e.g. runs out of memory  
while forming a result, there will be no error associated with PGresult,  
but a message will be placed into PGconn's error buffer. postgres_fdw  
takes care to use the PGconn error message when PGresult does not have  
one, but dblink has been negligent in that regard. Modify dblink to mirror  
what postgres_fdw has been doing.  
  
Back-patch to all supported branches.  
  
Author: Joe Conway  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/02fa2d90-2efd-00bc-fefc-c23c00eb671e%40joeconway.com  

M contrib/dblink/dblink.c

Code review for ATExecAttachPartition.

commit   : 3ee80672847c4100d5f9efdb9ea19cb96506d089    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Dec 2016 12:39:19 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Dec 2016 12:39:19 -0500    

Click here for diff

Amit Langote.  Most of this reported by Ɓlvaro Herrera.  

M src/backend/commands/tablecmds.c

commit   : c4448683893bd37b59003603bc9075d362e81b5a    
  
author   : Joe Conway <[email protected]>    
date     : Thu, 22 Dec 2016 09:19:44 -0800    
  
committer: Joe Conway <[email protected]>    
date     : Thu, 22 Dec 2016 09:19:44 -0800    

Click here for diff

When dblink uses a postgres_fdw server name for its connection, it  
is possible for the connection to have options that are invalid  
with dblink (e.g. "updatable"). The recommended way to avoid this  
problem is to use dblink_fdw servers instead. However there are use  
cases for using postgres_fdw, and possibly other FDWs, for dblink  
connection options, therefore protect against trying to use any  
options that do not apply by using is_valid_dblink_option() when  
building the connection string from the options.  
  
Back-patch to 9.3. Although 9.2 supports FDWs for connection info,  
is_valid_dblink_option() did not yet exist, and neither did  
postgres_fdw, at least in the postgres source tree. Given the lack  
of previous complaints, fixing that seems too invasive/not worth it.  
  
Author: Corey Huinker  
Reviewed-By: Joe Conway  
Discussion: https://postgr.es/m/CADkLM%3DfWyXVEyYcqbcRnxcHutkP45UHU9WD7XpdZaMfe7S%3DRwA%40mail.gmail.com  

M contrib/dblink/dblink.c

Simplify tape block format.

commit   : 01ec25631fe0eae6af67c29c61a358dc6b92ed3c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 22 Dec 2016 18:45:00 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 22 Dec 2016 18:45:00 +0200    

Click here for diff

No more indirect blocks. The blocks form a linked list instead.  
  
This saves some memory, because we don't need to have a buffer in memory to  
hold the indirect block (or blocks). To reflect that, TAPE_BUFFER_OVERHEAD  
is reduced from 3 to 1 buffer, which allows using more memory for building  
the initial runs.  
  
Reviewed by Peter Geoghegan and Robert Haas.  
  
Discussion: https://www.postgresql.org/message-id/34678beb-938e-646e-db9f-a7def5c44ada%40iki.fi  

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

Give a useful error message if uuid-ossp is built without preconfiguration.

commit   : b86515da1a73d0a2e23aca728f18b5f9e809e89f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Dec 2016 11:19:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Dec 2016 11:19:04 -0500    

Click here for diff

Before commit b8cc8f947, it was possible to build contrib/uuid-ossp without  
having told configure you meant to; you could just cd into that directory  
and "make".  That no longer works because the code depends on configure to  
have done header and library probes, but the ensuing error messages are  
not so easy to interpret if you're not an old C hand.  We've gotten a  
couple of complaints recently from people trying to do this the low-tech  
way, so add an explicit #error directing the user to use --with-uuid.  
  
(In principle we might want to do something similar in the other  
optionally-built contrib modules; but I don't think any of the others have  
ever worked without preconfiguration, so there are no bad habits to break  
people of.)  
  
Back-patch to 9.4 where the previous commit came in.  
  
Report: https://postgr.es/m/CAHeEsBf42AWTnk=1qJvFv+mYgRFm07Knsfuc86Ono8nRjf3tvQ@mail.gmail.com  
Report: https://postgr.es/m/CAKYdkBrUaZX+F6KpmzoHqMtiUqCtAW_w6Dgvr6F0WTiopuGxow@mail.gmail.com  

M contrib/uuid-ossp/uuid-ossp.c

Fix buffer overflow on particularly named files and clarify documentation about output file naming.

commit   : 4032ef18d06aa7a3db515926ddebe8af04e533fe    
  
author   : Michael Meskes <[email protected]>    
date     : Thu, 22 Dec 2016 08:28:13 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Thu, 22 Dec 2016 08:28:13 +0100    

Click here for diff

Patch by Tsunakawa, Takayuki <[email protected]>  

M doc/src/sgml/ref/ecpg-ref.sgml
M src/interfaces/ecpg/preproc/ecpg.c

commit   : ea0aa9698cfa74bb04cf53d813924fe67f278c30    
  
author   : Joe Conway <[email protected]>    
date     : Wed, 21 Dec 2016 15:47:54 -0800    
  
committer: Joe Conway <[email protected]>    
date     : Wed, 21 Dec 2016 15:47:54 -0800    

Click here for diff

When dblink or postgres_fdw detects an error on the remote side of the  
connection, it will try to construct a local error message as best it  
can using libpq's PQresultErrorField(). When no primary message is  
available, it was bailing out with an unhelpful "unknown error". Make  
that message better and more style guide compliant. Per discussion  
on hackers.  
  
Backpatch to 9.2 except postgres_fdw which didn't exist before 9.3.  
  
Discussion: https://postgr.es/m/19872.1482338965%40sss.pgh.pa.us  

M contrib/dblink/dblink.c
M contrib/postgres_fdw/connection.c

Fix detection of unfinished Unicode surrogate pair at end of string.

commit   : a8ae12322ae056ebbe9d83cf16b4c92e86a6ac28    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Dec 2016 17:39:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Dec 2016 17:39:32 -0500    

Click here for diff

The U&'...' and U&"..." syntaxes silently discarded a surrogate pair  
start (that is, a code between U+D800 and U+DBFF) if it occurred at  
the very end of the string.  This seems like an obvious oversight,  
since we throw an error for every other invalid combination of surrogate  
characters, including the very same situation in E'...' syntax.  
  
This has been wrong since the pair processing was added (in 9.0),  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/scan.l

Fix strange behavior (and possible crashes) in full text phrase search.

commit   : 89fcea1ace40bc025beea2758a80bcd56a319a6f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Dec 2016 15:18:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Dec 2016 15:18:25 -0500    

Click here for diff

In an attempt to simplify the tsquery matching engine, the original  
phrase search patch invented rewrite rules that would rearrange a  
tsquery so that no AND/OR/NOT operator appeared below a PHRASE operator.  
But this approach had numerous problems.  The rearrangement step was  
missed by ts_rewrite (and perhaps other places), allowing tsqueries  
to be created that would cause Assert failures or perhaps crashes at  
execution, as reported by Andreas Seltenreich.  The rewrite rules  
effectively defined semantics for operators underneath PHRASE that were  
buggy, or at least unintuitive.  And because rewriting was done in  
tsqueryin() rather than at execution, the rearrangement was user-visible,  
which is not very desirable --- for example, it might cause unexpected  
matches or failures to match in ts_rewrite.  
  
As a somewhat independent problem, the behavior of nested PHRASE operators  
was only sane for left-deep trees; queries like "x <-> (y <-> z)" did not  
behave intuitively at all.  
  
To fix, get rid of the rewrite logic altogether, and instead teach the  
tsquery execution engine to manage AND/OR/NOT below a PHRASE operator  
by explicitly computing the match location(s) and match widths for these  
operators.  
  
This requires introducing some additional fields into the publicly visible  
ExecPhraseData struct; but since there's no way for third-party code to  
pass such a struct to TS_phrase_execute, it shouldn't create an ABI problem  
as long as we don't move the offsets of the existing fields.  
  
Another related problem was that index searches supposed that "!x <-> y"  
could be lossily approximated as "!x & y", which isn't correct because  
the latter will reject, say, "x q y" which the query itself accepts.  
This required some tweaking in TS_execute_ternary along with the main  
tsquery engine.  
  
Back-patch to 9.6 where phrase operators were introduced.  While this  
could be argued to change behavior more than we'd like in a stable branch,  
we have to do something about the crash hazards and index-vs-seqscan  
inconsistency, and it doesn't seem desirable to let the unintuitive  
behaviors induced by the rewriting implementation stand as precedent.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/textsearch.sgml
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/tsvector_op.c
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/tsearch.sql
M src/test/regress/sql/tstypes.sql

Improve ALTER TABLE documentation

commit   : 2d1018ca56f5ddaf0bfb5b4d0133283f3e823301    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 21 Dec 2016 15:03:32 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 21 Dec 2016 15:03:32 -0500    

Click here for diff

The ALTER TABLE documentation wasn't terribly clear when it came to  
which commands could be combined together and what it meant when they  
were.  
  
In particular, SET TABLESPACE *can* be combined with other commands,  
when it's operating against a single table, but not when multiple tables  
are being moved with ALL IN TABLESPACE.  Further, the actions are  
applied together but not really in 'parallel', at least today.  
  
Pointed out by: Amit Langote  
  
Improved wording from Tom.  
  
Back-patch to 9.4, where the ALL IN TABLESPACE option was added.  
  
Discussion: https://www.postgresql.org/message-id/14c535b4-13ef-0590-1b98-76af355a0763%40lab.ntt.co.jp  

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

Fix dumping of casts and transforms using built-in functions

commit   : 2259bf672cb45b4104dcb835354beeb1c6105b0e    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 21 Dec 2016 13:47:06 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 21 Dec 2016 13:47:06 -0500    

Click here for diff

In pg_dump.c dumpCast() and dumpTransform(), we would happily ignore the  
cast or transform if it happened to use a built-in function because we  
weren't including the information about built-in functions when querying  
pg_proc from getFuncs().  
  
Modify the query in getFuncs() to also gather information about  
functions which are used by user-defined casts and transforms (where  
"user-defined" means "has an OID >= FirstNormalObjectId").  This also  
adds to the TAP regression tests for 9.6 and master to cover these  
types of objects.  
  
Back-patch all the way for casts, back to 9.5 for transforms.  
  
Discussion: https://www.postgresql.org/message-id/flat/20160504183952.GE10850%40tamriel.snowman.net  

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

For 8.0 servers, get last built-in oid from pg_database

commit   : 19990918d3fa2a445561627ed415b5891602f7fe    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 21 Dec 2016 13:47:06 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 21 Dec 2016 13:47:06 -0500    

Click here for diff

We didn't start ensuring that all built-in objects had OIDs less than  
16384 until 8.1, so for 8.0 servers we still need to query the value out  
of pg_database.  We need this, in particular, to distinguish which casts  
were built-in and which were user-defined.  
  
For HEAD, we only worry about going back to 8.0, for the back-branches,  
we also ensure that 7.0-7.4 work.  
  
Discussion: https://www.postgresql.org/message-id/flat/20160504183952.GE10850%40tamriel.snowman.net  

M src/bin/pg_dump/pg_dump.c

Fix order of operations in CREATE OR REPLACE VIEW.

commit   : 58b1362642d47bd7a7ed1157035a38671555e860    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 21 Dec 2016 16:58:18 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 21 Dec 2016 16:58:18 +0000    

Click here for diff

When CREATE OR REPLACE VIEW acts on an existing view, don't update the  
view options until after the view query has been updated.  
  
This is necessary in the case where CREATE OR REPLACE VIEW is used on  
an existing view that is not updatable, and the new view is updatable  
and specifies the WITH CHECK OPTION. In this case, attempting to apply  
the new options to the view before updating its query fails, because  
the options are applied using the ALTER TABLE infrastructure which  
checks that WITH CHECK OPTION is only applied to an updatable view.  
  
If new columns are being added to the view, that is also done using  
the ALTER TABLE infrastructure, but it is important that that still be  
done before updating the view query, because the rules system checks  
that the query columns match those on the view relation. Added a  
comment to explain that, in case someone is tempted to move that to  
where the view options are now being set.  
  
Back-patch to 9.4 where WITH CHECK OPTION was added.  
  
Report: https://postgr.es/m/CAEZATCUp%3Dz%3Ds4SzZjr14bfct_bdJNwMPi-gFi3Xc5k1ntbsAgQ%40mail.gmail.com  

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

Convert elog() to ereport() and do some wordsmithing.

commit   : cd510f04137a1436ad6029da4998f5224395a08d    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 21 Dec 2016 11:47:13 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 21 Dec 2016 11:47:13 -0500    

Click here for diff

It's not entirely clear that we should log a message here at all, but  
it's certainly wrong to use elog() for a message that should clearly  
be translatable.  
  
Amit Langote  

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

Refactor partition tuple routing code to reduce duplication.

commit   : 1fc5c4945047e8e8c7aa1644b52dd0187b729181    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 21 Dec 2016 11:36:10 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 21 Dec 2016 11:36:10 -0500    

Click here for diff

Amit Langote  

M src/backend/commands/copy.c
M src/backend/executor/execMain.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/executor.h

Fix corner-case bug in WaitEventSetWaitBlock on Windows.

commit   : 3b790d256f8489d0765c3389d6860f1c6b4a9b2d    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 21 Dec 2016 11:01:48 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 21 Dec 2016 11:01:48 -0500    

Click here for diff

If we do not reset the FD_READ event, WaitForMultipleObjects won't  
return it again again unless we've meanwhile read from the socket,  
which is generally true but not guaranteed.  WaitEventSetWaitBlock  
itself may fail to return the event to the caller if the latch is  
also set, and even if we changed that, the caller isn't obliged to  
handle all returned events at once.  On non-Windows systems, the  
socket-read event is purely level-triggered, so this issue does  
not exist.  To fix, make Windows reset the event when needed.  
  
This bug was introduced by 98a64d0bd713cb89e61bef6432befc4b7b5da59e,  
and causes hangs when trying to use the pldebugger extension.  
  
Patch by Amit Kapial.  Reported and tested by Ashutosh Sharma, who  
also provided some analysis.  Further analysis by Michael Paquier.  

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

Refactor merge path generation code.

commit   : 59649c3f1cbd536314c0060dcabd234deab148b2    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 21 Dec 2016 09:44:33 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 21 Dec 2016 09:44:33 -0500    

Click here for diff

This shouldn't change the set of paths that get generated in any  
way, but it is preparatory work for further changes to allow a  
partial path to be merge-joined witih a non-partial path to produce  
a partial join path.  
  
Dilip Kumar, with cosmetic adjustments by me.  

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

Reorder pg_sequence columns to avoid alignment issue

commit   : f3b421da5f4addc95812b9db05a24972b8fd9739    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Dec 2016 12:00:00 -0500    

Click here for diff

On AIX, doubles are aligned at 4 bytes, but int64 is aligned at 8 bytes.  
Our code assumes that doubles have alignment that can also be applied to  
int64, but that fails in this case.  One effect is that  
heap_form_tuple() writes tuples in a different layout than  
Form_pg_sequence expects.  
  
Rather than rewrite the whole alignment code, work around the issue by  
reordering the columns in pg_sequence so that the first int64 column  
naturally comes out at an 8-byte boundary.  

M doc/src/sgml/catalogs.sgml
M src/backend/commands/sequence.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_sequence.h

Forbid invalid combination of options in pg_basebackup.

commit   : ecbdc4c555f43b1ac284c734752b00c2ea6f277b    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 21 Dec 2016 20:27:37 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 21 Dec 2016 20:27:37 +0900    

Click here for diff

Commit 56c7d8d4552180fd66fe48423bb2a9bb767c2d87 allowed pg_basebackup  
to stream WAL in tar mode. But there is the restriction that WAL  
streaming in tar mode works only when the value - (dash) is not  
specified as output directory. This means that the combination of  
three options "-D -", "-F t" and "-X stream" is invalid. However,  
previously, even when those options were specified at the same time,  
pg_basebackup background process unexpectedly started streaming WAL.  
And then it exited with an error.  
  
This commit changes pg_basebackup so that it errors out on such  
invalid combination of options at the beginning.  
  
Reviewed by Magnus Hagander, and patch by me.  

M src/bin/pg_basebackup/pg_basebackup.c

Fix minor oversights in nodeAgg.c.

commit   : c080b223a7a3991524a5287416a0ad756c15a098    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Dec 2016 19:22:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Dec 2016 19:22:02 -0500    

Click here for diff

aggstate->evalproj is always set up by ExecInitAgg, so there's no  
need to test.  Doing so led Coverity to think that we might be  
intending "slot" to be possibly NULL here, and it quite properly  
complained that the rest of combine_aggregates() wasn't prepared  
for that.  
  
Also fix a couple of obvious thinkos in Asserts checking that  
"inputoff" isn't past the end of the slot.  
  
Errors introduced in commit 8ed3f11bb, so no need for back-patch.  

M src/backend/executor/nodeAgg.c

Fix minor error message style violation.

commit   : 7d41a2bd3eef4de64ae8f6f683457f12f9407c5d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Dec 2016 18:54:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Dec 2016 18:54:13 -0500    

Click here for diff

Primary error messages should not end with a period, since they're  
generally not written as full sentences.  Oversight in 41493bac3.  

M src/backend/libpq/auth.c

Add pg_sequence system catalog

commit   : 1753b1b027035029c2a2a1649065762fafbf63f3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Dec 2016 12:00:00 -0500    

Click here for diff

Move sequence metadata (start, increment, etc.) into a proper system  
catalog instead of storing it in the sequence heap object.  This  
separates the metadata from the sequence data.  Sequence metadata is now  
operated on transactionally by DDL commands, whereas previously  
rollbacks of sequence-related DDL commands would be ignored.  
  
Reviewed-by: Andreas Karlsson <[email protected]>  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/Makefile
M src/backend/catalog/dependency.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/system_views.sql
M src/backend/commands/sequence.c
M src/backend/utils/cache/syscache.c
M src/bin/pg_dump/pg_dump.c
M src/include/catalog/catversion.h
M src/include/catalog/indexing.h
A src/include/catalog/pg_sequence.h
M src/include/commands/sequence.h
M src/include/utils/syscache.h
M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/sequence.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/sequence.sql
M src/test/regress/sql/updatable_views.sql

Fix sharing Agg transition state of DISTINCT or ordered aggs.

commit   : db80acfc9d50ac56811d22802ab3d822ab313055    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 20 Dec 2016 09:20:17 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 20 Dec 2016 09:20:17 +0200    

Click here for diff

If a query contained two aggregates that could share the transition value,  
we would correctly collect the input into a tuplesort only once, but  
incorrectly run the transition function over the accumulated input twice,  
in finalize_aggregates(). That caused a crash, when we tried to call  
tuplesort_performsort() on an already-freed NULL tuplestore.  
  
Backport to 9.6, where sharing of transition state and this bug were  
introduced.  
  
Analysis by Tom Lane.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Invalid parent's relcache after CREATE TABLE .. PARTITION OF.

commit   : 7cd0fd655d681e0ed5f7269fa421d977f1df0889    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Dec 2016 22:53:30 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Dec 2016 22:53:30 -0500    

Click here for diff

Otherwise, subsequent commands in the same transaction see the wrong  
partition descriptor.  
  
Amit Langote.  Reported by Tomas Vondra and David Fetter.  Reviewed  
by me.  
  
Discussion: http://postgr.es/m/22dd313b-d7fd-22b5-0787-654845c8f849%402ndquadrant.com  
Discussion: http://postgr.es/m/20161215090916.GB20659%40fetter.org  

M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/include/catalog/heap.h

Provide a DSA area for all parallel queries.

commit   : e13029a5ce353574516c64fd1ec9c50201e705fd    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Dec 2016 16:47:15 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Dec 2016 16:47:15 -0500    

Click here for diff

This will allow future parallel query code to dynamically allocate  
storage shared by all participants.  
  
Thomas Munro, with assorted changes by me.  

M doc/src/sgml/monitoring.sgml
M src/backend/executor/execParallel.c
M src/include/executor/execParallel.h
M src/include/nodes/execnodes.h
M src/include/storage/lwlock.h

Fix handling of phrase operator removal while removing tsquery stopwords.

commit   : 2604438472c897fbbd1568b1a8ee177ba8cdb6e3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Dec 2016 13:49:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Dec 2016 13:49:45 -0500    

Click here for diff

The distance of a removed phrase operator should propagate up to a  
parent phrase operator if there is one, but this only worked correctly  
in left-deep trees.  Throwing in a few parentheses confused it completely,  
as indeed was illustrated by bizarre results in existing regression test  
cases.  
  
To fix, track unaccounted-for distances that should propagate to the left  
and to the right of the current node, rather than trying to make it work  
with only one returned distance.  
  
Also make some adjustments to behave as well as we can for cases of  
intermixed phrase and regular (AND/OR) operators.  I don't think it's  
possible to be 100% correct for that without a rethinking of the tsquery  
representation; for example, maybe we should just not drop stopword nodes  
at all underneath phrase operators.  But this is better than it was,  
and changing tsquery representation wouldn't be safely back-patchable.  
  
While at it, I simplified the API of the clean_fakeval_intree function  
a bit by getting rid of the "char *result" output parameter; that wasn't  
doing anything that wasn't redundant with whether the result node is  
NULL or not, and testing for NULL seems a lot clearer/safer.  
  
This is part of a larger project to fix various infelicities in the  
phrase-search implementation, but this part seems comittable on its own.  
  
Back-patch to 9.6 where phrase operators were introduced.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Fix locking problem in _hash_squeezebucket() / _hash_freeovflpage().

commit   : dd728826c538f000220af98de025c00114ad0631    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Dec 2016 12:31:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Dec 2016 12:31:50 -0500    

Click here for diff

A bucket squeeze operation needs to lock each page of the bucket  
before releasing the prior page, but the previous coding fumbled the  
locking when freeing an overflow page during a bucket squeeze  
operation.  Commit 6d46f4783efe457f74816a75173eb23ed8930020  
introduced this bug.  
  
Amit Kapila, with help from Kuntal Ghosh and Dilip Kumar, after  
an initial trouble report by Jeff Janes.  Reviewed by me.  I also  
fixed a problem with a comment.  

M src/backend/access/hash/hashovfl.c
M src/include/access/hash.h

Remove unused file.

commit   : 668dbbec27da05b35a6972e9d833115dce0b6ccc    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Dec 2016 11:29:31 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Dec 2016 11:29:31 -0500    

Click here for diff

This was added in 105409746499657acdffc109db9d343b464bda1f, but has  
never been used for anything as far as I can tell.  There seems to  
be no reason to keep it.  

D src/include/storage/pos.h

Support quorum-based synchronous replication.

commit   : 3901fd70cc7ccacef1b0549a6835bb7d8dcaae43    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 19 Dec 2016 21:15:30 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 19 Dec 2016 21:15:30 +0900    

Click here for diff

This feature is also known as "quorum commit" especially in discussion  
on pgsql-hackers.  
  
This commit adds the following new syntaxes into synchronous_standby_names  
GUC. By using FIRST and ANY keywords, users can specify the method to  
choose synchronous standbys from the listed servers.  
  
  FIRST num_sync (standby_name [, ...])  
  ANY num_sync (standby_name [, ...])  
  
The keyword FIRST specifies a priority-based synchronous replication  
which was available also in 9.6 or before. This method makes transaction  
commits wait until their WAL records are replicated to num_sync  
synchronous standbys chosen based on their priorities.  
  
The keyword ANY specifies a quorum-based synchronous replication  
and makes transaction commits wait until their WAL records are  
replicated to *at least* num_sync listed standbys. In this method,  
the values of sync_state.pg_stat_replication for the listed standbys  
are reported as "quorum". The priority is still assigned to each standby,  
but not used in this method.  
  
The existing syntaxes having neither FIRST nor ANY keyword are still  
supported. They are the same as new syntax with FIRST keyword, i.e.,  
a priorirty-based synchronous replication.  
  
Author: Masahiko Sawada  
Reviewed-By: Michael Paquier, Amit Kapila and me  
Discussion: <CAD21AoAACi9NeC_ecm+Vahm+MMA6nYh=Kqs3KB3np+MBOS_gZg@mail.gmail.com>  
  
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 doc/src/sgml/monitoring.sgml
M src/backend/replication/Makefile
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/postgresql.conf.sample
M src/include/replication/syncrep.h
M src/test/recovery/t/007_sync_rep.pl

Fix base backup rate limiting in presence of slow i/o

commit   : 10238fad0389175f71739bc9b4d00bb24d9b8c44    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 19 Dec 2016 10:11:04 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 19 Dec 2016 10:11:04 +0100    

Click here for diff

When source i/o on disk was too slow compared to the rate limiting  
specified, the system could end up with a negative value for sleep that  
it never got out of, which caused rate limiting to effectively be  
turned off.  
  
Discussion: https://postgr.es/m/CABUevEy_-e0YvL4ayoX8bH_Ja9w%2BBHoP6jUgdxZuG2nEj3uAfQ%40mail.gmail.com  
  
Analysis by me, patch by Antonin Houska  

M src/backend/replication/basebackup.c

MSVC: Position MSBFLAGS after flags it might override.

commit   : cc07e06b1eac538328b5d8e31e77fdd079135864    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 18 Dec 2016 18:12:23 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 18 Dec 2016 18:12:23 -0500    

Click here for diff

Christian Ullrich  

M src/tools/msvc/build.pl
M src/tools/msvc/clean.bat

In contrib/uuid-ossp, #include headers needed for ntohl() and ntohs().

commit   : 4a0a34b5b678f0292d3a85a85fb10c79c393be26    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 17 Dec 2016 22:24:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 17 Dec 2016 22:24:13 -0500    

Click here for diff

Oversight in commit b8cc8f947.  I just noticed this causes compiler  
warnings on FreeBSD, and it really ought to cause warnings elsewhere too:  
all references I can find say that <arpa/inet.h> is required for these.  
We have a lot of code elsewhere that thinks that both <netinet/in.h>  
and <arpa/inet.h> should be included for these functions, so do it that  
way here too, even though <arpa/inet.h> ought to be sufficient according  
to the references I consulted.  
  
Back-patch to 9.4 where the previous commit landed.  

M contrib/uuid-ossp/uuid-ossp.c

Fix FK-based join selectivity estimation for semi/antijoins.

commit   : 7fa93eec4e0c9c3e801e3c51aa4bae3a38aaa218    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 17 Dec 2016 15:28:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 17 Dec 2016 15:28:54 -0500    

Click here for diff

This case wasn't thought through sufficiently in commit 100340e2d.  
It's true that the FK proves that every outer row has a match in the  
inner table, but we forgot that some of the inner rows might be filtered  
away by WHERE conditions located within the semijoin's RHS.  
  
If the RHS is just one table, we can reasonably take the semijoin  
selectivity as equal to the fraction of the referenced table's rows  
that are expected to survive its restriction clauses.  
  
If the RHS is a join, it's not clear how much of the referenced table  
might get through the join, so fall back to the same rule we were  
already using for other outer-join cases: use the minimum of the  
regular per-clause selectivity estimates.  This gives the same result  
as if we hadn't considered the FK at all when there's a single FK  
column, but it should still help for multi-column FKs, which is the  
case that 100340e2d is really meant to help with.  
  
Back-patch to 9.6 where the previous commit came in.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Remove some trailing whitespace

commit   : b645a05fc6112a4857ceac574d4aa24174a70417    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 17 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 17 Dec 2016 12:00:00 -0500    

Click here for diff

Per discussion, we will not at this time remove trailing whitespace in  
psql output displays where it is part of the actual psql output.  
  
From: Vladimir Rusinov <[email protected]>  

M doc/src/sgml/config.sgml
M doc/src/sgml/parallel.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/prepare.sgml
M doc/src/sgml/ref/reindexdb.sgml

Fix typos in comments

commit   : 01776a07b3fe48ad48b0d9194301438399dfe597    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 17 Dec 2016 14:33:26 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 17 Dec 2016 14:33:26 +0100    

Click here for diff

Michael Paquier  

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

Fix outdated comment in lwlock.c

commit   : 591ccb66d24258f6d1084343b3c33c96e3e2b36d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Dec 2016 15:52:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Dec 2016 15:52:18 -0500    

Click here for diff

Commit 3761fe3c20bb040b15f0e8da58d824631da00caa should have made  
this change, but didn't.  
  
Reported by Ɓlvaro Herrera.  

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

Ensure that num_sync is greater than zero in synchronous_standby_names.

commit   : 93eb619cd35b8adcfe6c86e34ea45d2e8edd322b    
  
author   : Fujii Masao <[email protected]>    
date     : Sat, 17 Dec 2016 02:20:59 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sat, 17 Dec 2016 02:20:59 +0900    

Click here for diff

Previously num_sync could be set to zero and this setting caused  
an assertion failure. This means that multiple synchronous standbys  
code should assume that num_sync is greater than zero.  
Also setting num_sync to zero is nonsense because it's basically  
the configuration for synchronous replication. If users want not to  
make transaction commits wait for any standbys,  
synchronous_standby_names should be emptied to disable synchronous  
replication instead of setting num_sync to zero.  
  
This patch forbids users from setting num_sync to zero in  
synchronous_standby_names. If zero is specified, an error will  
happen during processing the parameter settings.  
  
Back-patch to 9.6 where multiple synchronous standbys feature was added.  
  
Patch by me. Reviewed by Tom Lane.  
Discussion: <CAHGQGwHWB3izc6cXuFLh5kOcAbFXaRhhgwd-X5PeN9TEjxqXwg@mail.gmail.com>  

M src/backend/replication/syncrep.c

Improve documentation around TS_execute().

commit   : 23c75b55aaccddea79545ffaf1cbfc9f1edeaa8c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Dec 2016 11:50:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Dec 2016 11:50:07 -0500    

Click here for diff

I got frustrated by the lack of commentary in this area, so here is some  
reverse-engineered documentation, along with minor stylistic cleanup.  
No code changes more significant than removal of unused variables.  
  
Back-patch to 9.6, not because that's useful in itself, but because  
we have some bugs to fix in phrase search and this would cause merge  
failures if it's only in HEAD.  

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

Simplify LWLock tranche machinery by removing array_base/array_stride.

commit   : 3761fe3c20bb040b15f0e8da58d824631da00caa    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Dec 2016 11:29:23 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Dec 2016 11:29:23 -0500    

Click here for diff

array_base and array_stride were added so that we could identify the  
offset of an LWLock within a tranche, but this facility is only very  
marginally used apart from the main tranche.  So, give every lock in  
the main tranche its own tranche ID and get rid of array_base,  
array_stride, and all that's attached.  For debugging facilities  
(Trace_lwlocks and LWLOCK_STATS) print the pointer address of the  
LWLock using %p instead of the offset.  This is arguably more useful,  
and certainly a lot cheaper.  Drop the offset-within-tranche from  
the information reported to dtrace and from one can't-happen message  
inside lwlock.c.  
  
The main user-visible impact of this change is that pg_stat_activity  
will now report all waits for LWLocks as "LWLock" rather than  
reporting some as "LWLockTranche" and others as "LWLockNamed".  
  
The main motivation for this change is that the need to specify an  
array_base and an array_stride is awkward for parallel query.  There  
is only a very limited supply of tranche IDs so we can't just keep  
allocating new ones, and if we try to use the same tranche IDs every  
time then we run into trouble when multiple parallel contexts are  
use simultaneously.  So if we didn't get rid of this mechanism we'd  
have to make it even more complicated.  By simplifying it in this  
way, we instead reduce the size of the generated code for lwlock.c  
by about 5%.  
  
Discussion: http://postgr.es/m/CA+TgmoYsFn6NUW1x0AZtupJGUAs1UDY4dJtCN47_Q6D0sP80PA@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/slru.c
M src/backend/access/transam/xlog.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/origin.c
M src/backend/replication/slot.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/probes.d
M src/include/access/slru.h
M src/include/pgstat.h
M src/include/storage/lwlock.h

Add missing documentation for effective_io_concurrency tablespace option.

commit   : 4e344c2cf4ff00ca38ea0035bc137dab95fdd0c0    
  
author   : Fujii Masao <[email protected]>    
date     : Sat, 17 Dec 2016 01:25:29 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sat, 17 Dec 2016 01:25:29 +0900    

Click here for diff

The description of effective_io_concurrency option was missing in ALTER  
TABLESPACE docs though it's included in CREATE TABLESPACE one.  
  
Back-patch to 9.6 where effective_io_concurrency tablespace option was added.  
  
Michael Paquier, reported by Marc-Olaf Jaschke  

M doc/src/sgml/ref/alter_tablespace.sgml

Unbreak Finalize HashAggregate over Partial HashAggregate.

commit   : b81b5a96f424531b97cdd1dba97d9d1b9c9d372e    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Dec 2016 10:03:08 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Dec 2016 10:03:08 -0500    

Click here for diff

Commit 5dfc198146b49ce7ecc8a1fc9d5e171fb75f6ba5 introduced the use  
of a new type of hash table with linear reprobing for hash aggregates.  
Such a hash table behaves very poorly if keys are inserted in hash  
order, which does in fact happen in the case where a query use a  
Finalize HashAggregate node fed (via Gather) by a Partial  
HashAggregate node.  In fact, queries with this type of plan tend  
to run effectively forever.  
  
Fix that by seeding the hash value differently in each worker  
(and in the leader, if it participates).  
  
Andres Freund and Robert Haas  

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

Fix more hash index bugs around marking buffers dirty.

commit   : 6a4fe1127c5a0ea1515589e416aa29e088170c0e    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Dec 2016 09:52:04 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Dec 2016 09:52:04 -0500    

Click here for diff

In _hash_freeovflpage(), if we're freeing the overflow page that  
immediate follows the page to which tuples are being moved (the  
confusingly-named "write buffer"), don't forget to mark that  
page dirty after updating its hasho_nextblkno.  
  
In _hash_squeezebucket(), it's not necessary to mark the primary  
bucket page dirty if there are no overflow pages, because there's  
nothing to squeeze in that case.  
  
Amit Kapila, with help from Kuntal Ghosh and Dilip Kumar, after  
an initial trouble report by Jeff Janes.  

M src/backend/access/hash/hashovfl.c

Remove _hash_wrtbuf() in favor of calling MarkBufferDirty().

commit   : 25216c98938495fd741bf585dcbef45b3a9ffd40    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Dec 2016 09:29:21 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Dec 2016 09:29:21 -0500    

Click here for diff

The whole concept of _hash_wrtbuf() is that we need to know at the  
time we're releasing the buffer lock (and pin) whether we dirtied the  
buffer, but this is easy to get wrong.  This patch actually fixes one  
non-obvious bug of that form: hashbucketcleanup forgot to signal  
_hash_squeezebucket, which gets the primary bucket page already  
locked, as to whether it had already dirtied the page.  Calling  
MarkBufferDirty() at the places where we dirty the buffer is more  
intuitive and lets us simplify the code in various places as well.  
  
On top of all that, the ultimate goal here is to make hash indexes  
WAL-logged, and as the comments to _hash_wrtbuf() note, it should  
go away when that happens.  Making it go away a little earlier than  
that seems like a good preparatory step.  
  
Report by Jeff Janes.  Diagnosis by Amit Kapila, Kuntal Ghosh,  
and Dilip Kumar.  Patch by me, after studying an alternative patch  
submitted by Amit Kapila.  
  
Discussion: http://postgr.es/m/CAA4eK1Kf6tOY0oVz_SEdngiNFkeXrA3xUSDPPORQvsWVPdKqnA@mail.gmail.com  

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/include/access/hash.h

Fix off-by-one in memory allocation for quote_literal_cstr().

commit   : 4f5182e18d3ec7b84c24ceba2c436ea890c95e25    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 16 Dec 2016 12:50:20 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 16 Dec 2016 12:50:20 +0200    

Click here for diff

The calculation didn't take into account the NULL terminator. That lead  
to overwriting the palloc'd buffer by one byte, if the input consists  
entirely of backslashes. For example "format('%L', E'\\')".  
  
Fixes bug #14468. Backpatch to all supported versions.  
  
Report: https://www.postgresql.org/message-id/20161216105001.13334.42819%40wrigleys.postgresql.org  

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

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

commit   : 93513d1b6559b2d0805f0b02d312ee550e3d010b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Dec 2016 14:32:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Dec 2016 14:32:42 -0500    

Click here for diff

This is a trivial update (consisting in fact only in the addition of  
a comment).  The point is just to get back to being synced with an  
official release of tzcode, rather than some ad-hoc point in their  
commit history, which is where commit 1f87181e1 left it.  

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

Add missing newline in message

commit   : 8cb545bfd485e91fdd981e0381f82077ebfd9f82    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 15 Dec 2016 16:45:31 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 15 Dec 2016 16:45:31 +0100    

Click here for diff

M src/bin/pg_basebackup/pg_basebackup.c

Various temporary slots test improvements

commit   : fdf71389dd5da949cb305ace9a0347d50ef0f020    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 15 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 15 Dec 2016 12:00:00 -0500    

Click here for diff

Fix the tests on slow machines (per buildfarm).  
  
Add test for dropping on error.  And also try to consume real changes  
from temporary slots.  
  
From: Petr Jelinek <[email protected]>  

M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/sql/slot.sql

Improve handling of array elements as getdiag_targets and cursor_variables.

commit   : 55caaaeba877eac1feb6481fb413fa04ae9046ac    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Dec 2016 16:33:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Dec 2016 16:33:03 -0500    

Click here for diff

There's no good reason why plpgsql's GET DIAGNOSTICS statement can't  
support an array element as target variable, since the execution code  
already uses the generic exec_assign_value() function to assign to it.  
Hence, refactor the grammar to allow that, by making getdiag_target  
depend on the assign_var production.  
  
Ideally we'd also let a cursor_variable expand to an element of a  
refcursor[] array, but that's substantially harder since those statements  
also have to handle bound-cursor-variable cases.  For now, just make sure  
the reported error is sensible, ie "cursor variable must be a simple  
variable" not "variable must be of type cursor or refcursor".  The latter  
was quite confusing from the user's viewpoint, since what he wrote  
satisfies the claimed restriction.  
  
Per bug #14463 from Zhou Digoal.  Given the lack of previous complaints,  
I see no need for a back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/pl_gram.y
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Prevent planagg.c from failing on queries containing CTEs.

commit   : 1f542a2eacca030c676cbb594f3b362d43f2f857    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Dec 2016 13:20:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Dec 2016 13:20:16 -0500    

Click here for diff

The existing tests in preprocess_minmax_aggregates() usually prevent it  
from trying to do anything with queries containing CTEs, but there's an  
exception: a CTE could be present as a member of an appendrel, if we  
flattened a UNION ALL that contains CTE references.  If it did try to  
generate an optimized path for a query using a CTE, it failed with  
"could not find plan for CTE", as reported by Torsten Fƶrtsch.  
  
The proximate cause is an unwise decision in commit 3fc6e2d7f to clear  
subroot->cte_plan_ids in build_minmax_path().  That left the subroot's  
cte_plan_ids list out of step with its parse->cteList.  
  
Removing the "subroot->cte_plan_ids = NIL;" assignment is enough to let  
the case work again, but really it's pretty silly to be expending any  
cycles at all in this module when there are CTEs: we always treat their  
outputs as unordered so there's no way for the optimization to win.  
Hence, also add an early-exit test so we don't waste time like that.  
  
Back-patch to 9.6 where the misbehavior was introduced.  
  
Report: https://postgr.es/m/CAKkG4_=gjY5QiHtqSZyWMwDuTd_CftKoTaCqxjJ7uUz1-Gw=qw@mail.gmail.com  

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

Fix bug in hashbulkdelete.

commit   : 501c7b94bcb00cfa0faad60135cf6af82fd56a3a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 13 Dec 2016 12:16:02 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 13 Dec 2016 12:16:02 -0500    

Click here for diff

Commit 6d46f4783efe457f74816a75173eb23ed8930020 failed to account for  
the possibility that hashbulkdelete() might encounter a bucket that  
has been split since it began scanning the bucket array.  Repair.  
  
Extracted from a larger pathc by Amit Kapila; I rewrote the comment.  

M src/backend/access/hash/hash.c

Fix bugs in RelationGetPartitionDispatchInfo.

commit   : a25665088d812d08bb888e961f208eaebf522050    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 13 Dec 2016 11:29:08 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 13 Dec 2016 11:29:08 -0500    

Click here for diff

The previous coding was not quite right for cases involving multiple  
levels of partitioning.  
  
Amit Langote  

M src/backend/catalog/partition.c

Clean up code, comments, and formatting for table partitioning.

commit   : 4b9a98e154cec81849af24091443747a6057c968    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 13 Dec 2016 10:54:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 13 Dec 2016 10:54:52 -0500    

Click here for diff

Amit Langote, plus pgindent-ing by me.  Inspired in part by review  
comments from Tomas Vondra.  

M src/backend/catalog/heap.c
M src/backend/catalog/partition.c
M src/backend/commands/copy.c
M src/backend/commands/tablecmds.c
M src/backend/executor/nodeModifyTable.c
M src/include/catalog/pg_partitioned_table.h

Update typedefs.list

commit   : acddbe221b084956a0efd6e4b6c6586e8fd994d7    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 13 Dec 2016 10:51:32 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 13 Dec 2016 10:51:32 -0500    

Click here for diff

So developers can more easily run pgindent locally  

M src/tools/pgindent/typedefs.list

commit   : a1a4459c299a86f909c27e391a10d7b9b05ea697    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 13 Dec 2016 08:18:00 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 13 Dec 2016 08:18:00 -0500    

Click here for diff

Commit f0e44751d7175fa3394da2c8f85e3ceb3cdbfe63 implemented table  
partitioning, but failed to mention the "no row movement"  
restriction in the documentation.  Fix that and a few other issues.  
  
Amit Langote, with some additional wordsmithing by me.  

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

Remove should_free arguments to tuplesort routines.

commit   : 3856cf9607f41245ec9462519c53f1109e781fc5    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 12 Dec 2016 15:57:35 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 12 Dec 2016 15:57:35 -0500    

Click here for diff

Since commit e94568ecc10f2638e542ae34f2990b821bbf90ac, the answer is  
always "false", and we do not need to complicate the API by arranging  
to return a constant value.  
  
Peter Geoghegan  
  
Discussion: http://postgr.es/m/CAM3SWZQWZZ_N=DmmL7tKy_OUjGH_5mN=N=A6h7kHyyDvEhg2DA@mail.gmail.com  

M src/backend/access/hash/hashsort.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/commands/cluster.c
M src/backend/utils/sort/tuplesort.c
M src/include/utils/tuplesort.h

Catversion bump for temporary replication slots.

commit   : 9b3d02c2a9eb93cc4754857361abee449a3fe0cb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Dec 2016 14:41:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Dec 2016 14:41:49 -0500    

Click here for diff

Missed in commit a924c327e2793d2025b19e18de7917110dc8afd8.  
Per Fujii Masao.  

M src/include/catalog/catversion.h

Fix race condition in test_decoding "slot" test.

commit   : 23f722ba8e19ca1a7c2ada9d6e687989b6e8f4d1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Dec 2016 14:32:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Dec 2016 14:32:09 -0500    

Click here for diff

This test, just added in commit a924c327e, sometimes fails because  
the old backend hasn't finished dropping the temporary replication slot  
when the new backend looks.  Borrow the previously-invented methodology  
for waiting for the old process to disappear from pg_stat_activity.  
  
Petr Jelinek  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/sql/slot.sql

doc: Fix purported type of pg_am.amhandler to match reality.

commit   : b4630e01fd4c73c195025b7307ebc13d489b9ef9    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 12 Dec 2016 13:43:48 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 12 Dec 2016 13:43:48 -0500    

Click here for diff

Joel Jacobson  

M doc/src/sgml/catalogs.sgml

Make the different Unix-y semaphore implementations ABI-compatible.

commit   : be7b2848c6d8bdbfb63ab403c535713708c4af52    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Dec 2016 13:32:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Dec 2016 13:32:10 -0500    

Click here for diff

Previously, the "sem" field of PGPROC varied in size depending on which  
kernel semaphore API we were using.  That was okay as long as there was  
only one likely choice per platform, but in the wake of commit ecb0d20a9,  
that assumption seems rather shaky.  It doesn't seem out of the question  
anymore that an extension compiled against one API choice might be loaded  
into a postmaster built with another choice.  Moreover, this prevents any  
possibility of selecting the semaphore API at postmaster startup, which  
might be something we want to do in future.  
  
Hence, change PGPROC.sem to be PGSemaphore (i.e. a pointer) for all Unix  
semaphore APIs, and turn the pointed-to data into an opaque struct whose  
contents are only known within the responsible modules.  
  
For the SysV and unnamed-POSIX APIs, the pointed-to data has to be  
allocated elsewhere in shared memory, which takes a little bit of  
rejiggering of the InitShmemAllocation code sequence.  (I invented a  
ShmemAllocUnlocked() function to make that a little cleaner than it used  
to be.  That function is not meant for any uses other than the ones it  
has now, but it beats having InitShmemAllocation() know explicitly about  
allocation of space for semaphores and spinlocks.)  This change means an  
extra indirection to access the semaphore data, but since we only touch  
that when blocking or awakening a process, there shouldn't be any  
meaningful performance penalty.  Moreover, at least for the unnamed-POSIX  
case on Linux, the sem_t type is quite a bit wider than a pointer, so this  
reduces sizeof(PGPROC) which seems like a good thing.  
  
For the named-POSIX API, there's effectively no change: the PGPROC.sem  
field was and still is a pointer to something returned by sem_open() in  
the postmaster's memory space.  Document and check the pre-existing  
limitation that this case can't work in EXEC_BACKEND mode.  
  
It did not seem worth unifying the Windows semaphore ABI with the Unix  
cases, since there's no likelihood of needing ABI compatibility much less  
runtime switching across those cases.  However, we can simplify the Windows  
code a bit if we define PGSemaphore as being directly a HANDLE, rather than  
pointer to HANDLE, so let's do that while we're here.  (This also ends up  
being no change in what's physically stored in PGPROC.sem.  We're just  
moving the HANDLE fetch from callees to callers.)  
  
It would take a bunch of additional code shuffling to get to the point of  
actually choosing a semaphore API at postmaster start, but the effects  
of that would now be localized in the port/XXX_sema.c files, so it seems  
like fit material for a separate patch.  The need for it is unproven as  
yet, anyhow, whereas the ABI risk to extensions seems real enough.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/port/win32_sema.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/spin.c
M src/include/storage/pg_sema.h
M src/include/storage/proc.h
M src/include/storage/shmem.h
M src/include/storage/spin.h

psql: Fix incorrect version check for table partitining.

commit   : 06e184876bc07c2b1d7144957dcf02c5b4f709c2    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 12 Dec 2016 11:54:14 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 12 Dec 2016 11:54:14 -0500    

Click here for diff

Table partitioning was added in 10, not 9.6.  
  
FabrĆ­zio de Royes Mello, per report from Jeff Janes  

M src/bin/psql/describe.c

Fix creative, but unportable, spelling of "ptr != NULL".

commit   : 563d575fd73361f6118c13f2816988eba8e1f657    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Dec 2016 11:23:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Dec 2016 11:23:23 -0500    

Click here for diff

Or at least I suppose that's what was really meant here.  But even  
aside from the not-per-project-style use of "0" to mean "NULL",  
I doubt it's safe to assume that all valid pointers are > NULL.  
Per buildfarm member pademelon.  

M src/backend/commands/tablecmds.c

Add support for temporary replication slots

commit   : a924c327e2793d2025b19e18de7917110dc8afd8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Dec 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Dec 2016 12:00:00 -0500    

Click here for diff

This allows creating temporary replication slots that are removed  
automatically at the end of the session or on error.  
  
From: Petr Jelinek <[email protected]>  

M contrib/test_decoding/Makefile
M contrib/test_decoding/expected/ddl.out
A contrib/test_decoding/expected/slot.out
A contrib/test_decoding/sql/slot.sql
M doc/src/sgml/func.sgml
M doc/src/sgml/protocol.sgml
M src/backend/catalog/system_views.sql
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/walsender.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/postgres.c
M src/include/catalog/pg_proc.h
M src/include/nodes/replnodes.h
M src/include/replication/slot.h
M src/test/regress/expected/rules.out

Refactor the code for verifying user's password.

commit   : e7f051b8f9a6341f6d3bf80b29c1dbc1837be9ab    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Dec 2016 12:48:13 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Dec 2016 12:48:13 +0200    

Click here for diff

Split md5_crypt_verify() into three functions:  
* get_role_password() to fetch user's password from pg_authid, and check  
  its expiration.  
* md5_crypt_verify() to check an MD5 authentication challenge  
* plain_crypt_verify() to check a plaintext password.  
  
get_role_password() will be needed as a separate function by the upcoming  
SCRAM authentication patch set. Most of the remaining functionality in  
md5_crypt_verify() was different for MD5 and plaintext authentication, so  
split that for readability.  
  
While we're at it, simplify the *_crypt_verify functions by using  
stack-allocated buffers to hold the temporary MD5 hashes, instead of  
pallocing.  
  
Reviewed by Michael Paquier.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/libpq/auth.c
M src/backend/libpq/crypt.c
M src/include/libpq/crypt.h

Further cleanup from the strong-random patch.

commit   : 58445c5c8d1424038d654ad9ee8af3724c60105e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Dec 2016 11:55:32 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Dec 2016 11:55:32 +0200    

Click here for diff

Also use the new facility for generating RADIUS authenticator requests,  
and salt in chkpass extension.  
  
Reword the error messages to be nicer. Fix bogus error code used in the  
message in BackendStartup.  

M contrib/chkpass/chkpass.c
M src/backend/libpq/auth.c
M src/backend/postmaster/postmaster.c

Fix pgcrypto compilation with OpenSSL 1.1.0.

commit   : 9bbbf029dded76d7d86053ebad1c5f9ab2948904    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Dec 2016 11:14:44 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Dec 2016 11:14:44 +0200    

Click here for diff

Was broken by the switch to using OpenSSL's EVP interface for ciphers, in  
commit 5ff4a67f.  
  
Reported by Andres Freund. Fix by Michael Paquier with some kibitzing by me.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/pgcrypto/openssl.c
M contrib/pgcrypto/pgp-encrypt.c

commit   : 41493bac36575c93172644d0eab7045aed8dcc17    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Dec 2016 09:58:32 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Dec 2016 09:58:32 +0200    

Click here for diff

pg_backend_random() is used for MD5 salt generation, but it can fail, and  
no checks were done on its status code.  
  
Fix memory leak, if generating a random number for a cancel key failed.  
  
Both issues were spotted by Coverity. Fix by Michael Paquier.  

M src/backend/libpq/auth.c
M src/backend/postmaster/postmaster.c

Fix broken autoconf test for random number source.

commit   : ad365b2f91dc57ed1f18839f9f59a2799d276c8d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Dec 2016 09:26:42 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Dec 2016 09:26:42 +0200    

Click here for diff

Hopefully this fixes buildfarm member jacana.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M configure
M configure.in

Use "%option prefix" to set API names in ecpg's lexer.

commit   : 92fb649837e36944bd0e9eed6c90b4b01b7deb18    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Dec 2016 14:54:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Dec 2016 14:54:25 -0500    

Click here for diff

Clean up some technical debt left behind by commit 72b1e3a21: instead of  
quickly hacking the name of base_yylex() with a #define, set it properly  
with "%option prefix".  This causes the names of pgc.l's other exported  
symbols to change as well, so run around and modify the outside references  
to them as needed.  Similarly, make pgc.l's external references to  
base_yylval use that variable's true name instead of a macro.  
  
The reason for doing this now is that the quick-hack solution will fail  
with future versions of flex, as reported by Š”ŠøŠ»ŃŠ½ ŠŸŠ°Š»Š°ŃƒŠ·Š¾Š².  
Hence, back-patch into 9.6 where the previous commit appeared, since  
it's likely people will build 9.6 with newer flex versions during  
its lifetime.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/preproc/descriptor.c
M src/interfaces/ecpg/preproc/ecpg.addons
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/extern.h
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/variable.c

Prevent crash when ts_rewrite() replaces a non-top-level subtree with null.

commit   : 0eaaaf00e296c2048b868b7c1d3c12c0eae6dd12    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Dec 2016 13:09:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Dec 2016 13:09:57 -0500    

Click here for diff

When ts_rewrite()'s replacement argument is an empty tsquery, it's supposed  
to simplify any operator nodes whose operand(s) become NULL; but it failed  
to do that reliably, because dropvoidsubtree() only examined the top level  
of the result tree.  Rather than make a second recursive pass, let's just  
give the responsibility to dofindsubquery() to simplify while it's doing  
the main replacement pass.  Per report from Andreas Seltenreich.  
  
Artur Zakirov, with some cosmetic changes by me.  Back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Be more careful about Python refcounts while creating exception objects.

commit   : 9cda81f0056ca488dbd6cded64db1238aed816b2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2016 15:27:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2016 15:27:23 -0500    

Click here for diff

PLy_generate_spi_exceptions neglected to do Py_INCREF on the new exception  
objects, evidently supposing that PyModule_AddObject would do that --- but  
it doesn't.  This left us in a situation where a Python garbage collection  
cycle could result in deletion of exception object(s), causing server  
crashes or wrong answers if the exception objects are used later in the  
session.  
  
In addition, PLy_generate_spi_exceptions didn't bother to test for  
a null result from PyErr_NewException, which at best is inconsistent  
with the code in PLy_add_exceptions.  And PLy_add_exceptions, while it  
did do Py_INCREF on the exceptions it makes, waited to do that till  
after some PyModule_AddObject calls, creating a similar risk for  
failure if garbage collection happened within those calls.  
  
To fix, refactor to have just one piece of code that creates an  
exception object and adds it to the spiexceptions module, bumping the  
refcount first.  
  
Also, let's add an additional refcount to represent the pointer we're  
going to store in a C global variable or hash table.  This should only  
matter if the user does something weird like delete the spiexceptions  
Python module, but lack of paranoia has caused us enough problems in  
PL/Python already.  
  
The fact that PyModule_AddObject doesn't do a Py_INCREF of its own  
explains the need for the Py_INCREF added in commit 4c966d920, so we  
can improve the comment about that; also, this means we really want  
to do that before not after the PyModule_AddObject call.  
  
The missing Py_INCREF in PLy_generate_spi_exceptions was reported and  
diagnosed by Rafa de la Torre; the other fixes by me.  Back-patch  
to all supported branches.  
  
Discussion: https://postgr.es/m/CA+Fz15kR1OXZv43mDrJb3XY+1MuQYWhx5kx3ea6BRKQp6ezGkg@mail.gmail.com  

M src/pl/plpython/plpy_plpymodule.c

Fix crasher bug in array_position(s)

commit   : a73491e5fee88f5db70d69e81fa45060b6ed3682    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 9 Dec 2016 12:42:17 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 9 Dec 2016 12:42:17 -0300    

Click here for diff

array_position and its cousin array_positions were caching the element  
type equality function's FmgrInfo without being careful enough to put it  
in a long-lived context.  This is obviously broken but it didn't matter  
in most cases; only when using arrays of records (involving record_eq)  
it becomes a problem.  The fix is to ensure that the type's equality  
function's FmgrInfo is cached in the array_position's flinfo->fn_mcxt  
rather than the current memory context.  
  
Apart from record types, the only other case that seems complex enough  
to possibly cause the same problem are range types.  I didn't find a way  
to reproduce the problem with those, so I only include the test case  
submitted with the bug report as regression test.  
  
Bug report and patch: Junseok Yang  
Discussion: https://postgr.es/m/CAE+byMupUURYiZ6bKYgMZb9pgV1CYAijJGqWj-90W=nS7uEOeA@mail.gmail.com  
Backpatch to 9.5, where array_position appeared.  

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

Fix thinko in safeguard for negative availMem.

commit   : 64bc26f90d342ca343f5ba383a97691a58991204    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 8 Dec 2016 23:05:21 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 8 Dec 2016 23:05:21 +0200    

Click here for diff

Also, use pass read_buffer_size * numInputTapes rather than just availMem  
to USEMEM, to be neat.  
  
Peter Geoghegan.  

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

Fix bogus comment.

commit   : 01ae881e1c83ddb79df0a5cf6cee38c3ce4a327b    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 8 Dec 2016 14:59:46 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 8 Dec 2016 14:59:46 -0500    

Click here for diff

Commit 4212cb73262bbdd164727beffa4c4744b4ead92d rendered a comment  
in execMain.c incorrect.  Per complaint from Tom Lane, repair.  
  
Patch from Amit Kapila, per wording suggested by Tom Lane and me.  

M src/backend/executor/execMain.c

Silence compiler warning.

commit   : ab4575dcf18fad1bc20d4a1bde6dc33c8d2561b6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 8 Dec 2016 14:55:47 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 8 Dec 2016 14:55:47 -0500    

Click here for diff

Per report from Stephen Frost.  

M src/backend/catalog/partition.c

Log the creation of an init fork unconditionally.

commit   : fa0f466d5329e10b16f3b38c8eaf5306f7e234e8    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 8 Dec 2016 14:09:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 8 Dec 2016 14:09:09 -0500    

Click here for diff

Previously, it was thought that this only needed to be done for the  
benefit of possible standbys, so wal_level = minimal skipped it.  
But that's not safe, because during crash recovery we might replay  
XLOG_DBASE_CREATE or XLOG_TBLSPC_CREATE record which recursively  
removes the directory that contains the new init fork.  So log it  
always.  
  
The user-visible effect of this bug is that if you create a database  
or tablespace, then create an unlogged table, then crash without  
checkpointing, then restart, accessing the table will fail, because  
the it won't have been properly reset.  This commit fixes that.  
  
Michael Paquier, per a report from Konstantin Knizhnik.  Wording of  
the comments per a suggestion from me.  

M contrib/bloom/blinsert.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spginsert.c
M src/backend/catalog/heap.c

Fix reporting of column typmods for multi-row VALUES constructs.

commit   : 0b78106cd4651ad7867036a463ec743f6d3d2e86    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 8 Dec 2016 11:40:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 8 Dec 2016 11:40:02 -0500    

Click here for diff

expandRTE() and get_rte_attribute_type() reported the exprType() and  
exprTypmod() values of the expressions in the first row of the VALUES as  
being the column type/typmod returned by the VALUES RTE.  That's fine for  
the data type, since we coerce all expressions in a column to have the same  
common type.  But we don't coerce them to have a common typmod, so it was  
possible for rows after the first one to return values that violate the  
claimed column typmod.  This leads to the incorrect result seen in bug  
#14448 from Hassan Mahmood, as well as some other corner-case misbehaviors.  
  
The desired behavior is the same as we use in other type-unification  
cases: report the common typmod if there is one, but otherwise return -1  
indicating no particular constraint.  It's cheap for transformValuesClause  
to determine the common typmod while transforming a multi-row VALUES, but  
it'd be less cheap for expandRTE() and get_rte_attribute_type() to  
re-determine that info every time they're asked --- possibly a lot less  
cheap, if the VALUES has many rows.  Therefore, the best fix is to record  
the common typmods explicitly in a list in the VALUES RTE, as we were  
already doing for column collations.  This looks quite a bit like what  
we're doing for CTE RTEs, so we can save a little bit of space and code by  
unifying the representation for those two RTE types.  They both now share  
coltypes/coltypmods/colcollations fields.  (At some point it might seem  
desirable to populate those fields for all RTE types; but right now it  
looks like constructing them for other RTE types would add more code and  
cycles than it would save.)  
  
The RTE change requires a catversion bump, so this fix is only usable  
in HEAD.  If we fix this at all in the back branches, the patch will  
need to look quite different.  
  
Report: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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/parser/analyze.c
M src/backend/parser/parse_relation.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/include/parser/parse_relation.h
M src/test/regress/expected/create_view.out
M src/test/regress/sql/create_view.sql

Fix quoting and a compiler warning in dumping partitions.

commit   : 2560d244b4c9fc08f1d076b3c40913bec5f7e31f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 8 Dec 2016 14:10:10 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 8 Dec 2016 14:10:10 +0200    

Click here for diff

Partition name needs to be quoted in the ATTACH PARTITION command  
constructed in binary-upgrade mode.  
  
Silence compiler warning about set but unused variable, without  
--enable-cassert.  

M src/bin/pg_dump/pg_dump.c

Clean up password authentication code a bit.

commit   : fe7bdf0bf67d8ac360d67fa9740074a2c70e88a4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 8 Dec 2016 13:44:47 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 8 Dec 2016 13:44:47 +0200    

Click here for diff

Commit fe0a0b59, which moved code to do MD5 authentication to a separate  
CheckMD5Auth() function, left behind a comment that really belongs inside  
the function, too. Also move the check for db_user_namespace inside the  
function, seems clearer that way.  
  
Now that the md5 salt is passed as argument to md5_crypt_verify, it's a bit  
silly that it peeks into the Port struct to see if MD5 authentication was  
used. Seems more straightforward to treat it as an MD5 authentication, if  
the md5 salt argument is given. And after that, md5_crypt_verify only used  
the Port argument to look at port->user_name, but that is redundant,  
because it is also passed as a separate 'role' argument. So remove the Port  
argument altogether.  

M src/backend/libpq/auth.c
M src/backend/libpq/crypt.c
M src/include/libpq/crypt.h

Fix accounting of memory needed for merge heap.

commit   : f7d54f4f7ddf72bf4db1783890b058e758b4b894    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 8 Dec 2016 10:15:24 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 8 Dec 2016 10:15:24 +0200    

Click here for diff

We allegedly allocated all remaining memory for the read buffers of the  
sort tapes, but we allocated the merge heap only after that. That means  
that the allocation of the merge heap was guaranteed to go over the memory  
limit. Fix by allocating the merge heap first. This makes little difference  
in practice, because the merge heap is tiny, but let's tidy.  
  
While we're at it, add a safeguard for the case that we are already over  
the limit when allocating the read buffers. That shouldn't happen, but  
better safe than sorry.  
  
The memory accounting error was reported off-list by Peter Geoghegan.  

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

Replace references to COLLATE "en_CA" with COLLATE "POSIX".

commit   : cd5d3af44e2a4f73c692d4653941c0516f967cb7    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 7 Dec 2016 13:47:34 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 7 Dec 2016 13:47:34 -0500    

Click here for diff

Another attmempt to fix the tests which were added by commit  
f0e44751d7175fa3394da2c8f85e3ceb3cdbfe63.  

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

Replace references to COLLATE "en_US" with COLLATE "C".

commit   : 71efd34fb8047e3e4fdfc9d6900b7affd20a0235    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 7 Dec 2016 13:36:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 7 Dec 2016 13:36:57 -0500    

Click here for diff

Commit f0e44751d7175fa3394da2c8f85e3ceb3cdbfe63 is turning the  
buildfarm red; let's try something hopefully more portable.  

M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql

Implement table partitioning.

commit   : f0e44751d7175fa3394da2c8f85e3ceb3cdbfe63    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 7 Dec 2016 13:17:43 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 7 Dec 2016 13:17:43 -0500    

Click here for diff

Table partitioning is like table inheritance and reuses much of the  
existing infrastructure, but there are some important differences.  
The parent is called a partitioned table and is always empty; it may  
not have indexes or non-inherited constraints, since those make no  
sense for a relation with no data of its own.  The children are called  
partitions and contain all of the actual data.  Each partition has an  
implicit partitioning constraint.  Multiple inheritance is not  
allowed, and partitioning and inheritance can't be mixed.  Partitions  
can't have extra columns and may not allow nulls unless the parent  
does.  Tuples inserted into the parent are automatically routed to the  
correct partition, so tuple-routing ON INSERT triggers are not needed.  
Tuple routing isn't yet supported for partitions which are foreign  
tables, and it doesn't handle updates that cross partition boundaries.  
  
Currently, tables can be range-partitioned or list-partitioned.  List  
partitioning is limited to a single column, but range partitioning can  
involve multiple columns.  A partitioning "column" can be an  
expression.  
  
Because table partitioning is less general than table inheritance, it  
is hoped that it will be easier to reason about properties of  
partitions, and therefore that this will serve as a better foundation  
for a variety of possible optimizations, including query planner  
optimizations.  The tuple routing based which this patch does based on  
the implicit partitioning constraints is an example of this, but it  
seems likely that many other useful optimizations are also possible.  
  
Amit Langote, reviewed and tested by Robert Haas, Ashutosh Bapat,  
Amit Kapila, Rajkumar Raghuwanshi, Corey Huinker, Jaime Casanova,  
Rushabh Lathia, Erik Rijkers, among others.  Minor revisions by me.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/access/common/reloptions.c
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/objectaddress.c
A src/backend/catalog/partition.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/analyze.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/policy.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/commands/vacuum.c
M src/backend/commands/view.c
M src/backend/executor/execMain.c
M src/backend/executor/nodeModifyTable.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_utilcmd.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/syscache.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/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/heap.h
M src/include/catalog/indexing.h
A src/include/catalog/partition.h
M src/include/catalog/pg_class.h
A src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_proc.h
M src/include/commands/defrem.h
M src/include/commands/tablecmds.h
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/parser/parse_node.h
M src/include/parser/parse_utilcmd.h
M src/include/pg_config_manual.h
M src/include/utils/builtins.h
M src/include/utils/rel.h
M src/include/utils/syscache.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/insert.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/update.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/insert.sql
M src/test/regress/sql/update.sql
M src/tools/pgindent/typedefs.list

Restore psql's SIGPIPE setting if popen() fails.

commit   : b7e1ae2328f7d5a88d8916d78b4561d8ef16f99b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Dec 2016 12:39:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Dec 2016 12:39:24 -0500    

Click here for diff

Ancient oversight in PageOutput(): if popen() fails, we'd better reset  
the SIGPIPE handler before returning stdout, because ClosePager() won't.  
Noticed while fixing the empty-PAGER issue.  

M src/fe_utils/print.c

Handle empty or all-blank PAGER setting more sanely in psql.

commit   : 18f8f784cbbf96ef77eb8943b466b26605824c14    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Dec 2016 12:19:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Dec 2016 12:19:56 -0500    

Click here for diff

If the PAGER environment variable is set but contains an empty string,  
psql would pass it to "sh" which would silently exit, causing whatever  
query output we were printing to vanish entirely.  This is quite  
mystifying; it took a long time for us to figure out that this was the  
cause of Joseph Brenner's trouble report.  Rather than allowing that  
to happen, we should treat this as another way to specify "no pager".  
(We could alternatively treat it as selecting the default pager, but  
it seems more likely that the former is what the user meant to achieve  
by setting PAGER this way.)  
  
Nonempty, but all-white-space, PAGER values have the same behavior, and  
it's pretty easy to test for that, so let's handle that case the same way.  
  
Most other cases of faulty PAGER values will result in the shell printing  
some kind of complaint to stderr, which should be enough to diagnose the  
problem, so we don't need to work harder than this.  (Note that there's  
been an intentional decision not to be very chatty about apparent failure  
returns from the pager process, since that may happen if, eg, the user  
quits the pager with control-C or some such.  I'd just as soon not start  
splitting hairs about which exit codes might merit making our own report.)  
  
libpq's old PQprint() function was already on board with ignoring empty  
PAGER values, but for consistency, make it ignore all-white-space values  
as well.  
  
It's been like this a long time, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAFfgvXWLOE2novHzYjmQK8-J6TmHz42G8f3X0SORM44+stUGmw@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/fe_utils/print.c
M src/interfaces/libpq/fe-print.c

Fix query cancellation.

commit   : 81f2e514a9b2d813bb5fd6b62523757aa7a6517f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 7 Dec 2016 09:47:43 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 7 Dec 2016 09:47:43 +0200    

Click here for diff

In commit fe0a0b59, the datatype used for MyCancelKey and other variables  
that store cancel keys were changed from long to uint32, but I missed this  
one. That broke query cancellation on platforms where long is wider than 32  
bits.  
  
Report by Andres Freund, fix by Michael Paquier.  

M src/backend/postmaster/postmaster.c

Fix whitespace.

commit   : 9790b87f594565c11599b2004466169b8c2fd4af    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 7 Dec 2016 08:40:43 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 7 Dec 2016 08:40:43 +0200    

Click here for diff

Thomas Munro  

M src/backend/storage/lmgr/lwlocknames.txt

Silence compiler warnings

commit   : d97b14ddab2059e1d73c0cd17f26bac4ef13e682    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 6 Dec 2016 23:02:38 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 6 Dec 2016 23:02:38 -0500    

Click here for diff

Rearrange a bit of code to ensure that 'mode' in LWLockRelease is  
obviously always set, which seems a bit cleaner and avoids a compiler  
warning (thanks to Robert for the suggestion!).  
  
In GetCachedPlan(), initialize 'plan' to silence a compiler warning, but  
also add an Assert() to make sure we don't ever actually fall through  
with 'plan' still being set to NULL, since we are about to dereference  
it.  
  
Neither of these appear to be live bugs but at least gcc  
5.4.0-6ubuntu1~16.04.4 doesn't quite have the smarts to realize that.  
  
Discussion: https://www.postgresql.org/message-id/20161129152102.GR13284%40tamriel.snowman.net  

M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/cache/plancache.c

Fix unsafe assumption that struct timeval.tv_sec is a "long".

commit   : 0645dacc371da6169b06934e3bd238c5f770fe25    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Dec 2016 19:52:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Dec 2016 19:52:34 -0500    

Click here for diff

It typically is a "long", but it seems possible that on some platforms  
it wouldn't be.  In any case, this silences a compiler warning on  
OpenBSD (cf buildfarm member curculio).  
  
While at it, use snprintf not sprintf.  This format string couldn't  
possibly overrun the supplied buffer, but that doesn't seem like  
a good reason not to use the safer style.  
  
Oversight in commit f828654e1.  Back-patch to 9.6 where that came in.  

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

Put AC_MSG_RESULT() call in the right place.

commit   : c648f058319a59ad591dd9d1b0c48dfd655d063a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Dec 2016 19:34:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Dec 2016 19:34:29 -0500    

Click here for diff

Thinko in ecb0d20a9 --- this needs to go one level further out in  
the "if" nest.  As it stood, nothing got printed in the case of  
selecting named POSIX semaphores.  Cosmetic issue only, but a bug.  

M configure
M configure.in

Fix interaction of parallel query with prepared statements.

commit   : 4212cb73262bbdd164727beffa4c4744b4ead92d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 6 Dec 2016 11:11:54 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 6 Dec 2016 11:11:54 -0500    

Click here for diff

Previously, a prepared statement created via a Parse message could get  
a parallel plan, but one created with a PREPARE statement could not.  
This state of affairs was due to confusion on my (rhaas) part: I  
erroneously believed that a CREATE TABLE .. AS EXECUTE statement could  
only be performed with a prepared statement by PREPARE, but in fact  
one created by a Prepare message works just as well.  Therefore, it  
makes no sense to allow parallel query in one case but not the other.  
  
To fix, allow parallel query with all prepared statements, but run  
the parallel plan serially (i.e. without workers) in the case of  
CREATE TABLE .. AS EXECUTE.  Also, document this.  
  
Amit Kapila and Tobias Bussman, plus an extra sentence of  
documentation by me.  

M doc/src/sgml/parallel.sgml
M src/backend/commands/prepare.c
M src/backend/executor/execMain.c

Bump catversion for restrictive RLS changes

commit   : cb9dcbc1eebd8cccf98d7236b2c9bb82caf8b45d    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 6 Dec 2016 10:12:31 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 6 Dec 2016 10:12:31 -0500    

Click here for diff

Mea culpa.  
  
Pointed out by Andres.  

M src/include/catalog/catversion.h

Improve documentation about pg_stat_replication view.

commit   : dfe530a09226a9de80f2b4c3d5f667bf51481c49    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 6 Dec 2016 17:09:10 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 6 Dec 2016 17:09:10 +0900    

Click here for diff

Add the descriptions of possible values in "state" and "sync_state" columns  
of pg_stat_replication view.  
  
Author: Michael Paquier, slightly modified by me  
Discussion: <CAB7nPqT7APWrvPFZrcjKEHoq4=g3z2ErxtTdojSf+sDALzuemA@mail.gmail.com>  

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

Remove extraneous semicolon from uses of relptr_declare().

commit   : 3ebf2b45454a5fb74e6516ab4915f7a3d44d544f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Dec 2016 20:27:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Dec 2016 20:27:55 -0500    

Click here for diff

If we're going to write a semicolon after calls of relptr_declare(),  
then we don't need one inside the macro, and removing it suppresses  
"empty declaration" warnings from pickier compilers (eg pademelon).  
  
While at it, we might as well use relptr() inside relptr_declare(),  
because otherwise that macro would likely go unused altogether.  
  
Also improve the comment, which I for one found unclear,  
and provide a specific example of intended usage.  

M src/include/utils/relptr.h

Fix typo in new message in configure.

commit   : 44a977f55f33834a2fe0d1d9bd5eeb29ce67e914    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 6 Dec 2016 00:29:51 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 6 Dec 2016 00:29:51 +0200    

Click here for diff

Remove spurious "of", and reformat to fit on a 80 chars wide line.  

M configure
M configure.in

Ensure gatherstate->nextreader is properly initialized.

commit   : 53c7cff7200b6689b102f2e4a40650cf652dae39    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 15:54:28 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 15:54:28 -0500    

Click here for diff

The previously code worked OK as long as a Gather node was never  
rescanned, or if it was rescanned, as long as it got at least as  
many workers on rescan as it had originally.  But if the number  
of workers ever decreased on a rescan, then it could crash.  
  
Andreas Seltenreich  

M src/backend/executor/nodeGather.c

Add support for restrictive RLS policies

commit   : 093129c9d9fc231649b3cc27b8086443ccbbbc22    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 5 Dec 2016 15:50:55 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 5 Dec 2016 15:50:55 -0500    

Click here for diff

We have had support for restrictive RLS policies since 9.5, but they  
were only available through extensions which use the appropriate hooks.  
This adds support into the grammer, catalog, psql and pg_dump for  
restrictive RLS policies, thus reducing the cases where an extension is  
necessary.  
  
In passing, also move away from using "AND"d and "OR"d in comments.  
As pointed out by Alvaro, it's not really appropriate to attempt  
to make verbs out of "AND" and "OR", so reword those comments which  
attempted to.  
  
Reviewed By: Jeevan Chalke, Dean Rasheed  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_policy.sgml
M doc/src/sgml/ref/create_policy.sgml
M src/backend/catalog/system_views.sql
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/backend/rewrite/rowsecurity.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/pg_policy.h
M src/include/nodes/parsenodes.h
M src/include/rewrite/rowsecurity.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/rowsecurity.sql

dsa: Cope with the possibility that SIZE_MAX is not defined.

commit   : 2bbdc6875d03bb826a4fd113eac45a72c68bc929    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 15:20:23 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 15:20:23 -0500    

Click here for diff

Per buildfarm member gaur and Tom Lane.  

M src/backend/utils/mmgr/dsa.c

libpq: Fix another bug in 721f7bd3cbccaf8c07cad2707826b83f84694832.

commit   : a0ae54df9b153256a9d0afe45732853cb5ccae09    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 14:09:54 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 14:09:54 -0500    

Click here for diff

If we failed to connect to one or more hosts, and then afterwards we  
find one that fails to be read-write, the latter error message was  
clobbering any earlier ones.  Repair.  
  
Mithun Cy, slightly revised by me.  

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

Fix race introduced by 6d46f4783efe457f74816a75173eb23ed8930020.

commit   : 2f4193c3509a822c55cc0eae77e7788806d9b022    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 11:43:37 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 11:43:37 -0500    

Click here for diff

It's possible for the metapage contents to change after we release  
the lock, so we must read them before releasing the lock.  
  
Amit Kapila.  Submitted in response to a trouble report from  
Andreas Seltenreich, though it is not certain this fixes the  
problem.  

M src/backend/access/hash/hashpage.c

Assorted documentation improvements for max_parallel_workers.

commit   : 0e50af245397c9bf3e7b02c0958be599de838fac    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 11:03:17 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 11:03:17 -0500    

Click here for diff

Commit b460f5d6693103076dc554aa7cbb96e1e53074f9 overlooked a few bits  
of documentation that seem like they should mention the new setting.  

M doc/src/sgml/config.sgml
M doc/src/sgml/parallel.sgml

Reduce the default for max_worker_processes back to 8.

commit   : 2b959d4957ff47c77b2518dcddbf3aa126a1593c    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 10:53:21 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 10:53:21 -0500    

Click here for diff

Commit b460f5d6693103076dc554aa7cbb96e1e53074f9 -- at my suggestion --  
increased the default value of max_worker_processes from 8 to 16, on  
the theory that this would be harmless and convenient for users.  
Unfortunately, this caused some buildfarm machines with low connection  
limits to start failing, so apparently it's not harmless after all.  

M doc/src/sgml/config.sgml
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_resetxlog/pg_resetxlog.c

Fix more DSA problems uncovered by the buildfarm.

commit   : 88f626f8680fbe93444582317d1adb375111855f    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 10:38:08 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 10:38:08 -0500    

Click here for diff

On 32-bit systems, don't try to use 64-bit DSA pointers, because the  
computation of DSA_MAX_SEGMENT_SIZE overflows Size.  
  
Cast 1 to Size before shifting it, so that the compiler doesn't  
produce a result of the wrong width.  
  
In passing, change one use of size_t to Size.  

M src/backend/utils/mmgr/dsa.c
M src/include/utils/dsa.h

commit   : 670b3bc8f5d1000b5475e41c6f023c490e8500fe    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 10:00:49 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 5 Dec 2016 10:00:49 -0500    

Click here for diff

Commit 13df76a537cca3b8884911d8fdf7c89a457a8dd3 was overconfident  
about how portable %016lx is.  Some compilers complain because they  
need %016llx, while platforms where DSA pointers are only 32 bits  
get unhappy about using a 64-bit format for a 32-bit quantity.  
  
Thomas Munro, per an off-list suggestion from me.  

M src/backend/utils/mmgr/dsa.c
M src/include/utils/dsa.h

Fix creation of stand-alone INSTALL.html file.

commit   : 7dd8eb39bd2b9e06eeef038f80ae327efb4a7d55    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Dec 2016 14:49:00 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Dec 2016 14:49:00 +0200    

Click here for diff

I missed the notice at the top of the file, that plain xref must not be  
used in installation.sgml.  
  
Per buildfarm member guaibasaurus.  

M doc/src/sgml/installation.sgml

Fix typo in docs.

commit   : daac8e30eb7874722f277ae3461abe46a39e56ed    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 5 Dec 2016 20:44:21 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 5 Dec 2016 20:44:21 +0900    

Click here for diff

Reported-by: Darko Prelec  

M doc/src/sgml/parallel.sgml

Replace PostmasterRandom() with a stronger source, second attempt.

commit   : fe0a0b5993dfe24e4b3bcf52fa64ff41a444b8f1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Dec 2016 13:42:59 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Dec 2016 13:42:59 +0200    

Click here for diff

This adds a new routine, pg_strong_random() for generating random bytes,  
for use in both frontend and backend. At the moment, it's only used in  
the backend, but the upcoming SCRAM authentication patches need strong  
random numbers in libpq as well.  
  
pg_strong_random() is based on, and replaces, the existing implementation  
in pgcrypto. It can acquire strong random numbers from a number of sources,  
depending on what's available:  
  
- OpenSSL RAND_bytes(), if built with OpenSSL  
- On Windows, the native cryptographic functions are used  
- /dev/urandom  
  
Unlike the current pgcrypto function, the source is chosen by configure.  
That makes it easier to test different implementations, and ensures that  
we don't accidentally fall back to a less secure implementation, if the  
primary source fails. All of those methods are quite reliable, it would be  
pretty surprising for them to fail, so we'd rather find out by failing  
hard.  
  
If no strong random source is available, we fall back to using erand48(),  
seeded from current timestamp, like PostmasterRandom() was. That isn't  
cryptographically secure, but allows us to still work on platforms that  
don't have any of the above stronger sources. Because it's not very secure,  
the built-in implementation is only used if explicitly requested with  
--disable-strong-random.  
  
This replaces the more complicated Fortuna algorithm we used to have in  
pgcrypto, which is unfortunate, but all modern platforms have /dev/urandom,  
so it doesn't seem worth the maintenance effort to keep that. pgcrypto  
functions that require strong random numbers will be disabled with  
--disable-strong-random.  
  
Original patch by Magnus Hagander, tons of further work by Michael Paquier  
and me.  
  
Discussion: https://www.postgresql.org/message-id/CAB7nPqRy3krN8quR9XujMVVHYtXJ0_60nqgVc6oUk8ygyVkZsA@mail.gmail.com  
Discussion: https://www.postgresql.org/message-id/CAB7nPqRWkNYRRPJA7-cF+LfroYV10pvjdz6GNvxk-Eee9FypKA@mail.gmail.com  

M configure
M configure.in
M contrib/pgcrypto/Makefile
A contrib/pgcrypto/expected/pgp-compression_1.out
A contrib/pgcrypto/expected/pgp-decrypt_1.out
A contrib/pgcrypto/expected/pgp-encrypt_1.out
A contrib/pgcrypto/expected/pgp-pubkey-encrypt_1.out
D contrib/pgcrypto/fortuna.c
D contrib/pgcrypto/fortuna.h
M contrib/pgcrypto/internal.c
M contrib/pgcrypto/openssl.c
M contrib/pgcrypto/pgcrypto.c
M contrib/pgcrypto/pgp-encrypt.c
M contrib/pgcrypto/pgp-mpi-internal.c
M contrib/pgcrypto/pgp-pgsql.c
M contrib/pgcrypto/pgp-pubenc.c
M contrib/pgcrypto/pgp-s2k.c
M contrib/pgcrypto/px-crypt.c
M contrib/pgcrypto/px.c
M contrib/pgcrypto/px.h
D contrib/pgcrypto/random.c
M doc/src/sgml/installation.sgml
M src/Makefile.global.in
M src/backend/libpq/auth.c
M src/backend/libpq/crypt.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/utils/init/globals.c
M src/backend/utils/misc/Makefile
A src/backend/utils/misc/backend_random.c
M src/include/libpq/crypt.h
M src/include/libpq/libpq-be.h
M src/include/miscadmin.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port.h
A src/include/utils/backend_random.h
M src/port/Makefile
M src/port/erand48.c
A src/port/pg_strong_random.c
M src/tools/msvc/Mkvcbuild.pm

Fix incorrect output from gin_desc().

commit   : 5dc851afde8d9ef9947f21799f7a1b08bf0bf812    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 5 Dec 2016 20:29:41 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 5 Dec 2016 20:29:41 +0900    

Click here for diff

Previously gin_desc() displayed incorrect output "unknown action 0"  
for XLOG_GIN_INSERT and XLOG_GIN_VACUUM_DATA_LEAF_PAGE records with  
valid actions. The cause of this problem was that gin_desc() wrongly  
used XLogRecGetData() to extract data from those records.  
Since they were registered by XLogRegisterBufData(), gin_desc() should  
have used XLogRecGetBlockData(), instead, like gin_redo().  
Also there were other differences about how to treat XLOG_GIN_INSERT  
record between gin_desc() and gin_redo().  
  
This commit fixes gin_desc() routine so that it treats those records  
in the same way as gin_redo().  
  
Batch-patch to 9.5 where WAL record format was revamped and  
XLogRegisterBufData() was added.  
  
Reported-By: Andres Freund  
Reviewed-By: Tom Lane  
Discussion: <[email protected]>  

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

Don't mess up pstate->p_next_resno in transformOnConflictClause().

commit   : 3850723208888a6fe90b75ebf692af79119f4158    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Dec 2016 15:02:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Dec 2016 15:02:27 -0500    

Click here for diff

transformOnConflictClause incremented p_next_resno while generating the  
phony targetlist for the EXCLUDED pseudo-rel.  Then that field got  
incremented some more during transformTargetList, possibly leading to  
free_parsestate concluding that we'd overrun the allowed length of a tlist,  
as reported by Justin Pryzby.  
  
We could fix this by resetting p_next_resno to 1 after using it for the  
EXCLUDED pseudo-rel tlist, but it seems easier and less coupled to other  
places if we just don't use that field at all in this loop.  (Note that  
this doesn't change anything about the resnos that end up appearing in  
the main target list, because those are all replaced with target-column  
numbers by updateTargetListEntry.)  
  
In passing, fix incorrect type OID assigned to the whole-row Var for  
"EXCLUDED.*" (somehow this escaped having any bad consequences so far,  
but it's certainly wrong); remove useless assignment to var->location;  
pstrdup the column names in case of a relcache flush; and improve  
nearby comments.  
  
Back-patch to 9.5 where ON CONFLICT was introduced.  
  
Report: https://postgr.es/m/[email protected]  

M src/backend/parser/analyze.c

Document recipe for testing compatibility with old Perl.

commit   : d61aa6ae655a37d757b68d20ad18a4683c280c14    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 4 Dec 2016 00:16:55 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 4 Dec 2016 00:16:55 -0500    

Click here for diff

Craig Ringer, reviewed by Kyotaro HORIGUCHI and Michael Paquier.  

M src/test/perl/README

Make pgwin32_putenv() probe every known CRT, regardless of compiler.

commit   : 54aa6ccfc51414b94a2363be6302efb0f911b692    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 4 Dec 2016 00:16:54 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 4 Dec 2016 00:16:54 -0500    

Click here for diff

This extends to MinGW builds the provision for MSVC-built libraries to  
see putenv() effects.  Doing so repairs, for example, the handling of  
the krb_server_keyfile parameter when linked with MSVC-built MIT  
Kerberos.  Like the previous commit, no back-patch.  

M src/port/win32env.c

Make pgwin32_putenv() follow DLL loading and unloading.

commit   : 202dbdbe41e1b1085a4d69c96bca9a52e634b196    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 3 Dec 2016 15:46:36 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 3 Dec 2016 15:46:36 -0500    

Click here for diff

Until now, the first putenv() call of a given postgres.exe process would  
cache the set of loaded CRTs.  If a CRT unloaded after that call, the  
next putenv() would crash.  That risk was largely theoretical, because  
the first putenv() precedes all PostgreSQL-initiated module loading.  
However, this might explain bad interactions with antivirus and other  
software that injects threads asynchronously.  If an additional CRT  
loaded after the first putenv(), pgwin32_putenv() would not discover it.  
That CRT would have all environment changes predating its load, but it  
would not receive later PostgreSQL-initiated changes.  An additional CRT  
loading concurrently with the first putenv() might miss that change in  
addition to missing later changes.  Fix all those problems.  This  
removes the cache mechanism from pgwin32_putenv(); the cost, less than  
100 Ī¼s per backend startup, is negligible.  
  
No resulting misbehavior was known to be user-visible given the core  
distribution alone, but one can readily construct an affected extension  
module.  No back-patch given the lack of complaints and the potential  
for behavior changes in non-PostgreSQL code running in the backend.  
  
Christian Ullrich, reviewed by Michael Paquier.  

M src/port/win32env.c

Make pgwin32_putenv() visit debug CRTs.

commit   : 95b9b8a3977f854e0bfb2a5614b699b7774ae673    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 3 Dec 2016 15:46:36 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 3 Dec 2016 15:46:36 -0500    

Click here for diff

This has no effect in the most conventional case, where no relevant DLL  
uses a debug build.  For an example where it does matter, given a debug  
build of MIT Kerberos, the krb_server_keyfile parameter usually had no  
effect.  Since nobody wants a Heisenbug, back-patch to 9.2 (all  
supported versions).  
  
Christian Ullrich, reviewed by Michael Paquier.  

M src/port/win32env.c

Remove wrong CloseHandle() call.

commit   : b37da1e8a0e46ae12415fafd3ea441fc3546cf2f    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 3 Dec 2016 15:46:35 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 3 Dec 2016 15:46:35 -0500    

Click here for diff

In accordance with its own documentation, invoke CloseHandle() only when  
directed in the documentation for the function that furnished the  
handle.  GetModuleHandle() does not so direct.  We have been issuing  
this call only in the rare event that a CRT DLL contains no "_putenv"  
symbol, so lack of bug reports is uninformative.  Back-patch to 9.2 (all  
supported versions).  
  
Christian Ullrich, reviewed by Michael Paquier.  

M src/port/win32env.c

Refine win32env.c cosmetics.

commit   : a9d9208c15de4933f89e5b6ac1d9ef0efd299162    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 3 Dec 2016 15:46:35 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 3 Dec 2016 15:46:35 -0500    

Click here for diff

Replace use of plain 0 as a null pointer constant.  In comments, update  
terminology and lessen redundancy.  Back-patch to 9.2 (all supported  
versions) for the convenience of back-patching the next two commits.  
  
Christian Ullrich and Noah Misch, reviewed (in earlier versions) by  
Michael Paquier.  

M src/port/win32env.c

Fix broken wait-for-previous-process-to-exit loop in regression test.

commit   : 19fcc0058ecc8e5eb756547006bc1b24a93cbb80    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Dec 2016 17:23:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Dec 2016 17:23:54 -0500    

Click here for diff

Must do pg_stat_clear_snapshot() inside test's loop, or our snapshot of  
pg_stat_activity will never change :-(.  Thinko in b3427dade -- evidently  
my workstation never really iterated the loop in testing.  Per buildfarm.  

M src/test/modules/test_extensions/expected/test_extensions.out
M src/test/modules/test_extensions/sql/test_extensions.sql

Fix thinko in b3427dade14cc31eb48740bc9ea98b5954470b24.

commit   : 767a9039d79e35c78afa39cf5ffa3b485a2e3a5b    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 2 Dec 2016 15:06:41 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 2 Dec 2016 15:06:41 -0500    

Click here for diff

M src/include/utils/dsa.h

Delete deleteWhatDependsOn() in favor of more performDeletion() flag bits.

commit   : b3427dade14cc31eb48740bc9ea98b5954470b24    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Dec 2016 14:57:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Dec 2016 14:57:35 -0500    

Click here for diff

deleteWhatDependsOn() had grown an uncomfortably large number of  
assumptions about what it's used for.  There are actually only two minor  
differences between what it does and what a regular performDeletion() call  
can do, so let's invent additional bits in performDeletion's existing flags  
argument that specify those behaviors, and get rid of deleteWhatDependsOn()  
as such.  (We'd probably have done it this way from the start, except that  
performDeletion didn't originally have a flags argument, IIRC.)  
  
Also, add a SKIP_EXTENSIONS flag bit that prevents ever recursing to an  
extension, and use that when dropping temporary objects at session end.  
This provides a more general solution to the problem addressed in a hacky  
way in commit 08dd23cec: if an extension script creates temp objects and  
forgets to remove them again, the whole extension went away when its  
contained temp objects were deleted.  The previous solution only covered  
temp relations, but this solves it for all object types.  
  
These changes require minor additions in dependency.c to pass the flags  
to subroutines that previously didn't get them, but it's still a net  
savings of code, and it seems cleaner than before.  
  
Having done this, revert the special-case code added in 08dd23cec that  
prevented addition of pg_depend records for temp table extension  
membership, because that caused its own oddities: dropping an extension  
that had created such a table didn't automatically remove the table,  
leading to a failure if the table had another dependency on the extension  
(such as use of an extension data type), or to a duplicate-name failure if  
you then tried to recreate the extension.  But we keep the part that  
prevents the pg_temp_nnn schema from becoming an extension member; we never  
want that to happen.  Add a regression test case covering these behaviors.  
  
Although this fixes some arguable bugs, we've heard few field complaints,  
and any such problems are easily worked around by explicitly dropping temp  
objects at the end of extension scripts (which seems like good practice  
anyway).  So I won't risk a back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/extend.sgml
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/namespace.c
M src/backend/postmaster/autovacuum.c
M src/include/catalog/dependency.h
M src/include/commands/extension.h
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_ext8–1.0.sql
A src/test/modules/test_extensions/test_ext8.control

Introduce dynamic shared memory areas.

commit   : 13df76a537cca3b8884911d8fdf7c89a457a8dd3    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 2 Dec 2016 12:34:36 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 2 Dec 2016 12:34:36 -0500    

Click here for diff

Programmers discovered decades ago that it was useful to have a simple  
interface for allocating and freeing memory, which is why malloc() and  
free() were invented.  Unfortunately, those handy tools don't work  
with dynamic shared memory segments because those are specific to  
PostgreSQL and are not necessarily mapped at the same address in every  
cooperating process.  So invent our own allocator instead.  This makes  
it possible for processes cooperating as part of parallel query  
execution to allocate and free chunks of memory without having to  
reserve them prior to the start of execution.  It could also be used  
for longer lived objects; for example, we could consider storing data  
for pg_stat_statements or the stats collector in shared memory using  
these interfaces, rather than writing them to files.  Basically,  
anything that needs shared memory but can't predict in advance how  
much it's going to need might find this useful.  
  
Thomas Munro and Robert Haas.  The original code (of mine) on which  
Thomas based his work was actually designed to be a new backend-local  
memory allocator for PostgreSQL, but that hasn't gone anywhere - or  
not yet, anyway.  Thomas took that work and performed major  
refactoring and extensive modifications to make it work with dynamic  
shared memory, including the addition of appropriate locking.  
  
Discussion: CA+TgmobkeWptGwiNa+SGFWsTLzTzD-CeLz0KcE-y6LFgoUus4A@mail.gmail.com  
Discussion: CAEepm=1z5WLuNoJ80PaCvz6EtG9dN0j-KuHcHtU6QEfcPP5-qA@mail.gmail.com  

M src/backend/utils/mmgr/Makefile
A src/backend/utils/mmgr/dsa.c
A src/include/utils/dsa.h
M src/tools/pgindent/typedefs.list

Management of free memory pages.

commit   : 13e14a78ea15f4c581cae408b5010c13961c96de    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 2 Dec 2016 12:03:30 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 2 Dec 2016 12:03:30 -0500    

Click here for diff

This is intended as infrastructure for a full-fledged allocator for  
dynamic shared memory.  The interface looks a bit like a real  
allocator, but only supports allocating and freeing memory in  
multiples of the 4kB page size.  Further, to free memory, you must  
know the size of the span you wish to free, in pages.  While these are  
make it unsuitable as an allocator in and of itself, it still serves  
as very useful scaffolding for a full-fledged allocator.  
  
Robert Haas and Thomas Munro.  This code is mostly the same as my 2014  
submission, but Thomas fixed quite a few bugs and made some changes to  
the interface.  
  
Discussion: CA+TgmobkeWptGwiNa+SGFWsTLzTzD-CeLz0KcE-y6LFgoUus4A@mail.gmail.com  
Discussion: CAEepm=1z5WLuNoJ80PaCvz6EtG9dN0j-KuHcHtU6QEfcPP5-qA@mail.gmail.com  

M src/backend/utils/mmgr/Makefile
A src/backend/utils/mmgr/freepage.c
A src/include/utils/freepage.h
M src/tools/pgindent/typedefs.list

Add a crude facility for dealing with relative pointers.

commit   : fbc1c12a94a638cf4f577fef158175e22ab824a3    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 2 Dec 2016 11:29:01 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 2 Dec 2016 11:29:01 -0500    

Click here for diff

C doesn't have any sort of built-in understanding of a pointer  
relative to some arbitrary base address, but dynamic shared memory  
segments can be mapped at different addresses in different processes,  
so any sort of shared data structure stored within a dynamic shared  
memory segment can't use absolute pointers.  We could use something  
like Size to represent a relative pointer, but then the compiler  
provides no type-checking.  Use stupid macro tricks to get some  
type-checking.  
  
Patch originally by me.  Concept suggested by Andres Freund.  Recently  
resubmitted as part of Thomas Munro's work on dynamic shared memory  
allocation.  
  
Discussion: [email protected]  
Discussion: CAEepm=1z5WLuNoJ80PaCvz6EtG9dN0j-KuHcHtU6QEfcPP5-qA@mail.gmail.com  

A src/include/utils/relptr.h

Clarify that pg_stat_activity.query has a length limit.

commit   : e63d41498837667a4e2e0a4b9416bfda28c722d6    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 2 Dec 2016 08:58:41 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 2 Dec 2016 08:58:41 -0500    

Click here for diff

There was always documentation of the GUC that controlled what the  
limit actually was, but previously the documentation of the field  
itself made no mention of that limit.  
  
Ian Barwick  

M doc/src/sgml/monitoring.sgml

Fix outdated comments

commit   : 5e5986b6cbebcb57e6c95463031eef01e099e7e1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 2 Dec 2016 10:15:36 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 2 Dec 2016 10:15:36 -0300    

Click here for diff

Commit 597a87ccc9a6f neglected to update some comments; fix.  
  
Report and patch by Thomas Munro.  
Reviewed by Petr JelĆ­nek.  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Add max_parallel_workers GUC.

commit   : b460f5d6693103076dc554aa7cbb96e1e53074f9    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 2 Dec 2016 07:42:58 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 2 Dec 2016 07:42:58 -0500    

Click here for diff

Increase the default value of the existing max_worker_processes GUC  
from 8 to 16, and add a new max_parallel_workers GUC with a maximum  
of 8.  This way, even if the maximum amount of parallel query is  
happening, there is still room for background workers that do other  
things, as originally envisioned when max_worker_processes was added.  
  
Julien Rouhaud, reviewed by Amit Kapila and by revised by me.  

M doc/src/sgml/config.sgml
M src/backend/access/transam/parallel.c
M src/backend/postmaster/bgworker.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/bin/pg_resetxlog/pg_resetxlog.c
M src/include/miscadmin.h
M src/include/postmaster/bgworker.h

Fix Windows build for 78c8c814390f

commit   : 5714931b075b2dc8994b6e464ea3845c33ecf416    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 2 Dec 2016 09:40:36 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 2 Dec 2016 09:40:36 -0300    

Click here for diff

Author: Petr JelĆ­nek  

M src/include/replication/walreceiver.h

Permit dump/reload of not-too-large >1GB tuples

commit   : fa2fa995528023b2e6ba1108f2f47558c6b66dcd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 2 Dec 2016 00:34:01 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 2 Dec 2016 00:34:01 -0300    

Click here for diff

Our documentation states that our maximum field size is 1 GB, and that  
our maximum row size of 1.6 TB.  However, while this might be attainable  
in theory with enough contortions, it is not workable in practice; for  
starters, pg_dump fails to dump tables containing rows larger than 1 GB,  
even if individual columns are well below the limit; and even if one  
does manage to manufacture a dump file containing a row that large, the  
server refuses to load it anyway.  
  
This commit enables dumping and reloading of such tuples, provided two  
conditions are met:  
  
1. no single column is larger than 1 GB (in output size -- for bytea  
   this includes the formatting overhead)  
2. the whole row is not larger than 2 GB  
  
There are three related changes to enable this:  
  
a. StringInfo's API now has two additional functions that allow creating  
a string that grows beyond the typical 1GB limit (and "long" string).  
ABI compatibility is maintained.  We still limit these strings to 2 GB,  
though, for reasons explained below.  
  
b. COPY now uses long StringInfos, so that pg_dump doesn't choke  
trying to emit rows longer than 1GB.  
  
c. heap_form_tuple now uses the MCXT_ALLOW_HUGE flag in its allocation  
for the input tuple, which means that large tuples are accepted on  
input.  Note that at this point we do not apply any further limit to the  
input tuple size.  
  
The main reason to limit to 2 GB is that the FE/BE protocol uses 32 bit  
length words to describe each row; and because the documentation is  
ambiguous on its signedness and libpq does consider it signed, we cannot  
use the highest-order bit.  Additionally, the StringInfo API uses "int"  
(which is 4 bytes wide in most platforms) in many places, so we'd need  
to change that API too in order to improve, which has lots of fallout.  
  
Backpatch to 9.5, which is the oldest that has  
MemoryContextAllocExtended, a necessary piece of infrastructure.  We  
could apply to 9.4 with very minimal additional effort, but any further  
than that would require backpatching "huge" allocations too.  
  
This is the largest set of changes we could find that can be  
back-patched without breaking compatibility with existing systems.  
Fixing a bigger set of problems (for example, dumping tuples bigger than  
2GB, or dumping fields bigger than 1GB) would require changing the FE/BE  
protocol and/or changing the StringInfo API in an ABI-incompatible way,  
neither of which would be back-patchable.  
  
Authors: Daniel VƩritƩ, Ɓlvaro Herrera  
Reviewed by: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/heaptuple.c
M src/backend/commands/copy.c
M src/backend/lib/stringinfo.c
M src/include/lib/stringinfo.h

Refactor libpqwalreceiver

commit   : 78c8c814390f14398e8fd43fe7282cb2e260b50f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Nov 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Nov 2016 12:00:00 -0500    

Click here for diff

The whole walreceiver API is now wrapped into a struct, like most of our  
other loadable module APIs.  The libpq connection is no longer a global  
variable in libpqwalreceiver.  Instead, it is encapsulated into a struct  
that is passed around the functions.  This allows multiple walreceivers  
to run at the same time.  
  
Add some rudimentary support for logical replication connections to  
libpqwalreceiver.  
  
These changes are mostly cosmetic and are going to be useful for the  
future logical replication patches.  
  
From: Petr Jelinek <[email protected]>  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/walreceiver.c
M src/include/replication/walreceiver.h

Use latch instead of select() in walreceiver

commit   : 597a87ccc9a6fa8af7f3cf280b1e24e41807d555    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Nov 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Nov 2016 12:00:00 -0500    

Click here for diff

Replace use of poll()/select() by WaitLatchOrSocket(), which is more  
portable and flexible.  
  
Also change walreceiver to use its procLatch instead of a custom latch.  
  
From: Petr Jelinek <[email protected]>  

M src/backend/postmaster/pgstat.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/include/pgstat.h
M src/include/replication/walreceiver.h

Add aggregate_with_argtypes and use it consistently

commit   : b999c247a5df4110a2ae20b01f0f686840169875    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 15 Sep 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 15 Sep 2016 12:00:00 -0500    

Click here for diff

This works like function_with_argtypes, but aggregates allow slightly  
different arguments.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  

M src/backend/parser/gram.y

Move function_with_argtypes to a better location

commit   : e696dccec1c01a92c83eeebedbc8ad948e6b1f61    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 15 Sep 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 15 Sep 2016 12:00:00 -0500    

Click here for diff

It was apparently added for use by GRANT/REVOKE, but move it closer to  
where other function signature related things are kept.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  

M src/backend/parser/gram.y

Use grammar symbol function_with_argtypes consistently

commit   : 0aff9293bf79b606ab3c65fdf34e47c8989b7b2d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 15 Sep 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 15 Sep 2016 12:00:00 -0500    

Click here for diff

Instead of sometimes referring to a function signature like func_name  
func_args, use the existing function_with_argtypes symbol, which  
combines the two.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  

M src/backend/parser/gram.y

libpq: Fix inadvertent change in PQhost() behavior.

commit   : 11003eb55658df0caf183eef69c7a97d56a4f2d7    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 1 Dec 2016 14:36:39 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 1 Dec 2016 14:36:39 -0500    

Click here for diff

Commit 274bb2b3857cc987cfa21d14775cae9b0dababa5 caused PQhost() to  
return the value of the hostaddr parameter rather than the relevant  
host when the latter parameter was specified.  That's wrong.  Commit  
9a1d0af4ad2cbd419115b453d811c141b80d872b then amplified the damage by  
using PQhost() in more places, so that the SSL test suite started  
failing.  
  
Report by Andreas Karlsson; patch by me.  

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

Added missing "EXEC SQL" to statement.

commit   : a01a5013d9fa223a2e1b8ec1c6c6c2a47a6b808a    
  
author   : Michael Meskes <[email protected]>    
date     : Thu, 1 Dec 2016 12:26:50 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Thu, 1 Dec 2016 12:26:50 +0100    

Click here for diff

M doc/src/sgml/ecpg.sgml

User narrower representative tuples in the hash-agg hashtable.

commit   : fc4b3dea2950e4f6081f1ed2380f82c9efd672e0    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 30 Nov 2016 17:30:09 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 30 Nov 2016 17:30:09 -0800    

Click here for diff

So far the hashtable stored representative tuples in the form of its  
input slot, with all columns in the hashtable that are not  
needed (i.e. not grouped upon or functionally dependent) set to NULL.  
  
Thats good for saving memory, but it turns out that having tuples full  
of NULL isn't free. slot_deform_tuple is faster if there's no NULL  
bitmap even if no NULLs are encountered, and skipping over leading NULLs  
isn't free.  
  
So compute a separate tuple descriptor that only contains the needed  
columns. As columns have already been moved in/out the slot for the  
hashtable that does not imply additional per-row overhead.  
  
Author: Andres Freund  
Reviewed-By: Heikki Linnakangas  
Discussion: https://postgr.es/m/[email protected]  

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

Perform one only projection to compute agg arguments.

commit   : 8ed3f11bb045ad7a3607690be668dbd5b3cc31d7    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 30 Nov 2016 16:08:11 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 30 Nov 2016 16:08:11 -0800    

Click here for diff

Previously we did a ExecProject() for each individual aggregate  
argument. That turned out to be a performance bottleneck in queries with  
multiple aggregates.  
  
Doing all the argument computations in one ExecProject() is quite a bit  
cheaper because ExecProject's fastpath can do the work at once in a  
relatively tight loop, and because it can get all the required columns  
with a single slot_getsomeattr and save some other redundant setup  
costs.  
  
Author: Andres Freund  
Reviewed-By: Heikki Linnakangas  
Discussion: https://postgr.es/m/[email protected]  

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

Improve hash index bucket split behavior.

commit   : 6d46f4783efe457f74816a75173eb23ed8930020    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 30 Nov 2016 15:39:21 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 30 Nov 2016 15:39:21 -0500    

Click here for diff

Previously, the right to split a bucket was represented by a  
heavyweight lock on the page number of the primary bucket page.  
Unfortunately, this meant that every scan needed to take a heavyweight  
lock on that bucket also, which was bad for concurrency.  Instead, use  
a cleanup lock on the primary bucket page to indicate the right to  
begin a split, so that scans only need to retain a pin on that page,  
which is they would have to acquire anyway, and which is also much  
cheaper.  
  
In addition to reducing the locking cost, this also avoids locking out  
scans and inserts for the entire lifetime of the split: while the new  
bucket is being populated with copies of the appropriate tuples from  
the old bucket, scans and inserts can happen in parallel.  There are  
minor concurrency improvements for vacuum operations as well, though  
the situation there is still far from ideal.  
  
This patch also removes the unworldly assumption that a split will  
never be interrupted.  With the new code, a split is done in a series  
of small steps and the system can pick up where it left off if it is  
interrupted prior to completion.  While this patch does not itself add  
write-ahead logging for hash indexes, it is clearly a necessary first  
step, since one of the things that could interrupt a split is the  
removal of electrical power from the machine performing it.  
  
Amit Kapila.  I wrote the original design on which this patch is  
based, and did a good bit of work on the comments and README through  
multiple rounds of review, but all of the code is Amit's.  Also  
reviewed by Jesper Pedersen, Jeff Janes, and others.  
  
Discussion: http://postgr.es/m/CAA4eK1LfzcZYxLoXS874Ad0+S-ZM60U9bwcyiUZx9mHZ-KCWhw@mail.gmail.com  

M src/backend/access/hash/Makefile
M src/backend/access/hash/README
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
D src/backend/access/hash/hashscan.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashutil.c
M src/backend/utils/resowner/resowner.c
M src/include/access/hash.h
M src/include/access/itup.h

commit   : 213c0f2d7880f78c710127920cf4bf7017e0fa57    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Nov 2016 13:34:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Nov 2016 13:34:13 -0500    

Click here for diff

Per bug #14441 from Mark Pether, the documentation could be misread,  
mainly because some of the examples failed to show what happens with  
a multicharacter "characters to trim" string.  Also, while the text  
description in most of these entries was fairly clear that the  
"characters" argument is a set of characters not a substring to match,  
some of them used variant wording that was a bit less clear.  
trim() itself suffered from both deficiencies and was thus pretty  
misinterpretable.  
  
Also fix failure to explain which of LEADING/TRAILING/BOTH is the  
default.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Make all unicode perl scripts to use strict, rearrange logic for clarity.

commit   : 021d254d9aa0a26a2f6e8cecd922024e65be93a0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 30 Nov 2016 18:06:34 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 30 Nov 2016 18:06:34 +0200    

Click here for diff

The loops were a bit difficult to understand, due to breaking out of them  
early. Also fix things that perlcritic complained about.  
  
Daniel Gustafsson  

M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl

doc: Remove claim about large shared_buffers on Windows

commit   : 81c52728f82be5303ea16508255e948017f4cd87    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Nov 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Nov 2016 12:00:00 -0500    

Click here for diff

Testing has shown that it is no longer correct.  
  
From: Tsunakawa, Takayuki <[email protected]>  
Reviewed-by: amul sul <[email protected]>  
Discussion: http://www.postgresql.org/message-id/flat/0A3221C70F24FB45833433255569204D1F5EE995@G01JPEXMBYT05/  

M doc/src/sgml/config.sgml

doc: Fix typo

commit   : 2f0c7ff48b68b6fb6dc373ffcebd99343a9f6451    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Nov 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Nov 2016 12:00:00 -0500    

Click here for diff

From: Tsunakawa, Takayuki <[email protected]>  

M doc/src/sgml/config.sgml

Rewrite the perl scripts to produce our Unicode conversion tables.

commit   : 1de9cc0dcca649d1900720924f4ea5c430d1a51e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 30 Nov 2016 14:54:02 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 30 Nov 2016 14:54:02 +0200    

Click here for diff

Generate EUC_CN mappings from gb-18030-2000.xml, because GB2312.TXT is no  
longer available.  
  
Get UHC from windows-949-2000.xml, it's more up-to-date.  
  
Plus tons more small changes. With these changes, the perl scripts  
faithfully produce the *.map files we have in the repository, from the  
external source files.  
  
In the passing, fix the Makefile to also download CP932.TXT and CP950.TXT.  
  
Based on patches by Kyotaro Horiguchi, reviewed by Daniel Gustafsson.  
  
Discussion: https://postgr.es/m/[email protected]  

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
A src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
A src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
A src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/mb/Unicode/euc_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/euc_jis_2004_to_utf8_combined.map
M src/backend/utils/mb/Unicode/euc_jp_to_utf8.map
M src/backend/utils/mb/Unicode/euc_kr_to_utf8.map
M src/backend/utils/mb/Unicode/johab_to_utf8.map
M src/backend/utils/mb/Unicode/shift_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/shift_jis_2004_to_utf8_combined.map
D src/backend/utils/mb/Unicode/ucs2utf.pl
M src/backend/utils/mb/Unicode/uhc_to_utf8.map
M src/backend/utils/mb/Unicode/utf8_to_euc_cn.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jis_2004.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jis_2004_combined.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jp.map
M src/backend/utils/mb/Unicode/utf8_to_euc_kr.map
M src/backend/utils/mb/Unicode/utf8_to_johab.map
M src/backend/utils/mb/Unicode/utf8_to_shift_jis_2004.map
M src/backend/utils/mb/Unicode/utf8_to_shift_jis_2004_combined.map
M src/backend/utils/mb/Unicode/utf8_to_sjis.map
M src/backend/utils/mb/Unicode/utf8_to_uhc.map

Remove leading zeros, for consistency with other map files.

commit   : 6c303223be34329bae2f03a87590ffa0742a65f6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 30 Nov 2016 14:53:59 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 30 Nov 2016 14:53:59 +0200    

Click here for diff

The common style is to pad to 4 digits.  
  
Running the current perl scripts to generate these map files would override  
this change, but the next commit will rewrite the perl scripts to produce  
this style. I'm doing this as a separate commit, to make it more clear what  
non-cosmetic changes the next commit makes to the map files.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mb/Unicode/euc_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/euc_jis_2004_to_utf8_combined.map
M src/backend/utils/mb/Unicode/shift_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jis_2004.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jis_2004_combined.map
M src/backend/utils/mb/Unicode/utf8_to_shift_jis_2004.map

Remove code points < 0x80 from character conversion tables.

commit   : 2c09c93ce1b80a417b7c372c43f5089c0d691749    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 30 Nov 2016 14:53:57 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 30 Nov 2016 14:53:57 +0200    

Click here for diff

PostgreSQL treats characters with < 0x80 leading byte  as plain ASCII, and  
they are not even passed to the conversion routines. There is no point in  
having them in the conversion tables.  
  
Everything in the tables were direct ASCII-ASCII mappings, except for two:  
* SHIFT_JIS_2004 code point 0x5C (backslash in ASCII) was mapped to Unicode  
  YEN SIGN character.  
* Unicode 0x5C (backslash again) was mapped to "REVERSE SOLIDUS" in  
  SHIFT_JIS_2004  
  
These mappings never had any effect, so there's no functional change from  
removing them.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mb/Unicode/euc_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/shift_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jis_2004.map
M src/backend/utils/mb/Unicode/utf8_to_shift_jis_2004.map

Remove dead stuff from pgcrypto.

commit   : b2cc748b09456ea24cdd00a7691ce33db9a1af45    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 30 Nov 2016 13:04:16 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 30 Nov 2016 13:04:16 +0200    

Click here for diff

pgp-pubkey-DISABLED test has been unused since 2006, when support for  
built-in bignum math was added (commit 1abf76e8). pgp-encrypt-DISABLED has  
been unused forever, AFAICS.  
  
Also remove a couple of unused error codes.  

D contrib/pgcrypto/expected/pgp-encrypt-DISABLED.out
D contrib/pgcrypto/expected/pgp-pubkey-DISABLED.out
M contrib/pgcrypto/px.c
M contrib/pgcrypto/px.h
D contrib/pgcrypto/sql/pgp-encrypt-DISABLED.sql
D contrib/pgcrypto/sql/pgp-pubkey-DISABLED.sql

Fix bogus handling of JOIN_UNIQUE_OUTER/INNER cases for parallel joins.

commit   : 41e2b84ce1b89ae0125dd34318c56aa51386e2a2    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2016 19:32:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2016 19:32:35 -0500    

Click here for diff

consider_parallel_nestloop passed the wrong jointype down to its  
subroutines for JOIN_UNIQUE_INNER cases (it should pass JOIN_INNER), and it  
thought that it could pass paths other than innerrel->cheapest_total_path  
to create_unique_path, which create_unique_path is not on board with.  
These bugs would lead to assertion failures or other errors, suggesting  
that this code path hasn't been tested much.  
  
hash_inner_and_outer's code for parallel join effectively treated both  
JOIN_UNIQUE_OUTER and JOIN_UNIQUE_INNER the same as JOIN_INNER (for  
different reasons :-(), leading to incorrect plans that treated a semijoin  
as if it were a plain join.  
  
Michael Day submitted a test case demonstrating that hash_inner_and_outer  
failed for JOIN_UNIQUE_OUTER, and I found the other cases through code  
review.  
  
Report: https://postgr.es/m/[email protected]  

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

Improve eqjoinsel_semi's behavior for small inner relations with no stats.

commit   : ca5f88502096a39f831da74eb02ec9eb3310616d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2016 18:00:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2016 18:00:49 -0500    

Click here for diff

If we don't have any MCV statistics for the inner relation, and we don't  
trust its numdistinct estimate either, eqjoinsel_semi falls back to a very  
conservative estimate (that 50% of the outer rows have matches).  This is  
particularly problematic if the inner relation is completely empty, since  
then even an explicit ANALYZE won't produce any pg_statistic entries,  
so there's no way to budge the planner off the bad estimate.  
  
We'd produce a better estimate in such cases if we used the nd2/nd1  
selectivity heuristic, so an easy fix is to treat the nd2 estimate as  
non-default if we derive it from clamping to the inner rel's rowcount  
estimate.  This won't fix every related case (mainly because the rowcount  
estimate might be larger than DEFAULT_NUM_DISTINCT), but it seems like a  
sane extension of the existing logic, so let's apply the change in HEAD  
and see if anyone complains.  Per bug #14438 from Nikolay Nikitin.  
  
Report: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Straighten out some whitespace

commit   : 96fb4c90e3b227f3f1770fd2f7ea1e0478a4d37c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Nov 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Nov 2016 12:00:00 -0500    

Click here for diff

M src/backend/Makefile

Test all contrib-created operator classes with amvalidate.

commit   : ade49c605f1d8f517497829363f8b83f69c73a60    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2016 15:05:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2016 15:05:22 -0500    

Click here for diff

I'd supposed that people would do this manually when creating new operator  
classes, but the folly of that was exposed today.  The tests seem fast  
enough that we can just apply them during the normal regression tests.  
  
contrib/isn fails the checks for lack of complete sets of cross-type  
operators.  That's a nice-to-have policy rather than a functional  
requirement, so leave it as-is, but insert ORDER BY in the query to  
ensure consistent cross-platform output.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gin/expected/install_btree_gin.out
M contrib/btree_gin/sql/install_btree_gin.sql
M contrib/btree_gist/expected/init.out
M contrib/btree_gist/sql/init.sql
M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/citext/sql/citext.sql
M contrib/cube/expected/cube.out
M contrib/cube/expected/cube_2.out
M contrib/cube/sql/cube.sql
M contrib/hstore/expected/hstore.out
M contrib/hstore/sql/hstore.sql
M contrib/intarray/expected/_int.out
M contrib/intarray/sql/_int.sql
M contrib/isn/expected/isn.out
M contrib/isn/sql/isn.sql
M contrib/ltree/expected/ltree.out
M contrib/ltree/sql/ltree.sql
M contrib/pg_trgm/expected/pg_trgm.out
M contrib/pg_trgm/sql/pg_trgm.sql
M contrib/seg/expected/seg.out
M contrib/seg/expected/seg_1.out
M contrib/seg/sql/seg.sql
M contrib/tsearch2/expected/tsearch2.out
M contrib/tsearch2/sql/tsearch2.sql

Add uuid to the set of types supported by contrib/btree_gist.

commit   : 11da83a0e70d32ed0e06a5c948cd8343f8ad5102    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2016 14:08:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2016 14:08:23 -0500    

Click here for diff

Paul Jungwirth, reviewed and hacked on by Teodor Sigaev, Ildus  
Kurbangaliev, Adam Brusselback, Chris Bandy, and myself.  
  
Discussion: https://postgr.es/m/CA+renyUEE29=X01JXdz8_TQvo6n9=2XoEBBRnQ8rkLyr+kjPxQ@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gist/Makefile
A contrib/btree_gist/btree_gist–1.2–1.3.sql
M contrib/btree_gist/btree_gist.control
M contrib/btree_gist/btree_gist.h
A contrib/btree_gist/btree_uuid.c
A contrib/btree_gist/data/uuid.data
A contrib/btree_gist/expected/uuid.out
A contrib/btree_gist/sql/uuid.sql
M doc/src/sgml/btree-gist.sgml
M src/backend/utils/adt/uuid.c
M src/include/utils/uuid.h

libpq: Add target_session_attrs parameter.

commit   : 721f7bd3cbccaf8c07cad2707826b83f84694832    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Nov 2016 12:18:31 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Nov 2016 12:18:31 -0500    

Click here for diff

Commit 274bb2b3857cc987cfa21d14775cae9b0dababa5 made it possible to  
specify multiple IPs in a connection string, but that's not good  
enough for the case where you have a read-write master and a bunch of  
read-only standbys and want to connect to whichever server is the  
master at the current time.  This commit allows that, by making it  
possible to specify target_session_attrs=read-write as a connection  
parameter.  
  
There was extensive discussion of the best name for the connection  
parameter and its values as well as the best way to distinguish master  
and standbys.  For now, adopt the same solution as JDBC: if the user  
wants a read-write connection, issue 'show transaction_read_only' and  
rejection the connection if the result is 'on'.  In the future, we  
could add additional values of this new target_session_attrs parameter  
that issue different queries; or we might have some way of  
distinguishing the server type without resorting to an SQL query; but  
right now, we have this, and that's (hopefully) a good start.  
  
Victor Wagner and Mithun Cy.  Design review by Ɓlvaro Herrera, Catalin  
Iacob, Takayuki Tsunakawa, and Craig Ringer; code review by me.  I  
changed Mithun's patch to skip all remaining IPs for a host if we  
reject a connection based on this new parameter, rewrote the  
documentation, and did some other cosmetic cleanup.  
  
Discussion: http://postgr.es/m/CAD__OuhqPRGpcsfwPHz_PDqAGkoqS1UvnUnOnAB-LBWBW=wu4A@mail.gmail.com  

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

Add --no-blobs option to pg_dump

commit   : 4fafa579b0ab411f4cd2f30c57205d9b0ac27340    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 29 Nov 2016 11:09:35 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 29 Nov 2016 11:09:35 -0500    

Click here for diff

Add an option to exclude blobs when running pg_dump.  By default, blobs  
are included but this option can be used to exclude them while keeping  
the rest of the dump.  
  
Commment updates and regression tests from me.  
  
Author: Guillaume Lelarge  
Reviewed-by: Amul Sul  
Discussion: https://postgr.es/m/VisenaEmail.48.49926ea6f91dceb6.15355a48249@tc7-visena  

M doc/src/sgml/ref/pg_dump.sgml
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl

Fix incorrect variable type in set_rel_consider_parallel().

commit   : d6c8b34e956864d52780f0db9f8cfe3b2f4411b0    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2016 11:07:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2016 11:07:02 -0500    

Click here for diff

func_parallel() returns char not Oid.  Harmless, but still wrong.  
  
Amit Langote  

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

Clarify pg_dump -b documentation

commit   : b57c8333b55e315927ca65016f1dbc165ef30df9    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 29 Nov 2016 10:35:04 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 29 Nov 2016 10:35:04 -0500    

Click here for diff

The documentation around the -b/--blobs option to pg_dump seemed to  
imply that it might be possible to add blobs to a "schema-only" dump or  
similar.  Clarify that blobs are data and therefore will only be  
included in dumps where data is being included, even when -b is used to  
request blobs be included.  
  
The -b option has been around since before 9.2, so back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Correct psql documentation example

commit   : 489a51af12de58e336c7b97e793aed6d11bb13b5    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 29 Nov 2016 09:03:11 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 29 Nov 2016 09:03:11 -0500    

Click here for diff

An example in the psql documentation had an incorrect field name from  
what the command actually produced.  
  
Pointed out by Fabien COELHO  
  
Back-patch to 9.6 where the example was added.  
  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1611291349400.19314@lancre  

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

Fix estimate_expression_value to constant-fold SQLValueFunction nodes.

commit   : 4e20511d5b8ba427730e09be45f9458f667f9c1e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Nov 2016 19:08:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Nov 2016 19:08:38 -0500    

Click here for diff

Oversight in my commit 0bb51aa96.  Noted while poking at a recent  
bug report --- HEAD's estimates for a query using CURRENT_DATE  
were unexpectedly much worse than 9.6's.  

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

Fix get_relation_info name typo'ed in a comment

commit   : eb6814168862ef0ff44716467aacdebcef87415a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Nov 2016 15:56:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Nov 2016 15:56:00 -0300    

Click here for diff

Plus add a missing comment about this in get_relation_info itself.  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

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

Fix busted tab-completion pattern for ALTER TABLE t ALTER c DROP ...

commit   : 404e667580fec0ab9a89a38eaa8643ee7227fdb8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Nov 2016 11:51:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Nov 2016 11:51:30 -0500    

Click here for diff

Evidently a thinko in commit 9b181b036.  
  
Kyotaro Horiguchi  

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

Code review for early drop of orphaned temp relations in autovacuum.

commit   : dafa0848da11260e9510c699e7060171336cb550    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 27 Nov 2016 21:23:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 27 Nov 2016 21:23:39 -0500    

Click here for diff

Commit a734fd5d1 exposed some race conditions that existed previously  
in the autovac code, but were basically harmless because autovac would  
not try to delete orphaned relations immediately.  Specifically, the test  
for orphaned-ness was made on a pg_class tuple that might be dead by now,  
allowing autovac to try to remove a table that the owning backend had just  
finished deleting.  This resulted in a hard crash due to inadequate caution  
about accessing the table's catalog entries without any lock.  We must take  
a relation lock and then recheck whether the table is still present and  
still looks deletable before we do anything.  
  
Also, it seemed to me that deleting multiple tables per transaction, and  
trying to continue after errors, represented unjustifiable complexity.  
We do not expect this code path to be taken often in the field, nor even  
during testing, which means that prioritizing performance over correctness  
is a bad tradeoff.  Rip all that out in favor of just starting a new  
transaction after each successful temp table deletion.  If we're unlucky  
enough to get an error, which shouldn't happen anyway now that we're being  
more cautious, let the autovacuum worker fail as it normally would.  
  
In passing, improve the order of operations in the initial scan loop.  
Now that we don't care about whether a temp table is a wraparound hazard,  
there's no need to perform extract_autovac_opts, get_pgstat_tabentry_relid,  
or relation_needs_vacanalyze for temp tables.  
  
Also, if GetTempNamespaceBackendId returns InvalidBackendId (indicating  
it doesn't recognize the schema as temp), treat that as meaning it's NOT  
an orphaned temp table, not that it IS one, which is what happened before  
because BackendIdGetProc necessarily failed.  The case really shouldn't  
come up for a table that has RELPERSISTENCE_TEMP, but the consequences  
if it did seem undesirable.  (This might represent a back-patchable bug  
fix; not sure if it's worth the trouble.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/autovacuum.c

Mention server start requirement for ssl parameters

commit   : c6dbc7b65175f791b8e63a1970ee6b6f68ebec09    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 27 Nov 2016 17:10:02 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 27 Nov 2016 17:10:02 +0100    

Click here for diff

Fix that the documentation for three ssl related parameters did not  
specify that they can only be changed at server start.  
  
Michael Paquier  

M doc/src/sgml/config.sgml

Fix test about ignoring extension dependencies during extension scripts.

commit   : 182db070403fb33566da156a3a77cbcda16583b4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Nov 2016 13:31:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Nov 2016 13:31:35 -0500    

Click here for diff

Commit 08dd23cec introduced an exception to the rule that extension member  
objects can only be dropped as part of dropping the whole extension,  
intending to allow such drops while running the extension's own creation or  
update scripts.  However, the exception was only applied at the outermost  
recursion level, because it was modeled on a pre-existing check to ignore  
dependencies on objects listed in pendingObjects.  Bug #14434 from Philippe  
Beaudoin shows that this is inadequate: in some cases we can reach an  
extension member object by recursion from another one.  (The bug concerns  
the serial-sequence case; I'm not sure if there are other cases, but there  
might well be.)  
  
To fix, revert 08dd23cec's changes to findDependentObjects() and instead  
apply the creating_extension exception regardless of stack level.  
  
Having seen this example, I'm a bit suspicious that the pendingObjects  
logic is also wrong and such cases should likewise be allowed at any  
recursion level.  However, changing that would interact in subtle ways  
with the recursion logic (at least it would need to be moved to after the  
recursing-from check).  Given that the code's been like that a long time,  
I'll refrain from touching it without a clear example showing it's wrong.  
  
Back-patch to all active branches.  In HEAD and 9.6, where suitable  
test infrastructure exists, add a regression test case based on the  
bug report.  
  
Report: <[email protected]>  
Discussion: <[email protected]>  

M src/backend/catalog/dependency.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_ext7–1.0–2.0.sql
A src/test/modules/test_extensions/test_ext7–1.0.sql
A src/test/modules/test_extensions/test_ext7.control

Mark IsPostmasterEnvironment and IsBackgroundWorker as PGDLLIMPORT.

commit   : 273270593f42bdbd5422923eb70fbd0fb0f65bf0    
  
author   : Robert Haas <[email protected]>    
date     : Sat, 26 Nov 2016 10:29:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Sat, 26 Nov 2016 10:29:18 -0500    

Click here for diff

Per request from Craig Ringer.  

M src/include/miscadmin.h

Bring some clarity to the defaults for the xxx_flush_after parameters.

commit   : dbdfd114f34443f1e4ad16ce2721f9817d3b3d80    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Nov 2016 18:36:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Nov 2016 18:36:10 -0500    

Click here for diff

Instead of confusingly stating platform-dependent defaults for these  
parameters in the comments in postgresql.conf.sample (with the main  
entry being a lie on Linux), teach initdb to install the correct  
platform-dependent value in postgresql.conf, similarly to the way  
we handle other platform-dependent defaults.  This won't do anything  
for existing 9.6 installations, but since it's effectively only a  
documentation improvement, that seems OK.  
  
Since this requires initdb to have access to the default values,  
move the #define's for those to pg_config_manual.h; the original  
placement in bufmgr.h is unworkable because that file can't be  
included by frontend programs.  
  
Adjust the default value for wal_writer_flush_after so that it is 1MB  
regardless of XLOG_BLCKSZ, conforming to what is stated in both the  
SGML docs and postgresql.conf.  (We could alternatively make it scale  
with XLOG_BLCKSZ, but I'm not sure I see the point.)  
  
Copy-edit related SGML documentation.  
  
Fabien Coelho and Tom Lane, per a gripe from Tomas Vondra.  
  
Discussion: <[email protected]>  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xlog.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c
M src/include/pg_config_manual.h
M src/include/storage/bufmgr.h

Mark a query's topmost Paths parallel-unsafe if they will have initPlans.

commit   : ab77a5a4561fad847af4a101a29c922c66449870    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Nov 2016 16:20:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Nov 2016 16:20:12 -0500    

Click here for diff

Andreas Seltenreich found another case where we were being too optimistic  
about allowing a plan to be considered parallelizable despite it containing  
initPlans.  It seems like the real issue here is that if we know we are  
going to tack initPlans onto the topmost Plan node for a subquery, we  
had better mark that subquery's result Paths as not-parallel-safe.  That  
fixes this problem and allows reversion of a kluge (added in commit  
7b67a0a49 and extended in f24cf960d) to not trust the parallel_safe flag  
at top level.  
  
Discussion: <[email protected]>  

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

Check for pending trigger events on far end when dropping an FK constraint.

commit   : 4e026b32d4024b03856b4981b26c747b7fef7afb    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Nov 2016 13:44:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Nov 2016 13:44:47 -0500    

Click here for diff

When dropping a foreign key constraint with ALTER TABLE DROP CONSTRAINT,  
we refuse the drop if there are any pending trigger events on the named  
table; this ensures that we won't remove the pg_trigger row that will be  
consulted by those events.  But we should make the same check for the  
referenced relation, else we might remove a due-to-be-referenced pg_trigger  
row for that relation too, resulting in "could not find trigger NNN" or  
"relation NNN has no triggers" errors at commit.  Per bug #14431 from  
Benjie Gillam.  Back-patch to all supported branches.  
  
Report: <[email protected]>  

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

Fix typo in comment

commit   : 8afb811088c2a8bfa2b68bd24c05471b8ea4a8ce    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 25 Nov 2016 13:06:19 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 25 Nov 2016 13:06:19 +0100    

Click here for diff

Thomas Munro  

M src/backend/executor/execParallel.c

Check that default_tablespace affects ALTER TABLE ADD UNIQUE/PRIMARY KEY.

commit   : 4cc6a3f1106034187be3a371e61a02915bb93c11    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Nov 2016 14:13:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Nov 2016 14:13:19 -0500    

Click here for diff

Seems like a good thing to test, considering that we nearly broke it  
yesterday.  
  
Michael Paquier  

M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source

Fix commit_ts for FrozenXid and BootstrapXid

commit   : 4aaddf2f009821e29aea3735e44332ad9ca47aaa    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 24 Nov 2016 15:39:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 24 Nov 2016 15:39:55 -0300    

Click here for diff

Previously, requesting commit timestamp for transactions  
FrozenTransactionId and BootstrapTransactionId resulted in an error.  
But since those values can validly appear in committed tuples' Xmin,  
this behavior is unhelpful and error prone: each caller would have to  
special-case those values before requesting timestamp data for an Xid.  
We already have a perfectly good interface for returning "the Xid you  
requested is too old for us to have commit TS data for it", so let's use  
that instead.  
  
Backpatch to 9.5, where commit timestamps appeared.  
  
Author: Craig Ringer  
Discussion: https://www.postgresql.org/message-id/CAMsr+YFM5Q=+ry3mKvWEqRTxrB0iU3qUSRnS28nz6FJYtBwhJg@mail.gmail.com  

M src/backend/access/transam/commit_ts.c
M src/test/modules/commit_ts/expected/commit_timestamp.out
M src/test/modules/commit_ts/expected/commit_timestamp_1.out
M src/test/modules/commit_ts/t/004_restart.pl

Avoid masking a function parameter name with a local variable name.

commit   : 6fa391be4e83139cd134d5ccfc1499809bb8c98c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Nov 2016 16:26:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Nov 2016 16:26:40 -0500    

Click here for diff

No actual bug here, but it might confuse readers, so change the name  
of the local variable.  
  
Ashutosh Bapat  

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

Make sure ALTER TABLE preserves index tablespaces.

commit   : bd673e8e864a1987eca8d40c593e857ab8d0a5ba    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Nov 2016 13:45:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Nov 2016 13:45:55 -0500    

Click here for diff

When rebuilding an existing index, ALTER TABLE correctly kept the  
physical file in the same tablespace, but it messed up the pg_class  
entry if the index had been in the database's default tablespace  
and "default_tablespace" was set to some non-default tablespace.  
This led to an inaccessible index.  
  
Fix by fixing pg_get_indexdef_string() to always include a tablespace  
clause, whether or not the index is in the default tablespace.  The  
previous behavior was installed in commit 537e92e41, and I think it just  
wasn't thought through very clearly; certainly the possible effect of  
default_tablespace wasn't considered.  There's some risk in changing the  
behavior of this function, but there are no other call sites in the core  
code.  Even if it's being used by some third party extension, it's fairly  
hard to envision a usage that is okay with a tablespace clause being  
appended some of the time but can't handle it being appended all the time.  
  
Back-patch to all supported versions.  
  
Code fix by me, investigation and test cases by Michael Paquier.  
  
Discussion: <[email protected]>  

M src/backend/utils/adt/ruleutils.c
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source

Remove barrier.h

commit   : e343dfa42bff35983c582da3916b205763aeac90    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 22 Nov 2016 19:57:45 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 22 Nov 2016 19:57:45 -0500    

Click here for diff

A new thing also called a "barrier" is proposed, but whether we decide  
to take that patch or not, this file seems to have outlived its  
usefulness.  
  
Thomas Munro  

M src/backend/access/transam/xlog.c
M src/backend/main/main.c
M src/backend/postmaster/bgworker.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/shm_toc.c
M src/backend/storage/lmgr/s_lock.c
M src/include/pgstat.h
D src/include/storage/barrier.h

Doc: improve documentation about composite-value usage.

commit   : e1320266edd7df53c60af10b4c33ab2754278b3e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 Nov 2016 17:56:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 Nov 2016 17:56:16 -0500    

Click here for diff

Create a section specifically for the syntactic rules around whole-row  
variable usage, such as expansion of "foo.*".  This was previously  
documented only haphazardly, with some critical info buried in  
unexpected places like xfunc-sql-composite-functions.  Per repeated  
questions in different mailing lists.  
  
Discussion: <[email protected]>  

M doc/src/sgml/queries.sgml
M doc/src/sgml/rowtypes.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/xfunc.sgml

Code review for commit 274bb2b3857cc987cfa21d14775cae9b0dababa5.

commit   : 9a1d0af4ad2cbd419115b453d811c141b80d872b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 22 Nov 2016 15:32:13 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 22 Nov 2016 15:32:13 -0500    

Click here for diff

Avoid memory leak in conninfo_uri_parse_options.  Use the current host  
rather than the comma-separated list of host names when the host name  
is needed for GSS, SSPI, or SSL authentication.  Document the way  
connect_timeout interacts with multiple host specifications.  
  
Takayuki Tsunakawa  

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

Improve handling of "UPDATE ... SET (column_list) = row_constructor".

commit   : 906bfcad7ba7cb3863fe0e2a7810be8e3cd84fbd    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 Nov 2016 15:19:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 Nov 2016 15:19:57 -0500    

Click here for diff

Previously, the right-hand side of a multiple-column assignment, if it  
wasn't a sub-SELECT, had to be a simple parenthesized expression list,  
because gram.y was responsible for "bursting" the construct into  
independent column assignments.  This had the minor defect that you  
couldn't write ROW (though you should be able to, since the standard says  
this is a row constructor), and the rather larger defect that unlike other  
uses of row constructors, we would not expand a "foo.*" item into multiple  
columns.  
  
Fix that by changing the RHS to be just "a_expr" in the grammar, leaving  
it to transformMultiAssignRef to separate the elements of a RowExpr;  
which it will do only after performing standard transformation of the  
RowExpr, so that "foo.*" behaves as expected.  
  
The key reason we didn't do that before was the hard-wired handling of  
DEFAULT tokens (SetToDefault nodes).  This patch deals with that issue by  
allowing DEFAULT in any a_expr and having parse analysis throw an error  
if SetToDefault is found in an unexpected place.  That's an improvement  
anyway since the error can be more specific than just "syntax error".  
  
The SQL standard suggests that the RHS could be any a_expr yielding a  
suitable row value.  This patch doesn't really move the goal posts in that  
respect --- you're still limited to RowExpr or a sub-SELECT --- but it does  
fix the grammar restriction, so it provides some tangible progress towards  
a full implementation.  And the limitation is now documented by an explicit  
error message rather than an unhelpful "syntax error".  
  
Discussion: <[email protected]>  

M doc/src/sgml/ref/update.sgml
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_target.c
M src/include/parser/parse_target.h
M src/test/regress/expected/update.out
M src/test/regress/sql/update.sql

Support condition variables.

commit   : e8ac886c24776295dd9b025386a821061da8e4d1    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 22 Nov 2016 14:26:40 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 22 Nov 2016 14:26:40 -0500    

Click here for diff

Condition variables provide a flexible way to sleep until a  
cooperating process causes an arbitrary condition to become true.  In  
simple cases, this can be accomplished with a WaitLatch/ResetLatch  
loop; the cooperating process can call SetLatch after performing work  
that might cause the condition to be satisfied, and the waiting  
process can recheck the condition each time.  However, if the process  
performing the work doesn't have an easy way to identify which  
processes might be waiting, this doesn't work, because it can't  
identify which latches to set.  Condition variables solve that problem  
by internally maintaining a list of waiters; a process that may have  
caused some waiter's condition to be satisfied must "signal" or  
"broadcast" on the condition variable.  
  
Robert Haas and Thomas Munro  

M src/backend/access/transam/xact.c
M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/walsender.c
M src/backend/storage/lmgr/Makefile
A src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/proc.c
A src/include/storage/condition_variable.h
M src/include/storage/proc.h
M src/include/storage/proclist.h

Doc: add a section in Part II concerning RETURNING.

commit   : 1c7861e81b4220364bef75d2445e9c0619f3f3f8    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 Nov 2016 14:02:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 Nov 2016 14:02:52 -0500    

Click here for diff

There are assorted references to RETURNING in Part II, but nothing  
that would qualify as an explanation of the feature, which seems  
like an oversight considering how useful it is.  Add something.  
  
Noted while looking for a place to point a cross-reference to ...  

M doc/src/sgml/dml.sgml
M doc/src/sgml/queries.sgml

Make contrib/test_decoding regression tests safe for CZ locale.

commit   : e2a0ee69006bf31f24958b72c93455412cba035c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2016 20:39:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2016 20:39:28 -0500    

Click here for diff

A little COLLATE "C" goes a long way.  
  
Pavel Stehule, per suggestion from Craig Ringer  
  
Discussion: <CAFj8pRA8nJZcozgxN=RMSqMmKuHVOkcGAAKPKdFeiMWGDSUDLA@mail.gmail.com>  

M contrib/test_decoding/expected/spill.out
M contrib/test_decoding/sql/spill.sql

Fix uninitialized variable.

commit   : ae92a9a3806c025653140ee6316a82d55e24b82c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2016 19:59:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2016 19:59:56 -0500    

Click here for diff

Oversight in a734fd5d1.  
  
Michael Paquier  

M src/backend/postmaster/autovacuum.c

Fix PGLC_localeconv() to handle errors better.

commit   : a4930e7ca2aa49c13ccba089f5fd2c416d87e96a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2016 18:21:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2016 18:21:55 -0500    

Click here for diff

The code was intentionally not very careful about leaking strdup'd  
strings in case of an error.  That was forgivable probably, but it  
also failed to notice strdup() failures, which could lead to subsequent  
null-pointer-dereference crashes, since many callers unsurprisingly  
didn't check for null pointers in the struct lconv fields.  An even  
worse problem is that it could throw error while we were setlocale'd  
to a non-C locale, causing unwanted behavior in subsequent libc calls.  
  
Rewrite to ensure that we cannot throw elog(ERROR) until after we've  
restored the previous locale settings, or at least attempted to.  
(I'm sorely tempted to make restore failure be a FATAL error, but  
will refrain for the moment.)  Having done that, it's not much more  
work to ensure that we clean up strdup'd storage on the way out, too.  
  
This code is substantially the same in all supported branches, so  
back-patch all the way.  
  
Michael Paquier and Tom Lane  
  
Discussion: <CAB7nPqRMbGqa_mesopcn4MPyTs34eqtVEK7ELYxvvV=oqS00YA@mail.gmail.com>  

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

Fix optimization for skipping searches for parallel-query hazards.

commit   : 4324ade9a6880113b08070305482ace2e8a2617c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2016 13:19:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2016 13:19:14 -0500    

Click here for diff

Fix thinko in commit da1c91631: even if the original query was free of  
parallel hazards, we might introduce such a hazard by adding PARAM_EXEC  
Param nodes.  Adjust is_parallel_safe() so that it will scan the given  
expression whenever any such nodes have been created.  Per report from  
Andreas Seltenreich.  
  
Discussion: <[email protected]>  

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

autovacuum: Drop orphan temp tables more quickly but with more caution.

commit   : a734fd5d1c309cc553b7c8c79fba96218af090f7    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 21 Nov 2016 12:54:19 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 21 Nov 2016 12:54:19 -0500    

Click here for diff

Previously, we only dropped an orphan temp table when it became old  
enough to threaten wraparound; instead, doing it immediately.  The  
only value of waiting is that someone might be able to examine the  
contents of the orphan temp table for forensic purposes, but it's  
pretty difficult to actually do that and few users will wish to do so.  
On the flip side, not performing the drop immediately generates log  
spam and bloats pg_class.  
  
In addition, per a report from Grigory Smolkin, if a temporary schema  
contains a very large number of temporary tables, a backend attempting  
to clear the temporary schema might fail due to lock table exhaustion.  
It's helpful for autovacuum to clean up after such cases, and we don't  
want it to wait for wraparound to threaten before doing so.  To  
prevent autovacuum from failing in the same manner as a backend trying  
to drop an entire temp schema, remove orphan temp tables in batches of  
50, committing after each batch, so that we don't accumulate an  
unbounded number of locks.  If a drop fails, retry other orphan tables  
that need to be dropped up to 10 times before giving up.  With this  
system, if a backend does fail to clean a temporary schema due to  
lock table exhaustion, autovacuum should hopefully put things right  
the next time it processes the database.  
  
Discussion: CAB7nPqSbYT6dRwsXVgiKmBdL_ARemfDZMPA+RPeC_ge0GK70hA@mail.gmail.com  
  
Michael Paquier, with a bunch of comment changes by me.  

M src/backend/postmaster/autovacuum.c

Fix test for subplans in force-parallel mode.

commit   : f24cf960d7ae3503e21fcb59dca652575619d9d4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2016 11:09:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2016 11:09:24 -0500    

Click here for diff

We mustn't force parallel mode if the query has any subplans, since  
ExecSerializePlan doesn't transmit them to workers.  Testing  
top_plan->initPlan is inadequate because (1) there might be initPlans  
attached to lower plan nodes, and (2) non-initPlan subplans don't  
work either.  There's certainly room for improvement in those  
restrictions, but for the moment that's what we've got.  
  
Amit Kapila, per report from Andreas Seltenreich  
  
Discussion: <[email protected]>  

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

Prevent multicolumn expansion of "foo.*" in an UPDATE source expression.

commit   : c5f365f3ab21a345b7a109bc0411895536e9fa69    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Nov 2016 14:26:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Nov 2016 14:26:19 -0500    

Click here for diff

Because we use transformTargetList() for UPDATE as well as SELECT  
tlists, the code accidentally tried to expand a "*" reference into  
several columns.  This is nonsensical, because the UPDATE syntax  
provides exactly one target column to put the value into.  The  
immediate result was that transformUpdateTargetList() got confused  
and reported "UPDATE target count mismatch --- internal error".  
It seems better to treat such a reference as a plain whole-row  
variable, as it would be in other contexts.  (This could produce  
useful results when the target column is of composite type.)  
  
Fix by tweaking transformTargetList() to perform *-expansion only  
conditionally, depending on its exprKind parameter.  
  
Back-patch to 9.3.  The problem exists further back, but a fix would be  
much more invasive before that, because transformTargetList() wasn't  
told what kind of list it was working on.  Doesn't seem worth the  
trouble given the lack of field reports.  (I only noticed it because  
I was checking the code while trying to improve the documentation about  
how we handle "foo.*".)  
  
Discussion: <[email protected]>  

M src/backend/parser/parse_target.c
M src/test/regress/expected/update.out
M src/test/regress/sql/update.sql

Fix latent costing error in create_merge_append_path.

commit   : 0832f2db68cc43524a240db47d0428cc9525723e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Nov 2016 15:06:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Nov 2016 15:06:45 -0500    

Click here for diff

create_merge_append_path should use the path rowcount it just computed,  
not rel->tuples, for costing purposes.  Those numbers should always be  
the same at present, but if we ever support parameterized MergeAppend  
paths (a case this function is otherwise prepared for), the former would  
be right and the latter wrong.  
  
No need for back-patch since the problem is only latent.  
  
Ashutosh Bapat  
  
Discussion: <CAFjFpRek+cLCnTo24youuGtsq4zRphEB8EUUPjDxZjnL4n4HYQ@mail.gmail.com>  

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

Code review for GUC serialization/deserialization code.

commit   : 13671b4b22ae4bd345c62e7c0b41d717b8a2e19b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Nov 2016 14:26:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Nov 2016 14:26:19 -0500    

Click here for diff

The serialization code dumped core for a string-valued GUC whose value  
is NULL, which is a legal state.  The infrastructure isn't capable of  
transmitting that state exactly, but fortunately, transmitting an empty  
string instead should be close enough (compare, eg, commit e45e990e4).  
  
The code potentially underestimated the space required to format a  
real-valued variable, both because it made an unwarranted assumption that  
%g output would never be longer than %e output, and because it didn't count  
right even for %e format.  In practice this would pretty much always be  
masked by overestimates for other variables, but it's still wrong.  
  
Also fix boundary-case error in read_gucstate, incorrect handling of the  
case where guc_sourcefile is non-NULL but zero length (not clear that can  
happen, but if it did, this code would get totally confused), and  
confusingly useless check for a NULL result from read_gucstate.  
  
Andreas Seltenreich discovered the core dump; other issues noted while  
reading nearby code.  Back-patch to 9.5 where this code was introduced.  
  
Michael Paquier and Tom Lane  
  
Discussion: <[email protected]>  

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

Add pg_sequences view

commit   : 67dc4ccbb2e1c27da823eced66d9217a5652cbb0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 18 Nov 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 18 Nov 2016 12:00:00 -0500    

Click here for diff

Like pg_tables, pg_views, and others, this view contains information  
about sequences in a way that is independent of the system catalog  
layout but more comprehensive than the information schema.  
  
To help implement the view, add a new internal function  
pg_sequence_last_value() to return the last value of a sequence.  This  
is kept separate from pg_sequence_parameters() to separate querying  
run-time state from catalog-like information.  
  
Reviewed-by: Andreas Karlsson <[email protected]>  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/system_views.sql
M src/backend/commands/sequence.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/commands/sequence.h
M src/test/regress/expected/rules.out
M src/test/regress/expected/sequence.out
M src/test/regress/expected/sequence_1.out
M src/test/regress/sql/sequence.sql

Clean up pg_dump tests, re-enable BLOB testing

commit   : 8f91f323b4feef0371cd3db51be3007e44abd5e8    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 18 Nov 2016 14:21:33 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 18 Nov 2016 14:21:33 -0500    

Click here for diff

Add a loop to check that each test covers all of the pg_dump runs.  We  
(I) had been a bit sloppy when adding new runs and not making sure to  
mark if they should be under like or unlike for each test, this loop  
makes sure that the test system will complain if any are forgotten in  
the future.  
  
The loop also correctly handles the 'catch all' cases, which are used to  
avoid running unnecessary specific checks when a single catch-all can be  
done (eg: a no-acl run should not have any GRANT commands).  
  
Also, re-enable the testing of blobs, but use lo_from_bytea() instead of  
trying to be cute and writing out to a file and then reading it back in  
with psql, which proved to be difficult for some buildfarm members.  
This allows us to add support for testing the --no-blobs option which  
will be getting added shortly, provided the buildfarm doesn't blow up on  
this.  

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

Remove or reduce verbosity of some debug messages.

commit   : a43f1939d5dcd02f4df1604a68392332168e4be0    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 17 Nov 2016 16:54:24 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 17 Nov 2016 16:54:24 -0500    

Click here for diff

The debug messages that merely print StartTransactionCommand,  
CommitTransactionCommand, ProcessUtilty, or ProcessQuery with no  
additional details seem to be useless.  Get rid of them.  
  
The transaction status messages produced by ShowTransactionState are  
occasionally useful, but they are extremely verbose, producing  
multiple lines of log output every time they fire, which can happens  
multiple times per transaction.  So, reduce the level to DEBUG5; avoid  
emitting an extra line just to explain which debug point is at issue;  
and tighten up the rest of the message so it doesn't use quite so much  
horizontal space.  
  
With these changes, it's possible to run a somewhat busy system with a  
log level even as high as DEBUG4, whereas previously anything above  
DEBUG2 would flood the log with output that probably wasn't really all  
that useful.  

M src/backend/access/transam/xact.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c

Fix pg_dump's handling of circular dependencies in views.

commit   : d8c05aff56be92dda889abc89e3f3921d1c29c30    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Nov 2016 15:25:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Nov 2016 15:25:59 -0500    

Click here for diff

pg_dump's traditional solution for breaking a circular dependency involving  
a view was to create the view with CREATE TABLE and then later issue CREATE  
RULE "_RETURN" ... to convert the table to a view, relying on the backend's  
very very ancient code that supports making views that way.  We've wanted  
to get rid of that kluge for a long time, but the thing that finally  
motivates doing something about it is the recognition that this method  
fails with the --clean option, because it leads to issuing DROP RULE  
"_RETURN" followed by DROP TABLE --- and the backend won't let you drop a  
view's _RETURN rule.  
  
Instead, let's break circular dependencies by initially creating the view  
using CREATE VIEW AS SELECT NULL::columntype AS columnname, ... (so that  
it has the right column names and types to support external references,  
but no dependencies beyond the column data types), and then later dumping  
the ON SELECT rule using the spelling CREATE OR REPLACE VIEW.  This method  
wasn't available when this code was originally written, but it's been  
possible since PG 7.3, so it seems fine to start relying on it now.  
  
To solve the --clean problem, make the dropStmt for an ON SELECT rule  
be CREATE OR REPLACE VIEW with the same dummy target list as above.  
In this way, during the DROP phase, we first reduce the view to have  
no extra dependencies, and then we can drop it entirely when we've  
gotten rid of whatever had a circular dependency on it.  
  
(Note: this should work adequately well with the --if-exists option, since  
the CREATE OR REPLACE VIEW will go through whether the view exists or not.  
It could fail if the view exists with a conflicting column set, but we  
don't really support --clean against a non-matching database anyway.)  
  
This allows cleaning up some other kluges inside pg_dump, notably that  
we don't need a notion of reloptions attached to a rule anymore.  
  
Although this is a bug fix, commit to HEAD only for now.  The problem's  
existed for a long time and we've had relatively few complaints, so it  
doesn't really seem worth taking risks to fix it in the back branches.  
We might revisit that choice if no problems emerge.  
  
Discussion: <[email protected]>  

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

Improve pg_dump/pg_restore --create --if-exists logic.

commit   : ac888986fc656c0badb0a4918b3581e2ebcb154a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Nov 2016 14:59:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Nov 2016 14:59:13 -0500    

Click here for diff

Teach it not to complain if the dropStmt attached to an archive entry  
is actually spelled CREATE OR REPLACE VIEW, since that will happen due to  
an upcoming bug fix.  Also, if it doesn't recognize a dropStmt, have it  
print a WARNING and then emit the dropStmt unmodified.  That seems like a  
much saner behavior than Assert'ing or dumping core due to a null-pointer  
dereference, which is what would happen before :-(.  
  
Back-patch to 9.4 where this option was introduced.  
  
Discussion: <[email protected]>  

M src/bin/pg_dump/pg_backup_archiver.c

Re-pgindent src/bin/pg_dump/*

commit   : fcf70e0dbca1432959be5f3557acd546d639c9ba    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Nov 2016 14:36:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Nov 2016 14:36:59 -0500    

Click here for diff

Cleanup for recent patches --- it's not much change, but I got annoyed  
while re-indenting the view-rule fix I'm working on.  

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

Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases

commit   : f65b94f63962e9f7e144a469bc1750286ddaee27    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 17 Nov 2016 13:31:30 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 17 Nov 2016 13:31:30 -0300    

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.  
  
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.  
  
This is a back-patch of commits 687f2cd7a015, 3e4b7d87988f, b60284261375  
by Simon Riggs, to branches 9.4 and 9.5.  No further backpatch is  
possible because this depends on catalog scans being MVCC.  I (Ɓlvaro)  
additionally updated a slight problem in the README, which explains why  
this touches the 9.6 and master branches.  

M src/backend/access/nbtree/README

doc: Further XSLT HTML build performance optimization

commit   : 380895f2deb18ed9e7a8be69961af2ed221ba9d3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Nov 2016 12:00:00 -0800    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Nov 2016 12:00:00 -0800    

Click here for diff

Cut out some expensive stuff from the HTML head element that we don't  
really need.  
  
This was previously discussed as part of  
e8306745e3504c642f7abad411139d5630e29fac, but ended up separate because  
it changes the output contents slightly.  

M doc/src/sgml/stylesheet-speedup-xhtml.xsl

Build HTML documentation using XSLT stylesheets by default

commit   : e36ddab11735052841b4eff96642187ec9a8a7bc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 8 Nov 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 8 Nov 2016 12:00:00 -0500    

Click here for diff

The old DSSSL build is still available for a while using the make target  
"oldhtml".  

M doc/src/sgml/Makefile
M doc/src/sgml/stylesheet.css

Check that result tupdesc has exactly 1 column in return_next scalar case.

commit   : 4ecd1974377ffb4d6d72874ba14fcd23965b1792    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Nov 2016 16:48:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Nov 2016 16:48:12 -0500    

Click here for diff

This should always be true, but since we're relying on a tuple descriptor  
passed from outside pltcl itself, let's check.  Per a gripe from Coverity.  

M src/pl/tcl/pltcl.c

Reserve zero as an invalid DSM handle.

commit   : b40b4dd9e10ea701c8d47ccba9407fc32ed384e5    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Nov 2016 16:30:35 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Nov 2016 16:30:35 -0500    

Click here for diff

Previously, the handle for the control segment could not be zero, but  
some other DSM segment could potentially have a handle value of zero.  
However, that means that if someone wanted to store a dsm_handle that  
might or might not be valid, they would need a separate boolean to  
keep track of whether the associated value is legal.  That's annoying,  
so change things so that no DSM segment can ever have a handle of 0 -  
or as we call it here, DSM_HANDLE_INVALID.  
  
Thomas Munro.  This was submitted as part of a much larger patch to  
add an malloc-like allocator for dynamic shared memory, but this part  
seems like a good idea independently of the rest of the patch.  

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

Allow DOS-style line endings in ~/.pgpass files.

commit   : 0a7481930c788e9d74a154aac0c8b401fc6a81f9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Nov 2016 16:17:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Nov 2016 16:17:19 -0500    

Click here for diff

On Windows, libc will mask \r\n line endings for us, since we read the  
password file in text mode.  But that doesn't happen on Unix.  People  
who share password files across both systems might have \r\n line endings  
in a file they use on Unix, so as a convenience, ignore trailing \r.  
Per gripe from Josh Berkus.  
  
In passing, put the existing check for empty line somewhere where it's  
actually useful, ie after stripping the newline not before.  
  
Vik Fearing, adjusted a bit by me  
  
Discussion: <[email protected]>  

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

Account for catalog snapshot in PGXACT->xmin updates.

commit   : ffaa44cb559db332baeee7d25dedd74a61974203    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Nov 2016 15:55:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Nov 2016 15:55:35 -0500    

Click here for diff

The CatalogSnapshot was not plugged into SnapshotResetXmin()'s accounting  
for whether MyPgXact->xmin could be cleared or advanced.  In normal  
transactions this was masked by the fact that the transaction snapshot  
would be older, but during backend startup and certain utility commands  
it was possible to re-use the CatalogSnapshot after MyPgXact->xmin had  
been cleared, meaning that recently-deleted rows could be pruned even  
though this snapshot could still see them, causing unexpected catalog  
lookup failures.  This effect appears to be the explanation for a recent  
failure on buildfarm member piculet.  
  
To fix, add the CatalogSnapshot to the RegisteredSnapshots heap whenever  
it is valid.  
  
In the previous logic, it was possible for the CatalogSnapshot to remain  
valid across waits for client input, but with this change that would mean  
it delays advance of global xmin in cases where it did not before.  To  
avoid possibly causing new table-bloat problems with clients that sit idle  
for long intervals, add code to invalidate the CatalogSnapshot before  
waiting for client input.  (When the backend is busy, it's unlikely that  
the CatalogSnapshot would be the oldest snap for very long, so we don't  
worry about forcing early invalidation of it otherwise.)  
  
In passing, remove the CatalogSnapshotStale flag in favor of using  
"CatalogSnapshot != NULL" to represent validity, as we do for the other  
special snapshots in snapmgr.c.  And improve some obsolete comments.  
  
No regression test because I don't know a deterministic way to cause this  
failure.  But the stress test shown in the original discussion provokes  
"cache lookup failed for relation 1255" within a few dozen seconds for me.  
  
Back-patch to 9.4 where MVCC catalog scans were introduced.  (Note: it's  
quite easy to produce similar failures with the same test case in branches  
before 9.4.  But MVCC catalog scans were supposed to fix that.)  
  
Discussion: <[email protected]>  

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

Limit the number of number of tapes used for a sort to 501.

commit   : fc19c1801bd2dbee1043b0c0b62e07747d30ea1c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Nov 2016 10:28:46 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Nov 2016 10:28:46 -0500    

Click here for diff

Gigantic numbers of tapes don't work out well.  
  
Original patch by Peter Geoghegan; comments entirely rewritten by me.  

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

Fix broken statement in UCS_to_most.pl.

commit   : 00c6d8077f39191a6f61a847ce7d55073d8f5a6f    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Nov 2016 09:41:53 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Nov 2016 09:41:53 -0500    

Click here for diff

This has been wrong for a very long time, and it's puzzling to me how  
it ever worked for anyone.  
  
Kyotaro Horiguchi  

M src/backend/utils/mb/Unicode/UCS_to_most.pl

pgbench: Increase maximum size of log filename from 64 to MAXPGPATH.

commit   : 56eba9b8a1120c861868dd3d86d927a9e3182880    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Nov 2016 09:11:51 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Nov 2016 09:11:51 -0500    

Click here for diff

Commit 41124a91e61fc6d9681c1e8b15ba30494e84d643 allowed the  
transaction log file prefix to be changed but left in place the  
existing 64-character limit on the total length of a log file name.  
It's possible that could be inconvenient for somebody, so increase the  
limit to MAXPGPATH, which ought to be enough for anybody.  
  
Per a suggestion from Tom Lane.  

M src/bin/pgbench/pgbench.c

Provide NO_INSTALLCHECK option for pgxs.

commit   : ffa8c3d8521bbd7c6da497264f1a12572a1ff713    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 14 Nov 2016 14:53:07 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 14 Nov 2016 14:53:07 -0800    

Click here for diff

This allows us to avoid running the regression tests in contrib modules  
like pg_stat_statement in a less ugly manner.  
  
Discussion: <[email protected]>  

M contrib/pg_stat_statements/Makefile
M doc/src/sgml/extend.sgml
M src/makefiles/pgxs.mk

Fix typo in comment

commit   : c99f876e9a1e2a9a04d02a8aaf046cd9125e9264    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 14 Nov 2016 17:31:35 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 14 Nov 2016 17:31:35 +0100    

Click here for diff

The function was renamed in 908e23473, but the comment never learned  
about it.  

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

Allow individual TAP tests to be run via PROVE_TESTS

commit   : 9ca7b0bf016364c74d38f66c7050be915bfea908    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 14 Nov 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 14 Nov 2016 12:00:00 -0500    

Click here for diff

Add a new optional Makefile variable PROVE_TESTS that, if passed as a  
space-separated list of paths relative to the Makefile invoking  
$(prove_check) or $(prove_installcheck), runs just those tests instead  
of t/*.pl .  
  
From: Craig Ringer <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M src/Makefile.global.in
M src/test/perl/README

Fix duplication in ALTER MATERIALIZE VIEW synopsis

commit   : 8ce4f597abc530b3b59bcf3a3964f31e50054bcd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 14 Nov 2016 11:14:34 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 14 Nov 2016 11:14:34 -0300    

Click here for diff

Commit 3c4cf080879b should have removed SET TABLESPACE from the synopsis  
of ALTER MATERIALIZE VIEW as a possible "action" when it added a  
separate line for it in the main command listing, but failed to.  
Repair.  
  
Backpatch to 9.4, like the aforementioned commit.  

M doc/src/sgml/ref/alter_materialized_view.sgml

pg_upgrade: Upgrade sequence data via pg_dump

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

Click here for diff

Previously, pg_upgrade migrated sequence data like tables by copying the  
on-disk file.  This does not allow any changes in the on-disk format for  
sequences.  It's simpler to just have pg_dump set the new sequence  
values as it normally does.  To do that, create a hidden submode in  
pg_dump that dumps sequence data even when a schema-only dump is  
requested, and trigger that submode in binary upgrade mode.  (This new  
submode could easily be exposed as a command-line option, but it has  
limited use outside of pg_dump and would probably cause some confusion,  
so we don't do that at this time.)  
  
Reviewed-by: Anastasia Lubennikova <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/info.c

pg_dump: Separate table and sequence data object types

commit   : 27d2c1232879aab5636da56b698764d553b9c5c6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Aug 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Aug 2016 12:00:00 -0400    

Click here for diff

Instead of handling both sequence data and table data internally as  
"table data", handle sequences separately under a "sequence set" type.  
We already handled materialized view data differently, so it makes the  
code somewhat cleaner to handle each relation kind separately at the top  
level.  
  
This does not change the output format, since there already was a  
separate "SEQUENCE SET" archive entry type.  A noticeable difference is  
that SEQUENCE SET entries now always appear after TABLE DATA entries.  
And in parallel mode there is less sorting to do, because the sequence  
data entries are no longer considered table data.  
  
Reviewed-by: Anastasia Lubennikova <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

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

Doc: remove obsolete example.

commit   : d5d8a0b7e54ca09d0b5fdfc6afcb307450f33215    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Nov 2016 13:12:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Nov 2016 13:12:35 -0500    

Click here for diff

The documentation for ts_headline() recommends using a sub-select to  
avoid extra evaluations of ts_headline() in a query with ORDER BY+LIMIT.  
Since commit 9118d03a8 this contortionism is unnecessary, so remove the  
recommendation.  Noted by Oleg Bartunov.  
  
Discussion: <CAF4Au4w6rrH_j1bvVhzpOsRiHCog7sGJ3LSX0tY8ZdwhHT88LQ@mail.gmail.com>  

M doc/src/sgml/textsearch.sgml

pg_stat_statements: Add .gitignore file for tests

commit   : b7292a8670289d3c026932404dee194648661e35    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 13 Nov 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 13 Nov 2016 12:00:00 -0500    

Click here for diff

A contrib/pg_stat_statements/.gitignore

Add minimal set of regression tests for pg_stat_statements.

commit   : 9be244dbe876038676e92e34d0f9fe55914376d2    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 12 Nov 2016 05:01:48 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 12 Nov 2016 05:01:48 -0800    

Click here for diff

While the set of covered functionality is fairly small, the added tests  
still are useful to get some basic buildfarm testing of  
pg_stat_statements itself, but also to exercise the lwlock tranch code  
on the buildfarm.  
  
Author: Amit Kapila, slightly editorialized by me  
Reviewed-By: Ashutosh Sharma, Andres Freund  
Discussion: <CAA4eK1JOjkdXYtHxh=2aDK4VgDtN-LNGKY_YqX0N=YEvuzQVWg@mail.gmail.com>  

M contrib/pg_stat_statements/Makefile
A contrib/pg_stat_statements/expected/pg_stat_statements.out
A contrib/pg_stat_statements/pg_stat_statements.conf
A contrib/pg_stat_statements/sql/pg_stat_statements.sql

Doc: fix data types of FuncCallContext's call_cntr and max_calls fields.

commit   : 1c1475577623019ff887825b9a804f78ec806344    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Nov 2016 12:03:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Nov 2016 12:03:49 -0500    

Click here for diff

Commit 23a27b039 widened these from uint32 to uint64, but I overlooked  
that the documentation explicitly showed them as uint32.  Per report  
from Vicky Vergara.  
  
Report: <[email protected]>  

M doc/src/sgml/xfunc.sgml

Cleanup of rewriter and planner handling of Query.hasRowSecurity flag.

commit   : 24aef33804be5d7d71bc3932ced3407fce71e354    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2016 16:16:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2016 16:16:33 -0500    

Click here for diff

Be sure to pull up the subquery's hasRowSecurity flag when flattening a  
subquery in pull_up_simple_subquery().  This isn't a bug today because  
we don't look at the hasRowSecurity flag during planning, but it could  
easily be a bug tomorrow.  
  
Likewise, make rewriteRuleAction() pull up the hasRowSecurity flag when  
absorbing RTEs from a rule action.  This isn't a bug either, for the  
opposite reason: the flag should never be set yet.  But again, it seems  
like good future proofing.  
  
Add a comment explaining why rewriteTargetView() should *not* set  
hasRowSecurity when adding stuff to securityQuals.  
  
Improve some nearby comments about securityQuals processing, and document  
that field more completely in parsenodes.h.  
  
Patch by me, analysis by Dean Rasheed.  
  
Discussion: <CAEZATCXZ8tb2DV6f=bkhsMV6u_gRcZ0CZBw2J-qU84RxSukZog@mail.gmail.com>  

M src/backend/optimizer/prep/prepjointree.c
M src/backend/rewrite/rewriteHandler.c
M src/include/nodes/parsenodes.h

Re-allow user_catalog_table option for materialized views.

commit   : 530f8065243b185e56c70ab317a9b40964b4ad00    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2016 15:00:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2016 15:00:58 -0500    

Click here for diff

The reloptions stuff allows this option to be set on a matview.  
While it's questionable whether that is useful or was really intended,  
it does work, and we shouldn't change that in minor releases.  Commit  
e3e66d8a9 disabled the option since I didn't realize that it was  
possible for it to be set on a matview.  Tweak the test to re-allow it.  
  
Discussion: <[email protected]>  

M src/include/utils/rel.h

Support "COPY view FROM" for views with INSTEAD OF INSERT triggers.

commit   : 279c439c7fbc1bcb52173d92dd3b1fbe63e497ab    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2016 14:13:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2016 14:13:43 -0500    

Click here for diff

We just pass the data to the INSTEAD trigger.  
  
Haribabu Kommi, reviewed by Dilip Kumar  
  
Patch: <CAJrrPGcSQkrNkO+4PhLm4B8UQQQmU9YVUuqmtgM=pmzMfxWaWQ@mail.gmail.com>  

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

Fix partial aggregation for the case of a degenerate GROUP BY clause.

commit   : e1b449bea909fa70211841d508cfaf91d18a6abb    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2016 11:31:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2016 11:31:56 -0500    

Click here for diff

The plan generated for sorted partial aggregation with "GROUP BY constant"  
included a Sort node with no sort keys, which the executor does not like.  
  
Per report from Steve Randall.  I'd add a regression test case if I could  
think of a compact one, but it doesn't seem worth expending lots of cycles  
on.  
  
Report: <CABVd52UAdGXpg_rCk46egpNKYdXOzCjuJ1zG26E2xBe_8bj+Fg@mail.gmail.com>  

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

Doc: improve link.

commit   : 0b1b5033ac19236a4a23eed9232d74936717020e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2016 10:37:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2016 10:37:14 -0500    

Click here for diff

Discussion: <[email protected]>  

M doc/src/sgml/storage.sgml

pgbench: Allow the transaction log file prefix to be changed.

commit   : 41124a91e61fc6d9681c1e8b15ba30494e84d643    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 9 Nov 2016 16:26:32 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 9 Nov 2016 16:26:32 -0500    

Click here for diff

Masahiko Sawada, reviewed by Fabien Coelho and Beena Emerson, with  
some a bit of wordsmithing and cosmetic adjustment by me.  

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

doc: Improve whitespace use in XSL

commit   : 3887ba6dbb08f50c0ee6639a80e68ef697222457    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 9 Nov 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 9 Nov 2016 12:00:00 -0500    

Click here for diff

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

Simplify code by getting rid of SPI_push, SPI_pop, SPI_restore_connection.

commit   : 1833f1a1c3b0e12b3ea40d49bf11898eedae5248    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Nov 2016 17:39:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Nov 2016 17:39:45 -0500    

Click here for diff

The idea behind SPI_push was to allow transitioning back into an  
"unconnected" state when a SPI-using procedure calls unrelated code that  
might or might not invoke SPI.  That sounds good, but in practice the only  
thing it does for us is to catch cases where a called SPI-using function  
forgets to call SPI_connect --- which is a highly improbable failure mode,  
since it would be exposed immediately by direct testing of said function.  
As against that, we've had multiple bugs induced by forgetting to call  
SPI_push/SPI_pop around code that might invoke SPI-using functions; these  
are much harder to catch and indeed have gone undetected for years in some  
cases.  And we've had to band-aid around some problems of this ilk by  
introducing conditional push/pop pairs in some places, which really kind  
of defeats the purpose altogether; if we can't draw bright lines between  
connected and unconnected code, what's the point?  
  
Hence, get rid of SPI_push[_conditional], SPI_pop[_conditional], and the  
underlying state variable _SPI_curid.  It turns out SPI_restore_connection  
can go away too, which is a nice side benefit since it was never more than  
a kluge.  Provide no-op macros for the deleted functions so as to avoid an  
API break for external modules.  
  
A side effect of this removal is that SPI_palloc and allied functions no  
longer permit being called when unconnected; they'll throw an error  
instead.  The apparent usefulness of the previous behavior was a mirage  
as well, because it was depended on by only a few places (which I fixed in  
preceding commits), and it posed a risk of allocations being unexpectedly  
long-lived if someone forgot a SPI_push call.  
  
Discussion: <[email protected]>  

M doc/src/sgml/spi.sgml
M src/backend/executor/spi.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/fmgr/fmgr.c
M src/include/executor/spi.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_subxactobject.c
M src/pl/tcl/pltcl.c

psql: Tab completion for renaming enum values.

commit   : 577f0bdd2b8904cbdfde6c98f4bda6fd93a05ffc    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Nov 2016 16:27:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Nov 2016 16:27:09 -0500    

Click here for diff

For ALTER TYPE .. RENAME, add "VALUE" to the list of possible  
completions.  Complete ALTER TYPE .. RENAME VALUE with possible  
enum values.  After that, complete with "TO".  
  
Dagfinn Ilmari MannsƄker, reviewed by Artur Zakirov.  

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

Replace uses of SPI_modifytuple that intend to allocate in current context.

commit   : 9257f0787257022e31c61cd77449127adfccf37f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Nov 2016 15:36:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Nov 2016 15:36:36 -0500    

Click here for diff

Invent a new function heap_modify_tuple_by_cols() that is functionally  
equivalent to SPI_modifytuple except that it always allocates its result  
by simple palloc.  I chose however to make the API details a bit more  
like heap_modify_tuple: pass a tupdesc rather than a Relation, and use  
bool convention for the isnull array.  
  
Use this function in place of SPI_modifytuple at all call sites where the  
intended behavior is to allocate in current context.  (There actually are  
only two call sites left that depend on the old behavior, which makes me  
wonder if we should just drop this function rather than keep it.)  
  
This new function is easier to use than heap_modify_tuple() for purposes  
of replacing a single column (or, really, any fixed number of columns).  
There are a number of places where it would simplify the code to change  
over, but I resisted that temptation for the moment ... everywhere except  
in plpgsql's exec_assign_value(); changing that might offer some small  
performance benefit, so I did it.  
  
This is on the way to removing SPI_push/SPI_pop, but it seems like  
good code cleanup in its own right.  
  
Discussion: <[email protected]>  

M contrib/spi/autoinc.c
M contrib/spi/insert_username.c
M contrib/spi/moddatetime.c
M contrib/spi/timetravel.c
M doc/src/sgml/spi.sgml
M src/backend/access/common/heaptuple.c
M src/backend/utils/adt/tsvector_op.c
M src/include/access/htup_details.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/regress.c

Fix typo.

commit   : dce429b117be027f059bb9df5c76eb5eadcc456d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Nov 2016 15:33:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Nov 2016 15:33:57 -0500    

Click here for diff

Michael Paquier  

M src/backend/commands/event_trigger.c

Make SPI_fnumber() reject dropped columns.

commit   : 6d30fb1f75a57d80f80e27770d39d88f8aa32d28    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Nov 2016 13:11:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Nov 2016 13:11:15 -0500    

Click here for diff

There's basically no scenario where it's sensible for this to match  
dropped columns, so put a test for dropped-ness into SPI_fnumber()  
itself, and excise the test from the small number of callers that  
were paying attention to the case.  (Most weren't :-(.)  
  
In passing, normalize tests at call sites: always reject attnum <= 0  
if we're disallowing system columns.  Previously there was a mixture  
of "< 0" and "<= 0" tests.  This makes no practical difference since  
SPI_fnumber() never returns 0, but I'm feeling pedantic today.  
  
Also, in the places that are actually live user-facing code and not  
legacy cruft, distinguish "column not found" from "can't handle  
system column".  
  
Per discussion with Jim Nasby; thi supersedes his original patch  
that just changed the behavior at one call site.  
  
Discussion: <[email protected]>  

M contrib/spi/autoinc.c
M contrib/spi/insert_username.c
M contrib/spi/moddatetime.c
M contrib/spi/refint.c
M contrib/spi/timetravel.c
M doc/src/sgml/spi.sgml
M src/backend/executor/spi.c
M src/backend/utils/adt/tsvector_op.c
M src/pl/plperl/plperl.c
M src/pl/tcl/pltcl.c
M src/test/regress/regress.c

Fix typo

commit   : 36ac6d0e793087153a452df6502d0ef32a780db6    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 8 Nov 2016 18:34:59 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 8 Nov 2016 18:34:59 +0100    

Click here for diff

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

Fix mistake in XLOG_SEG_SIZE test.

commit   : 60379f66c8527a260bb1946f703540728d73932d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Nov 2016 12:09:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Nov 2016 12:09:18 -0500    

Click here for diff

The intent of the test is to check whether XLOG_SEG_SIZE is in a  
particular range, but actually in one case it compares XLOG_BLCKSZ  
by mistake.  Repair.  
  
Commit 88e982302684246e8af785e78a467ac37c76dee9 introduced this  
faulty test.  
  
Kuntal Ghosh, reviewed by Michael Paquier.  

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

Use heap_modify_tuple not SPI_modifytuple in pl/python triggers.

commit   : de4026c673f195cfdb7aa7cc87cc60e36963f094    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Nov 2016 12:00:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Nov 2016 12:00:24 -0500    

Click here for diff

The code here would need some change anyway given planned change in  
SPI_modifytuple semantics, since this executes after we've exited the  
SPI environment.  But really it's better to just use heap_modify_tuple.  
  
While at it, normalize use of SPI_fnumber: make error messages distinguish  
no-such-column from can't-set-system-column, and remove test for deleted  
column which is going to migrate into SPI_fnumber.  The lack of a check  
for system column names is actually a pre-existing bug here, and might  
even qualify as a security bug except that we don't have any trusted  
version of plpython.  

M src/pl/plpython/plpy_exec.c

Use heap_modify_tuple not SPI_modifytuple in pl/perl triggers.

commit   : 0d4446083df56a36ecec8e8bd321a45ecac7e7c6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Nov 2016 11:35:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Nov 2016 11:35:01 -0500    

Click here for diff

The code here would need some change anyway given planned change in  
SPI_modifytuple semantics, since this executes after we've exited the  
SPI environment.  But really it's better to just use heap_modify_tuple.  
The code's actually shorter this way, and this avoids depending on some  
rather indirect reasoning about why the temporary arrays can't be overrun.  
(I think the old code is safe, as long as Perl hashes can't contain  
duplicate keys; but with this way we don't need that assumption, only  
the assumption that SPI_fnumber doesn't return an out-of-range attnum.)  
  
While at it, normalize use of SPI_fnumber: make error messages distinguish  
no-such-column from can't-set-system-column, and remove test for deleted  
column which is going to migrate into SPI_fnumber.  

M src/pl/plperl/plperl.c

Improve handling of dead tuples in hash indexes.

commit   : f0e72a25b05d4c29d0102fa0b892782ff193a00e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Nov 2016 10:47:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Nov 2016 10:47:52 -0500    

Click here for diff

When squeezing a bucket during vacuum, it's not necessary to retain  
any tuples already marked as dead, so ignore them when deciding which  
tuples must be moved in order to empty a bucket page.  Similarly, when  
splitting a bucket, relocating dead tuples to the new bucket is a  
waste of effort; instead, just ignore them.  
  
Amit Kapila, reviewed by me.  Testing help provided by Ashutosh  
Sharma.  

M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c

Change qr/foo$/m to qr/foo\n/m, for Perl 5.8.8.

commit   : 650b96707672599e290c982dd63e3a896dbbaba6    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 7 Nov 2016 20:27:30 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 7 Nov 2016 20:27:30 -0500    

Click here for diff

In each case, absence of a trailing newline would itself constitute a  
PostgreSQL bug.  Therefore, this slightly enhances the changed tests.  
This works around a bug that last appeared in Perl 5.8.8, fixing  
src/test/modules/test_pg_dump when run against that version.  Commit  
e7293e3271bf618eeb2d4779a15fc516a69fe463 worked around the bug, but the  
subsequent addition of test_pg_dump introduced affected code.  As that  
commit had shown, slight increases in pattern complexity can suppress  
the bug.  This commit edits qr/foo$/m patterns too complex to encounter  
the bug today, for style consistency and robustness against unrelated  
pattern changes.  Back-patch to 9.6, where test_pg_dump was introduced.  
  
As of this writing, a fresh MSYS installation includes an affected Perl  
5.8.8.  The Perl 5.8.8 in Red Hat Enterprise Linux 5.11 carries a patch  
that renders it unaffected, but the Perl 5.8.5 of Red Hat Enterprise  
Linux 4.4 is affected.  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/README
M src/tools/msvc/Project.pm

Band-aid fix for incorrect use of view options as StdRdOptions.

commit   : e3e66d8a9813d22c2aa027d8f373a96d4d4c1b15    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Nov 2016 12:08:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Nov 2016 12:08:18 -0500    

Click here for diff

We really ought to make StdRdOptions and the other decoded forms of  
reloptions self-identifying, but for the moment, assume that only plain  
relations could possibly be user_catalog_tables.  Fixes problem with bogus  
"ON CONFLICT is not supported on table ... used as a catalog table" error  
when target is a view with cascade option.  
  
Discussion: <[email protected]>  

M src/include/utils/rel.h
M src/test/regress/expected/insert_conflict.out
M src/test/regress/sql/insert_conflict.sql

Revert "Delete contrib/xml2's legacy implementation of xml_is_well_formed()."

commit   : c59f94e81e56fe24428952f116f3c9555f42cc4f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Nov 2016 10:27:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Nov 2016 10:27:52 -0500    

Click here for diff

This partly reverts commit 20540710e83f2873707c284a0c0693f0b57156c4.  
Since we've given up on adding PGDLLEXPORT markers to PG_FUNCTION_INFO_V1,  
there's no need to remove the legacy compatibility function.  I kept the  
documentation changes, though, as they seem appropriate anyway.  

M contrib/xml2/xpath.c

Revert "Provide DLLEXPORT markers for C functions via PG_FUNCTION_INFO_V1 macro."

commit   : 33cb96ba1a84c612491fb5794674a649d1a6a4d6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Nov 2016 10:19:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Nov 2016 10:19:22 -0500    

Click here for diff

This reverts commit c8ead2a3974d3eada145a0e18940150039493cc9.  
Seems there is no way to do this that doesn't cause MSVC to give  
warnings, so let's just go back to the way we've been doing it.  
  
Discussion: <[email protected]>  

M contrib/hstore/hstore.h
M contrib/ltree/ltree.h
M doc/src/sgml/xfunc.sgml
M src/include/fmgr.h

pg_upgrade: Add NLS

commit   : 77517ba59f8d3a9d282c5e826bf19cbe195cd784    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Oct 2016 12:00:00 -0400    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  

M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
A src/bin/pg_upgrade/nls.mk
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/util.c

pg_rewing pg_upgrade: Fix translation markers

commit   : 48dbcbf22c69bd994ea5e3bf7be9a23b0606d80d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Nov 2016 12:00:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Nov 2016 12:00:00 -0500    

Click here for diff

In pg_log_v(), we need to translate the fmt before processing, not the  
formatted message afterwards.  

M src/bin/pg_rewind/logging.c
M src/bin/pg_upgrade/util.c

Save redundant code for pseudotype I/O functions

commit   : a5954de1051a779f1460426ab88d142f8790f18d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 27 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 27 Oct 2016 12:00:00 -0400    

Click here for diff

Use a macro to generate the in and out functions for pseudotypes that  
reject all input and output, saving many lines of redundant code.  
Parameterize the error messages to reduce translatable strings.  

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

Sync pltcl_build_tuple_result's error handling with pltcl_trigger_handler.

commit   : 7f1bcfb93df90adcf3c7230234fc123096e2a639    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Nov 2016 19:22:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Nov 2016 19:22:12 -0500    

Click here for diff

Meant to do this in 26abb50c4, but forgot.  

M src/pl/tcl/pltcl.c

Support PL/Tcl functions that return composite types and/or sets.

commit   : 26abb50c490dee191df21282bc940b94118550aa    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Nov 2016 17:56:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Nov 2016 17:56:05 -0500    

Click here for diff

Jim Nasby, rather heavily editorialized by me  
  
Patch: <[email protected]>  

M doc/src/sgml/pltcl.sgml
M src/pl/tcl/expected/pltcl_queries.out
M src/pl/tcl/expected/pltcl_setup.out
M src/pl/tcl/pltcl.c
M src/pl/tcl/sql/pltcl_queries.sql
M src/pl/tcl/sql/pltcl_setup.sql

Modernize result-tuple construction in pltcl_trigger_handler().

commit   : 2178cbf40d3d75d87ab9b55579ac1cb0621baeff    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Nov 2016 16:09:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Nov 2016 16:09:57 -0500    

Click here for diff

Use Tcl_ListObjGetElements instead of Tcl_SplitList.  Aside from being  
possibly more efficient in its own right, this means we are no longer  
responsible for freeing a malloc'd result array, so we can get rid of  
a PG_TRY/PG_CATCH block.  
  
Use heap_form_tuple instead of SPI_modifytuple.  We don't need the  
extra generality of the latter, since we're always replacing all  
columns.  Nor do we need its memory-context-munging, since at this  
point we're already out of the SPI environment.  
  
Per comparison of this code to tuple-building code submitted by Jim Nasby.  
I've abandoned the thought of merging the two cases into a single routine,  
but we may as well make the older code simpler and faster where we can.  

M src/pl/tcl/pltcl.c

Rationalize and document pltcl's handling of magic ".tupno" array element.

commit   : fd2664dcb71102a5d66d2453182c010fb219496c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Nov 2016 14:43:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Nov 2016 14:43:13 -0500    

Click here for diff

For a very long time, pltcl's spi_exec and spi_execp commands have had  
a behavior of storing the current row number as an element of output  
arrays, but this was never documented.  Fix that.  
  
For an equally long time, pltcl_trigger_handler had a behavior of silently  
ignoring ".tupno" as an output column name, evidently so that the result  
of spi_exec could be used directly as a trigger result tuple.  Not sure  
how useful that really is, but in any case it's bad that it would break  
attempts to use ".tupno" as an actual column name.  We can fix it by not  
checking for ".tupno" until after we check for a column name match.  This  
comports with the effective behavior of spi_exec[p] that ".tupno" is only  
magic when you don't have an actual column named that.  
  
In passing, wordsmith the description of returning modified tuples from  
a pltcl trigger.  
  
Noted while working on Jim Nasby's patch to support composite results  
from pltcl.  The inability to return trigger tuples using ".tupno" as  
a column name is a bug, so back-patch to all supported branches.  

M doc/src/sgml/pltcl.sgml
M src/pl/tcl/pltcl.c

Need to do SPI_push/SPI_pop around expression evaluation in plpgsql.

commit   : fc8b81a291bf7e1acfcbd40ed344f323f1e93a94    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Nov 2016 12:09:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Nov 2016 12:09:36 -0500    

Click here for diff

We must do this in case the expression evaluation results in calling  
another plpgsql function (or, really, anything using SPI).  I missed  
the need for this when I converted exec_cast_value() from doing a  
simple InputFunctionCall() to doing ExecEvalExpr() in commit 1345cc67b.  
There is a SPI_push_conditional in InputFunctionCall(), so that there  
was no bug before that.  
  
Per bug #14414 from Marcos Castedo.  Add a regression test based on his  
example, which was that a plpgsql function in a domain check constraint  
didn't work when assigning to a domain-type variable within plpgsql.  
  
Report: <[email protected]>  

M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Fix silly nil-pointer-dereference bug introduced in commit d5f6f13f8.

commit   : 5485c99e7f507b2849ac675e9c10f34551f645b6    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Nov 2016 11:29:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Nov 2016 11:29:40 -0500    

Click here for diff

Don't fetch record->xl_info before we've verified that record isn't  
NULL.  Per Coverity.  
  
Michael Paquier  

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

More zic cleanup.

commit   : 32416b0f9a8502e7dff8afbf78e494c091b045e8    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Nov 2016 10:45:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Nov 2016 10:45:58 -0500    

Click here for diff

The workaround the IANA guys chose to get rid of the clang warning  
we'd silenced in commit 23ed2ba81 turns out not to satisfy Coverity.  
Go back to the previous solution, ie, remove the useless comparison  
to SIZE_MAX.  (In principle, there could be machines out there where  
it's not useless because ptrdiff_t is wider than size_t.  But the whole  
thing is pretty academic anyway, as we could never approach this limit  
for any sane estimate of the amount of data that zic will ever be asked  
to work with.)  
  
Also, s/lineno/lineno_t/g, because if we accept their decision to start  
using "lineno" as a typedef, it is going to have very unpleasant  
consequences in our next pgindent run.  Noted that while fooling with  
pltcl yesterday.  

M src/timezone/zic.c

Improve minor error-handling details in pltcl.

commit   : 1b00dd0ea0f392b08fa50f9fcaf60e8f20d26dfd    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Nov 2016 17:32:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Nov 2016 17:32:29 -0400    

Click here for diff

Don't ask Tcl_GetIndexFromObj to store an error message in the interpreter  
in cases where the next argument isn't necessarily one of the options  
we're asking it to check for.  At best that is a waste of time, and at  
worst it might cause an inappropriate error result to get left behind.  
  
Be sure to check for valid syntax (ie, no command arguments) in  
pltcl_SPI_lastoid.  
  
Extracted from a larger and otherwise-unrelated patch.  
  
Jim Nasby  
  
Patch: <[email protected]>  

M src/pl/tcl/pltcl.c

Adjust cost_merge_append() to reflect use of binaryheap_replace_first().

commit   : 34ca0905706422c191b3b0afef6e1c5f54399833    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Nov 2016 13:48:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Nov 2016 13:48:11 -0400    

Click here for diff

Commit 7a2fe9bd0 improved merge append so that replacement of a tuple  
takes log(N) operations, not twice log(N).  Since cost_merge_append knew  
about that explicitly, we should adjust it.  This probably makes little  
difference in practice, but the obsolete comment is confusing.  
  
Ideally this would have been put in in 9.3 with the underlying behavior  
change; but I'm not going to back-patch it, since there's some small chance  
of changing a plan choice that somebody's optimized for.  
  
Thomas Munro  
  
Discussion: <CAEepm=0WQBSvuYcMOUj4Ga4NXpu2J=ejZcE=e=eiTjTX-6_gDw@mail.gmail.com>  

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

Remove duplicate macro definition.

commit   : 86d19d27ce6d588ebb0afa84f9121515fa11686d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Nov 2016 11:51:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Nov 2016 11:51:46 -0400    

Click here for diff

Seems to be a copy-and-pasteo.  Odd that we heard no reports of  
compiler warnings about it.  
  
Thomas Munro  

M src/include/access/xact.h

pgwin32_is_junction's argument should be "const char *" not "char *".

commit   : 06f5fd2f4f3d0991af07456e7cf6632b4ad9d7e7    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Nov 2016 11:14:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Nov 2016 11:14:10 -0400    

Click here for diff

We're passing const strings to it in places, and that's not an  
unreasonable thing to do.  Per buildfarm (noted on frogmouth  
in particular).  

M src/include/port.h
M src/port/dirmod.c

doc: Don't reformat .fo files before processing by fop

commit   : d49cc588ca589cd378b5862fa5704eaade4a1380    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 4 Nov 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 4 Nov 2016 12:00:00 -0400    

Click here for diff

This messes up the whitespace in the output PDF document in some places.  

M doc/src/sgml/Makefile

doc: Port page header customizations to XSLT

commit   : 6feb69f6cef8b1bd2829700e25e402f22e86f3bd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 4 Nov 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 4 Nov 2016 12:00:00 -0400    

Click here for diff

M doc/src/sgml/stylesheet.xsl

Provide DLLEXPORT markers for C functions via PG_FUNCTION_INFO_V1 macro.

commit   : c8ead2a3974d3eada145a0e18940150039493cc9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Nov 2016 19:04:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Nov 2016 19:04:56 -0400    

Click here for diff

Second try at the change originally made in commit 8518583cd;  
this time with contrib updates so that manual extern declarations  
are also marked with PGDLLEXPORT.  The release notes should point  
this out as a significant source-code change for extension authors,  
since they'll have to make similar additions to avoid trouble on Windows.  
  
Laurenz Albe, doc change by me  
  
Patch: <A737B7A37273E048B164557ADEF4A58B53962ED8@ntex2010a.host.magwien.gv.at>  

M contrib/hstore/hstore.h
M contrib/ltree/ltree.h
M doc/src/sgml/xfunc.sgml
M src/include/fmgr.h

Delete contrib/xml2's legacy implementation of xml_is_well_formed().

commit   : 20540710e83f2873707c284a0c0693f0b57156c4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Nov 2016 18:29:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Nov 2016 18:29:53 -0400    

Click here for diff

This function is unreferenced in modern usage; it was superseded in 9.1  
by a core function of the same name.  It has been left in place in the C  
code only so that pre-9.1 SQL definitions of the contrib/xml2 functions  
would continue to work.  Six years seems like enough time for people to  
have updated to the extension-style version of the xml2 module, so let's  
drop this.  
  
The key reason for not keeping it any longer is that we want to stick  
an explicit PGDLLEXPORT into PG_FUNCTION_INFO_V1(), and the similarity  
of name to the core function creates a conflict that compilers will  
complain about.  
  
Extracted from a larger patch for that purpose.  I'm committing this  
change separately to give it more visibility in the commit logs.  
  
While at it, remove the documentation entry that claimed that  
xml_is_well_formed() is a function provided by contrib/xml2, and  
instead mention the even more ancient alias xml_valid().  
  
Laurenz Albe, doc change by me  
  
Patch: <A737B7A37273E048B164557ADEF4A58B53962ED8@ntex2010a.host.magwien.gv.at>  

M contrib/xml2/xpath.c
M doc/src/sgml/xml2.sgml

Be more consistent about masking xl_info with ~XLR_INFO_MASK.

commit   : d5f6f13f8e7eb1c28395807922246294da4f57bb    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Nov 2016 13:26:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Nov 2016 13:26:49 -0400    

Click here for diff

Generally, WAL resource managers are only supposed to examine the  
top 4 bits of a WAL record's xl_info; the rest are reserved for  
the WAL mechanism itself.  A few places were not consistent about  
doing this with respect to XLOG_CHECKPOINT and XLOG_SWITCH records.  
There's no bug currently, since no additional bits ever get set in  
these specific record types, but that might not be true forever.  
Let's follow the generic coding rule here too.  
  
Michael Paquier  

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

Fix gin_leafpage_items().

commit   : 367b99bbb13a14bd96bba6f73c231b2056ba9592    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Nov 2016 12:11:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Nov 2016 12:11:47 -0400    

Click here for diff

On closer inspection, commit 84ad68d64 broke gin_leafpage_items(),  
because the aligned copy of the page got palloc'd in a short-lived  
context whereas it needs to be in the SRF's multi_call_memory_ctx.  
This was not exposed by the regression test, because the regression  
test doesn't actually exercise the function in a meaningful way.  
Fix the code bug, and extend the test in what I hope is a portable  
fashion.  

M contrib/pageinspect/expected/gin.out
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/sql/gin.sql

Improve tab completion for CREATE TRIGGER.

commit   : 927d7bb6b120a2ca09a164898f887eb850b7a329    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 4 Nov 2016 11:02:07 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 4 Nov 2016 11:02:07 -0500    

Click here for diff

This includes support for the new REFERENCING clause.  

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

Implement syntax for transition tables in AFTER triggers.

commit   : 8c48375e5f43ebd832f93c9166d1fe0e639ff806    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 4 Nov 2016 10:49:50 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 4 Nov 2016 10:49:50 -0500    

Click here for diff

This is infrastructure for the complete SQL standard feature.  No  
support is included at this point for execution nodes or PLs.  The  
intent is to add that soon.  
  
As this patch leaves things, standard syntax can create tuplestores  
to contain old and/or new versions of rows affected by a statement.  
References to these tuplestores are in the TriggerData structure.  
C triggers can access the tuplestores directly, so they are usable,  
but they cannot yet be referenced within a SQL statement.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/create_trigger.sgml
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.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/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_trigger.h
M src/include/commands/trigger.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/utils/reltrigger.h

pg_xlogdump: Add NLS

commit   : 69d590fffbdcfb50a31a8c78ce87e602002a869f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 15 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 15 Oct 2016 12:00:00 -0400    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  

A src/bin/pg_xlogdump/nls.mk
M src/bin/pg_xlogdump/pg_xlogdump.c

pg_test_timing: Add NLS

commit   : 59fa9d2d9da46097dd4da5c5f1f07e22a288fccf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Oct 2016 12:00:00 -0400    

Click here for diff

Also straighten out use of time unit abbreviations a bit.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/ref/pgtesttiming.sgml
A src/bin/pg_test_timing/nls.mk
M src/bin/pg_test_timing/pg_test_timing.c

pg_test_fsync: Add NLS

commit   : a39255d766381957622b145838c38dbbea6fc367    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Oct 2016 12:00:00 -0400    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  

A src/bin/pg_test_fsync/nls.mk
M src/bin/pg_test_fsync/pg_test_fsync.c

pg_archivecleanup: Add NLS

commit   : 632fbe772cff9dadca82a26dacaa39bd50a0cc5c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Oct 2016 12:00:00 -0400    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  

A src/bin/pg_archivecleanup/nls.mk
M src/bin/pg_archivecleanup/pg_archivecleanup.c

pageinspect: Fix unaligned struct access in GIN functions

commit   : 84ad68d645222f534e4fe51fbba43a5c9cc382a5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 4 Nov 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 4 Nov 2016 12:00:00 -0400    

Click here for diff

The raw page data that is passed into the functions will not be aligned  
at 8-byte boundaries.  Casting that to a struct and accessing int64  
fields will result in unaligned access.  On most platforms, you get away  
with it, but it will result on a crash on pickier platforms such as ia64  
and sparc64.  

M contrib/pageinspect/ginfuncs.c

Add API to check if an existing exclusive lock allows cleanup.

commit   : f2e6a2ccf1247bc15f6c03895c936b28cdeff181    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 4 Nov 2016 09:27:49 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 4 Nov 2016 09:27:49 -0400    

Click here for diff

LockBufferForCleanup() acquires a cleanup lock unconditionally, and  
ConditionalLockBufferForCleanup() acquires a cleanup lock if it is  
possible to do so without waiting; this patch adds a new API,  
IsBufferCleanupOK(), which tests whether an exclusive lock already  
held happens to be a cleanup lock.  This is possible because a cleanup  
lock simply means an exclusive lock plus the assurance any other pins  
on the buffer are newer than our own pin.  Therefore, just as the  
existing functions decide that the exclusive lock that they've just  
taken is a cleanup lock if they observe the pin count to be 1, this  
new function allows us to observe that the pin count is 1 on a buffer  
we've already locked.  
  
This is useful in situations where a backend definitely wishes to  
modify the buffer and also wishes to perform cleanup operations if  
possible.  The patch to eliminate heavyweight locking by hash indexes  
uses this, and it may have other applications as well.  
  
Amit Kapila, per a suggestion from me.  Some comment adjustments by me  
as well.  

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

postgres_fdw: Fix typo in comment.

commit   : 7016e4c4f59c30d22f308dd29e8a5014d6427f69    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 4 Nov 2016 09:03:42 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 4 Nov 2016 09:03:42 -0400    

Click here for diff

Etsuro Fujita  

M contrib/postgres_fdw/postgres_fdw.c

commit   : 97f16b87028b1af8606094d80bb92b24318ce1db    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 3 Nov 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 3 Nov 2016 12:00:00 -0400    

Click here for diff

This matches what was already implemented in the DSSSL HTML build.  

M doc/src/sgml/stylesheet.xsl

Sync our copy of the timezone library with IANA tzcode master.

commit   : 1f87181e12beb067d21b79493393edcff14c190b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Nov 2016 22:24:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Nov 2016 22:24:34 -0400    

Click here for diff

This patch absorbs some unreleased fixes for symlink manipulation bugs  
introduced in tzcode 2016g.  Ordinarily I'd wait around for a released  
version, but in this case it seems like we could do with extra testing,  
in particular checking whether it works in EDB's VMware build environment.  
This corresponds to commit aec59156abbf8472ba201b6c7ca2592f9c10e077 in  
https://github.com/eggert/tz.  
  
Per a report from Sandeep Thakkar, building in an environment where hard  
links are not supported in the timezone data installation directory failed,  
because upstream code refactoring had broken the case of symlinking from an  
existing symlink.  Further experimentation also showed that the symlinks  
were sometimes made incorrectly, with too many or too few "../"'s in the  
symlink contents.  
  
This should get back-patched, but first let's see what the buildfarm  
makes of it.  I'm not too sure about the new dependency on linkat(2).  
  
Report: <CANFyU94_p6mqRQc2i26PFp5QAOQGB++AjGX=FO8LDpXw0GSTjw@mail.gmail.com>  
Discussion: http://mm.icann.org/pipermail/tz/2016-November/024431.html  

M src/timezone/zic.c

psql: Split up "Modifiers" column in \d and \dD

commit   : a0f357e570ce01cf017f02d9f05ab2272663d695    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 3 Nov 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 3 Nov 2016 12:00:00 -0400    

Click here for diff

Make separate columns "Collation", "Nullable", "Default".  
  
Reviewed-by: Kuntal Ghosh <[email protected]>  

M contrib/earthdistance/expected/earthdistance.out
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/test_decoding/expected/ddl.out
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/describe.c
M src/interfaces/ecpg/test/compat_informix/test_informix2.pgc
M src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/collate.linux.utf8.out
M src/test/regress/expected/collate.out
M src/test/regress/expected/copy2.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/create_view.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/insert.out
M src/test/regress/expected/matview.out
M src/test/regress/expected/polymorphism.out
M src/test/regress/expected/prepared_xacts.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/tablesample.out
M src/test/regress/expected/triggers.out
M src/test/regress/expected/typed_table.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/expected/with.out

psql: Tab-complete LOCK [TABLE] ... IN {ACCESS|ROW|SHARE}.

commit   : 1d15d0db50a5f39ab69c1fe60f2d5dcc7e2ddb9c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 3 Nov 2016 11:42:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 3 Nov 2016 11:42:13 -0400    

Click here for diff

Suggest the lock modes that begin with the word in question.  
  
Thomas Munro, reviewed by Marllius Ribeiro.  Comments tweaked by me.  

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

Use NIL instead of NULL for an empty List.

commit   : c6ff380e380686fd6b3bd056ccd09ea469f1267c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 3 Nov 2016 11:24:01 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 3 Nov 2016 11:24:01 -0400    

Click here for diff

Tatsuro Yamada, reviewed by Ashutosh Bapat  

M contrib/postgres_fdw/postgres_fdw.c

libpq: Allow connection strings and URIs to specify multiple hosts.

commit   : 274bb2b3857cc987cfa21d14775cae9b0dababa5    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 3 Nov 2016 09:25:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 3 Nov 2016 09:25:20 -0400    

Click here for diff

It's also possible to specify a separate port for each host.  
  
Previously, we'd loop over every address returned by looking up the  
host name; now, we'll try every address for every host name.  
  
Patch by me.  Victor Wagner wrote an earlier patch for this feature,  
which I read, but I didn't use any of his code.  Review by Mithun Cy.  

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

Don't make FK-based selectivity estimates in inheritance situations.

commit   : 770671062f130a830aa89100c9aa2d26f8d4bf32    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Nov 2016 15:50:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Nov 2016 15:50:15 -0400    

Click here for diff

The foreign-key-aware logic for estimation of join sizes (added in commit  
100340e2d) blindly tried to apply the concept to rels that are actually  
parents of inheritance trees.  This is just plain wrong so far as the  
referenced relation is concerned, since the inheritance scan may well  
produce lots of rows that are not participating in the constraint.  It's  
wrong for the referencing relation too, for the same reason; although on  
that end we could conceivably detect whether all members of the inheritance  
tree have equivalent FK constraints pointing to the same referenced rel,  
and then proceed more or less as we do now.  But pending somebody writing  
code to do that, we must disable this, because it's producing completely  
silly estimates when there's an FK linking the heads of inheritance trees.  
  
Per bug #14404 from Clinton Adams.  Back-patch to 9.6 where the new  
estimation logic came in.  
  
Report: <[email protected]>  

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

Don't convert Consts into Vars during setrefs.c processing.

commit   : da8f3ebf30bef9c950595dc0d1f03bce2b1b8563    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Nov 2016 14:32:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Nov 2016 14:32:13 -0400    

Click here for diff

While converting expressions in an upper-level plan node so that they  
reference Vars and expressions provided by the input plan node(s),  
don't convert plain Const items, even if there happens to be a matching  
Const in the input.  It's silly to do so because a Var is more expensive to  
execute than a Const.  Moreover, converting can fool ExecCheckPlanOutput's  
check that an insert or update query inserts nulls into dropped columns,  
leading to "query provides a value for a dropped column" errors during  
INSERT or UPDATE on a table with a dropped column.  We could solve this  
by making that check more complicated, but I don't see the point; this fix  
should save a marginal number of cycles, and it also makes for less messy  
EXPLAIN output, as shown by the ensuing regression test result changes.  
  
Per report from Pavel HanƔk.  I have not incorporated a test case based  
on that example, as there doesn't seem to be a simple way of checking  
this in isolation without making a bunch of assumptions about other  
planner and SQL-function behavior.  
  
Back-patch to 9.6.  This setrefs.c behavior exists much further back,  
but there is not currently reason to think that it causes problems  
before 9.6.  
  
Discussion: <[email protected]>  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/optimizer/plan/setrefs.c
M src/test/regress/expected/inherit.out

pageinspect: Make page test more portable

commit   : 00a86856c1195f3f653672d3b06aa9e4a4aeab82    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 1 Nov 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 1 Nov 2016 12:00:00 -0400    

Click here for diff

Choose test data that makes the output independent of endianness.  

M contrib/pageinspect/expected/page.out
M contrib/pageinspect/sql/page.sql

Fix portability bug in gin_page_opaque_info().

commit   : 14ee35799f1640f44b3e154adcd7607f9a48307f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Nov 2016 00:09:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Nov 2016 00:09:27 -0400    

Click here for diff

Somebody apparently thought that "if Int32GetDatum is good,  
Int64GetDatum must be better".  Per buildfarm failures now  
that Peter has added some regression tests here.  

M contrib/pageinspect/ginfuncs.c

pageinspect: Make btree test more portable

commit   : f7c9a6e083da3f64e7440a31960b837353514262    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 1 Nov 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 1 Nov 2016 12:00:00 -0400    

Click here for diff

Choose test data that makes the output independent of endianness and  
alignment.  

M contrib/pageinspect/expected/btree.out
M contrib/pageinspect/sql/btree.sql

postgres_fdw: Fix typo in comment.

commit   : 9779f71c40906876018e85982c1d4a7a8c52abec    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 1 Nov 2016 16:21:29 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 1 Nov 2016 16:21:29 -0400    

Click here for diff

Etsuro Fujita  

M contrib/postgres_fdw/deparse.c

Add subsection headers in pageinspect documentation

commit   : b5e3942f50cc8fb57d36581ceabcba035212eb7d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 1 Nov 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 1 Nov 2016 12:00:00 -0400    

Click here for diff

extracted from a patch from Jesper Pedersen <[email protected]>  

M doc/src/sgml/pageinspect.sgml

pageinspect: Add tests

commit   : adfb81d9e1d60a6b69c128537b69a46b7761d749    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 29 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Sep 2016 12:00:00 -0400    

Click here for diff

A contrib/pageinspect/.gitignore
M contrib/pageinspect/Makefile
A contrib/pageinspect/expected/brin.out
A contrib/pageinspect/expected/btree.out
A contrib/pageinspect/expected/gin.out
A contrib/pageinspect/expected/page.out
A contrib/pageinspect/sql/brin.sql
A contrib/pageinspect/sql/btree.sql
A contrib/pageinspect/sql/gin.sql
A contrib/pageinspect/sql/page.sql

Add make rules to download raw Unicode mapping files

commit   : 3a47c704fb8d44ce675d73c6f4fd8dd8c1820c73    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 28 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 28 Oct 2016 12:00:00 -0400    

Click here for diff

This serves as implicit documentation and is handy if someone wants to  
tweak things.  The rules are not part of a normal build, like this  
entire directory.  

M src/backend/utils/mb/Unicode/Makefile

Remove declarations for pq_putmessage_hook and pq_flush_hook.

commit   : 6bb9a6177d1274cb40acf5737bf44dc8229ec8ed    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 31 Oct 2016 09:14:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 31 Oct 2016 09:14:46 -0400    

Click here for diff

Commit 2bd9e412f92bc6a68f3e8bcb18e04955cc35001d added these in error.  
They were part of an earlier design for that patch and survived in the  
committed version only by inadvertency.  
  
Julien Rouhaud  

M src/include/libpq/libpq.h

Fix typo in sources.sgml.

commit   : 36d154ecb2286328c7c59b99d5abb71318e056eb    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Mon, 31 Oct 2016 07:30:46 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Mon, 31 Oct 2016 07:30:46 +0900    

Click here for diff

Per Shinichi Matsuda.  

M doc/src/sgml/sources.sgml

Fix nasty performance problem in tsquery_rewrite().

commit   : 5ec81aceec8cc5a0edcc4609ee8edbc43a47e878    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Oct 2016 17:35:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Oct 2016 17:35:42 -0400    

Click here for diff

tsquery_rewrite() tries to find matches to subsets of AND/OR conditions;  
for example, in the query 'a | b | c' the substitution subquery 'a | c'  
should match and lead to replacement of the first and third items.  
That's fine, but the matching algorithm apparently takes about O(2^N)  
for an N-clause query (I say "apparently" because the code is also both  
unintelligible and uncommented).  We could probably do better than that  
even without any extra assumptions --- but actually, we know that the  
subclauses are sorted, indeed are depending on that elsewhere in this very  
same function.  So we can just scan the two lists a single time to detect  
matches, as though we were doing a merge join.  
  
Also do a re-flattening call (QTNTernary()) in tsquery_rewrite_query, just  
to make sure that the tree fits the expectations of the next search cycle.  
I didn't try to devise a test case for this, but I'm pretty sure that the  
oversight could have led to failure to match in some cases where a match  
would be expected.  
  
Improve comments, and also stick a CHECK_FOR_INTERRUPTS into  
dofindsubquery, just in case it's still too slow for somebody.  
  
Per report from Andreas Seltenreich.  Back-patch to all supported branches.  
  
Discussion: <[email protected]>  

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

Fix bogus tree-flattening logic in QTNTernary().

commit   : 24ebc444c61306f50777f674544e8559e765ad81    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Oct 2016 15:24:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Oct 2016 15:24:40 -0400    

Click here for diff

QTNTernary() contains logic to flatten, eg, '(a & b) & c' into 'a & b & c',  
which is all well and good, but it tries to do that to NOT nodes as well,  
so that '!!a' gets changed to '!a'.  Explicitly restrict the conversion to  
be done only on AND and OR nodes, and add a test case illustrating the bug.  
  
In passing, provide some comments for the sadly naked functions in  
tsquery_util.c, and simplify some baroque logic in QTNFree(), which  
I think may have been leaking some items it intended to free.  
  
Noted while investigating a complaint from Andreas Seltenreich.  
Back-patch to all supported versions.  

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

Improve speed of aggregates that use array_append as transition function.

commit   : 9a00f03e479c2d4911eed5b4bd1994315d409938    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Oct 2016 12:27:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Oct 2016 12:27:41 -0400    

Click here for diff

In the previous coding, if an aggregate's transition function returned an  
expanded array, nodeAgg.c and nodeWindowAgg.c would always copy it and thus  
force it into the flat representation.  This led to ping-ponging between  
flat and expanded formats, which costs a lot.  For an aggregate using  
array_append as transition function, I measured about a 15X slowdown  
compared to the pre-9.5 code, when working on simple int[] arrays.  
Of course, the old code was already O(N^2) in this usage due to copying  
flat arrays all the time, but it wasn't quite this inefficient.  
  
To fix, teach nodeAgg.c and nodeWindowAgg.c to allow expanded transition  
values without copying, so long as the transition function takes care to  
return the transition value already properly parented under the aggcontext.  
That puts a bit of extra responsibility on the transition function, but  
doing it this way allows us to not need any extra logic in the fast path  
of advance_transition_function (ie, with a pass-by-value transition value,  
or with a modified-in-place pass-by-reference value).  We already know  
that that's a hot spot so I'm loath to add any cycles at all there.  Also,  
while only array_append currently knows how to follow this convention,  
this solution allows other transition functions to opt-in without needing  
to have a whitelist in the core aggregation code.  
  
(The reason we would need a whitelist is that currently, if you pass a  
R/W expanded-object pointer to an arbitrary function, it's allowed to do  
anything with it including deleting it; that breaks the core agg code's  
assumption that it should free discarded values.  Returning a value under  
aggcontext is the transition function's signal that it knows it is an  
aggregate transition function and will play nice.  Possibly the API rules  
for expanded objects should be refined, but that would not be a  
back-patchable change.)  
  
With this fix, an aggregate using array_append is no longer O(N^2), so it's  
much faster than pre-9.5 code rather than much slower.  It's still a bit  
slower than the bespoke infrastructure for array_agg, but the differential  
seems to be only about 10%-20% rather than orders of magnitude.  
  
Discussion: <[email protected]>  

M doc/src/sgml/xaggr.sgml
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/optimizer/util/clauses.c
M src/backend/utils/adt/array_userfuncs.c

Fix memory leak in tar file padding

commit   : a775406ec439bc585a17f8edffd47641390d6e5a    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 30 Oct 2016 14:10:39 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 30 Oct 2016 14:10:39 +0100    

Click here for diff

Spotted by Coverity, patch by Michael Paquier  

M src/bin/pg_basebackup/walmethods.c

pgstattuple: Don't take heavyweight locks when examining a hash index.

commit   : d4b5d4caddb73f954d9ef86641201dc99677719d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 28 Oct 2016 12:21:15 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 28 Oct 2016 12:21:15 -0400    

Click here for diff

It's currently necessary to take a heavyweight lock when scanning a  
hash bucket, but pgstattuple only examines individual pages, so it  
doesn't need to do this.  If, for some hypothetical reason, it did  
need to do any heavyweight locking here, this logic would probably  
still be incorrect, because most of the locks that it is taking are  
meaningless.  Only a heavyweight lock on a primary bucket page has any  
meaning, but this takes heavyweight locks on all pages regardless of  
function - and in particular overflow pages, where you might imagine  
that we'd want to lock the primary bucket page if we needed to lock  
anything at all.  
  
This is arguably a bug that has existed since this code was added in  
commit dab42382f483c3070bdce14a4d93c5d0cf61e82b, but I'm not going to  
bother back-patching it because in most cases the only consequence is  
that running pgstattuple() on a hash index is a little slower than it  
otherwise might be, which is no big deal.  
  
Extracted from a vastly larger patch by Amit Kapila which heavyweight  
locking for hash indexes entirely; analysis of why this can be done  
independently of the rest by me.  

M contrib/pgstattuple/pgstattuple.c

Fix leftover reference to background writer performing checkpoints.

commit   : 33839b5ffbd7be56681f31d107ec8238c4a0494a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 28 Oct 2016 09:07:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 28 Oct 2016 09:07:36 -0400    

Click here for diff

This was changed in PostgreSQL 9.2, but somehow this comment never  
got updated.  

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

doc: Small style improvements

commit   : a94b70356bcc3b2f5fc107d0ddfa936c32535a30    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 27 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 27 Oct 2016 12:00:00 -0400    

Click here for diff

M doc/src/sgml/pageinspect.sgml

Remove invitation to report a bug about unknown encoding

commit   : ce4dc970560a25d4f7091a6e9ce8c6e1f25d55c9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 27 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 27 Oct 2016 12:00:00 -0400    

Click here for diff

The error message when we couldn't determine the encoding from a locale  
said to report a bug about that.  That might have been appropriate when  
this code was first added, but by now this works pretty solidly and any  
encodings we don't recognize we probably just don't support.  We still  
print the warning, but no longer invite the bug report.  

M src/port/chklocale.c

Add function name to PyArg_ParseTuple()

commit   : eaed88ce120746b3004225252f52d8c79fea2f58    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 27 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 27 Oct 2016 12:00:00 -0400    

Click here for diff

This causes the supplied function name to appear in any error message,  
making the error message friendlier and relieving us from having to  
provide our own in some cases.  

M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_planobject.c
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_spi.c

Format PL/Python module contents test vertically

commit   : 84d457edaf4b3a1e10fd9e100e8ca18c042ad30c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Oct 2016 12:00:00 -0400    

Click here for diff

It makes it readable again and makes merges more manageable.  

M src/pl/plpython/expected/plpython_test.out
M src/pl/plpython/sql/plpython_test.sql

If the stats collector dies during Hot Standby, restart it.

commit   : 4f714b2fd2a580d909607de889ac822956eb8299    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 27 Oct 2016 14:27:40 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 27 Oct 2016 14:27:40 -0400    

Click here for diff

This bug exists as far back as 9.0, when Hot Standby was introduced,  
so back-patch to all supported branches.  
  
Report and patch by Takayuki Tsunakawa, reviewed by Michael Paquier  
and Kuntal Ghosh.  

M src/backend/postmaster/postmaster.c

Fix possible pg_basebackup failure on standby with "include WAL".

commit   : f267c1c2447bb8da6e4a6b2fcbb612762c3579a8    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 27 Oct 2016 11:19:51 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 27 Oct 2016 11:19:51 -0400    

Click here for diff

If a restartpoint flushed no dirty buffers, it could fail to update  
the minimum recovery point, leading to a minimum recovery point prior  
to the starting REDO location.  perform_base_backup() would interpret  
that as meaning that no WAL files at all needed to be included in the  
backup, failing an internal sanity check.  To fix, have restartpoints  
always update the minimum recovery point to just after the checkpoint  
record itself, so that the file (or files) containing the checkpoint  
record will always be included in the backup.  
  
Code by Amit Kapila, per a design suggestion by me, with some  
additional work on the code comment by me.  Test case by Michael  
Paquier.  Report by Kyotaro Horiguchi.  

M src/backend/access/transam/xlog.c
M src/test/recovery/t/001_stream_rep.pl

Avoid using a C++ keyword in header file

commit   : c32fe432afd4bc428acf4a237f911271746f689f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 26 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 26 Oct 2016 12:00:00 -0400    

Click here for diff

per cpluspluscheck  

M src/backend/executor/execGrouping.c
M src/include/lib/simplehash.h

Properly indent postgresql.conf comments to align

commit   : 586a46c22cea1526995195283fee0521fc6674b8    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 26 Oct 2016 21:16:20 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 26 Oct 2016 21:16:20 -0400    

Click here for diff

A few comments were misaligned.  

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

Fix incorrect trigger-property updating in ALTER CONSTRAINT.

commit   : a522fc3d806ca6ebe3f66e55b3f8cecb85116711    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Oct 2016 17:05:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Oct 2016 17:05:06 -0400    

Click here for diff

The code to change the deferrability properties of a foreign-key constraint  
updated all the associated triggers to match; but a moment's examination of  
the code that creates those triggers in the first place shows that only  
some of them should track the constraint's deferrability properties.  This  
leads to odd failures in subsequent exercise of the foreign key, as the  
triggers are fired at the wrong times.  Fix that, and add a regression test  
comparing the trigger properties produced by ALTER CONSTRAINT with those  
you get by creating the constraint as-intended to begin with.  
  
Per report from James Parks.  Back-patch to 9.4 where this ALTER  
functionality was introduced.  
  
Report: <CAJ3Xv+jzJ8iNNUcp4RKW8b6Qp1xVAxHwSXVpjBNygjKxcVuE9w@mail.gmail.com>  

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

commit   : 19b2094d96807e43d29687b3860e8fffb9da61b4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Oct 2016 13:40:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Oct 2016 13:40:41 -0400    

Click here for diff

I broke this in commit f3094920a.  Apparently it's dead code anyway,  
at least as far as our buildfarm is concerned (and the upstream IANA  
code doesn't worry at all about symlink() not being present).  
But as long as the rest of our code is willing to guard against not  
having symlink(), this should too.  Noted while investigating a  
tangentially-related complaint from Sandeep Thakkar.  
  
Back-patch to keep branches in sync.  

M src/timezone/zic.c

Doc: improve documentation about inheritance.

commit   : 162477a63d3c0fd1c31197717140a88077a8d0aa    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Oct 2016 11:46:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Oct 2016 11:46:25 -0400    

Click here for diff

Clarify documentation about inheritance of check constraints, in  
particular mentioning the NO INHERIT option, which didn't exist when  
this text was written.  
  
Document that in an inherited query, the applicable row security policies  
are those of the explicitly-named table, not its children.  This is the  
intended behavior (per off-list discussion with Stephen Frost), and there  
are regression tests for it, but it wasn't documented anywhere user-facing  
as far as I could find.  
  
Do a bit of wordsmithing on the description of inherited access-privilege  
checks.  
  
Back-patch to 9.5 where RLS was added.  

M doc/src/sgml/ddl.sgml

Suppress unused-variable warning in non-assert builds.

commit   : 8529686ccbb9f1c2fe350920ad324c223135a957    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Oct 2016 10:19:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Oct 2016 10:19:27 -0400    

Click here for diff

Introduced in commit 7012b132d.  
  
Kyotaro Horiguchi  

M contrib/postgres_fdw/deparse.c

Remove platform-dependent PL/python test case.

commit   : 8eb6337f9f53c85e707f60157e42fcacfe927668    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 17:09:18 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 17:09:18 +0300    

Click here for diff

Turns out that the output format of Python Decimal isn't totally platform-  
independent either. There are other tests for multi-dimensional arrays,  
so rather than try to fix this test case, just remove it.  
  
Per buildfarm member prairiedog.  

M src/pl/plpython/expected/plpython_types.out
M src/pl/plpython/expected/plpython_types_3.out
M src/pl/plpython/sql/plpython_types.sql

Only treat Python Lists as array dimensions.

commit   : cfd9c87a54b0d414a59a912710c6633313174e51    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 14:44:55 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 14:44:55 +0300    

Click here for diff

Instead of treating all python sequence types as array dimensions, except  
for tuples and various kinds of strings, only treat Python lists as  
dimensions. The PyBytes_Check() function used previously is only available  
on Python 2.6 and newer, and it was a bit fiddly anyway. The list of  
exceptions would require adjustment if Python got a new kind of a sequence  
similar to bytes/unicodes/strings, so only checking for Lists seems more  
future-proof. The documentation only mentioned using Lists, so this is  
closer to what was documented, anyway.  
  
This should fix the buildfarm failures on systems building with Python 2.5,  
although I don't have Python 2.5 installed myself to test with.  

M src/pl/plpython/plpy_typeio.c

Avoid using platform-dependent floats in test case.

commit   : 73c8e8506cd1933ccf5c5d61088ca171a5f414c0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 14:17:07 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 14:17:07 +0300    

Click here for diff

The number of decimals printed for floats varied in this test case, as  
noted by several buildfarm members. There's nothing special about floats  
and arrays in the code being tested, so replace the floats with numerics to  
make the output platform-independent.  

M src/pl/plpython/expected/plpython_types.out
M src/pl/plpython/expected/plpython_types_3.out
M src/pl/plpython/sql/plpython_types.sql

Fix regression test to also work with Python 2.

commit   : e131ba4fe58123ce5726c1405486913b429c068c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 11:18:04 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 11:18:04 +0300    

Click here for diff

Per buildfarm.  

M src/pl/plpython/expected/plpython_composite.out

Fix typos in comments.

commit   : 56f39009c53e752493ca4478449a1311865dd51a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 11:12:31 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 11:12:31 +0300    

Click here for diff

Vinayak Pokale  

M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/reorderbuffer.c
M src/include/pgstat.h

Fix typo in comment.

commit   : 8a2f08fbeaf75f67da122b49f05f96257df3faed    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 11:10:13 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 11:10:13 +0300    

Click here for diff

Daniel Gustafsson  

M contrib/pageinspect/heapfuncs.c

Give a hint, when [] is incorrectly used for a composite type in array.

commit   : 510e1b8ecf2a6f0d91d50f41f6b7fd75242273a0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 10:38:56 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 10:38:56 +0300    

Click here for diff

That used to be accepted, so let's try to give a hint to users on why  
their PL/python functions no longer work.  
  
Reviewed by Pavel Stehule.  
  
Discussion: <CAH38_tmbqwaUyKs9yagyRra=SMaT45FPBxk1pmTYcM0TyXGG7Q@mail.gmail.com>  

M src/pl/plpython/expected/plpython_composite.out
M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/plpy_typeio.h
M src/pl/plpython/sql/plpython_composite.sql

Support multi-dimensional arrays in PL/python.

commit   : 94aceed317730953476bec490ce0148b2af3c383    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 10:56:30 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Oct 2016 10:56:30 +0300    

Click here for diff

Multi-dimensional arrays can now be used as arguments to a PL/python function  
(used to throw an error), and they can be returned as nested Python lists.  
  
This makes a backwards-incompatible change to the handling of composite  
types in arrays. Previously, you could return an array of composite types  
as "[[col1, col2], [col1, col2]]", but now that is interpreted as a two-  
dimensional array. Composite types in arrays must now be returned as  
Python tuples, not lists, to resolve the ambiguity. I.e. "[(col1, col2),  
(col1, col2)]".  
  
To avoid breaking backwards-compatibility, when not necessary, () is still  
accepted for arrays at the top-level, but it is always treated as a  
single-dimensional array. Likewise, [] is still accepted for composite types,  
when they are not in an array. Update the documentation to recommend using []  
for arrays, and () for composite types, with a mention that those other things  
are also accepted in some contexts.  
  
This needs to be mentioned in the release notes.  
  
Alexey Grishchenko, Dave Cramer and me. Reviewed by Pavel Stehule.  
  
Discussion: <CAH38_tmbqwaUyKs9yagyRra=SMaT45FPBxk1pmTYcM0TyXGG7Q@mail.gmail.com>  

M doc/src/sgml/plpython.sgml
M src/pl/plpython/expected/plpython_composite.out
M src/pl/plpython/expected/plpython_types.out
M src/pl/plpython/expected/plpython_types_3.out
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/sql/plpython_composite.sql
M src/pl/plpython/sql/plpython_types.sql

pg_dump: Simplify internal archive version handling

commit   : 8c035e55c4807dc5844f563dcbbc44ffe2fdd4d6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 25 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 25 Oct 2016 12:00:00 -0400    

Click here for diff

The ArchiveHandle structure contained the archive format version number  
twice, once as a single field and once split into components.  Simplify  
that by just keeping the single field and adding some macros to extract  
the components.  Introduce some macros for composing version numbers, to  
eliminate the repeated use of magic formulas.  Drop the unused trailing  
zero byte from the run-time composite version representation.  
  
reviewed by Tom Lane  

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

Free walmethods before exiting

commit   : 78d109150bf133c38bcdc6d8c5bd9ff546ed1171    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 25 Oct 2016 18:57:56 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 25 Oct 2016 18:57:56 +0200    

Click here for diff

Not strictly necessary since we quite after, but could become important  
in the future if we do restarts etc.  
  
Michael Paquier with nitpicking from me  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h

Don't fsync() files when --no-sync is specified

commit   : 8c46f0c9ce4695db7d68188e08e5e6be1c329645    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 25 Oct 2016 18:56:21 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 25 Oct 2016 18:56:21 +0200    

Click here for diff

Michael Paquier  

M src/bin/pg_basebackup/walmethods.c

Consistently mention 'SELECT pg_reload_conf()' in config files

commit   : 10c064ce4dad088ba2d8b978bff6009b9f22dc3a    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 25 Oct 2016 11:26:15 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 25 Oct 2016 11:26:15 -0400    

Click here for diff

Previously we only mentioned SIGHUP and 'pg_ctl reload' in  
postgresql.conf and pg_hba.conf.  

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

postgres_fdw: Try again to stabilize aggregate pushdown regression tests.

commit   : f5d6bce63ceb3c59a964814bb0df5a0648e750e5    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 24 Oct 2016 22:36:24 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 24 Oct 2016 22:36:24 -0400    

Click here for diff

A query that only aggregates one row isn't a great argument for pushdown,  
and buildfarm member brolga decides against it.  Adjust the query a bit  
in the hopes of getting remote aggregation to win consistently.  
  
Jeevan Chalke, per suggestion from Tom Lane  

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

Use ssize_t where signed results can happen

commit   : 2dde01ccbfb4c53c7edd28a6836ba47303fea0ba    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 24 Oct 2016 20:10:18 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 24 Oct 2016 20:10:18 +0200    

Click here for diff

Noted by Alexander Korotkov  

M src/bin/pg_basebackup/walmethods.c

Update release notes for last-minute commit timestamp fix.

commit   : 30a6f98ed8a2223ef876197b5dea0d94e5807b51    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Oct 2016 09:37:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Oct 2016 09:37:23 -0400    

Click here for diff

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

Preserve commit timestamps across clean restart

commit   : 00f15338b234e5fd7cda2d7bf0ef8d9f29f6bf5f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 24 Oct 2016 09:27:24 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 24 Oct 2016 09:27:24 -0300    

Click here for diff

An oversight in setting the boundaries of known commit timestamps during  
startup caused old commit timestamps to become inaccessible after a  
server restart.  
  
Author and reporter: Julien Rouhaud  
Review, test code: Craig Ringer  

M src/backend/access/transam/commit_ts.c
A src/test/modules/commit_ts/t/004_restart.pl

Release notes for 9.6.1, 9.5.5, 9.4.10, 9.3.15, 9.2.19, 9.1.24.

commit   : 7d80417d3dfc88b0c03b5c08a18b29f9d430e217    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Oct 2016 22:13:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Oct 2016 22:13:28 -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
M doc/src/sgml/release-9.6.sgml

Avoid testing tuple visibility without buffer lock.

commit   : 8f1fb7d621b0e6bd2eb0ba2ac9634c5b5a03564b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Oct 2016 19:14:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Oct 2016 19:14:32 -0400    

Click here for diff

INSERT ... ON CONFLICT (specifically ExecCheckHeapTupleVisible) contains  
another example of this unsafe coding practice.  It is much harder to get  
a failure out of it than the case fixed in commit 6292c2339, because in  
most scenarios any hint bits that could be set would have already been set  
earlier in the command.  However, Konstantin Knizhnik reported a failure  
with a custom transaction manager, and it's clearly possible to get a  
failure via a race condition in async-commit mode.  
  
For lack of a reproducible example, no regression test case in this  
commit.  
  
I did some testing with Asserts added to tqual.c's functions, and can say  
that running "make check-world" exposed these two bugs and no others.  
The Asserts are messy enough that I've not added them to the code for now.  
  
Report: <[email protected]>  
Related-Discussion: <CAO3NbwOycQjt2Oqy2VW-eLTq2M5uGMyHnGm=RNga4mjqcYD7gQ@mail.gmail.com>  

M src/backend/executor/nodeModifyTable.c

Don't throw serialization errors for self-conflicts in INSERT ON CONFLICT.

commit   : a6c0a5b6e8a9498540c6a7bb1b6d68958acc9bc6    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Oct 2016 18:36:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Oct 2016 18:36:13 -0400    

Click here for diff

A transaction that conflicts against itself, for example  
	INSERT INTO t(pk) VALUES (1),(1) ON CONFLICT DO NOTHING;  
should behave the same regardless of isolation level.  It certainly  
shouldn't throw a serialization error, as retrying will not help.  
We got this wrong due to the ON CONFLICT logic not considering the case,  
as reported by Jason Dusek.  
  
Core of this patch is by Peter Geoghegan (based on an earlier patch by  
Thomas Munro), though I didn't take his proposed code refactoring for fear  
that it might have unexpected side-effects.  Test cases by Thomas Munro  
and myself.  
  
Report: <CAO3NbwOycQjt2Oqy2VW-eLTq2M5uGMyHnGm=RNga4mjqcYD7gQ@mail.gmail.com>  
Related-Discussion: <[email protected]>  

M src/backend/executor/nodeModifyTable.c
A src/test/isolation/expected/insert-conflict-do-nothing-2.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/insert-conflict-do-nothing-2.spec
M src/test/regress/expected/insert_conflict.out
M src/test/regress/sql/insert_conflict.sql

Avoid testing tuple visibility without buffer lock in RI_FKey_check().

commit   : 6292c2339186bac215bab5a1f01370f9735582c1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Oct 2016 15:01:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Oct 2016 15:01:24 -0400    

Click here for diff

Despite the argumentation I wrote in commit 7a2fe85b0, it's unsafe to do  
this, because in corner cases it's possible for HeapTupleSatisfiesSelf  
to try to set hint bits on the target tuple; and at least since 8.2 we  
have required the buffer content lock to be held while setting hint bits.  
  
The added regression test exercises one such corner case.  Unpatched, it  
causes an assertion failure in assert-enabled builds, or otherwise would  
cause a hint bit change in a buffer we don't hold lock on, which given  
the right race condition could result in checksum failures or other data  
consistency problems.  The odds of a problem in the field are probably  
pretty small, but nonetheless back-patch to all supported branches.  
  
Report: <[email protected]>  

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

Rename walmethod fsync method to sync

commit   : eade082b122889eaf92eb806b8b6799160a25256    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 23 Oct 2016 18:04:34 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 23 Oct 2016 18:04:34 +0200    

Click here for diff

Using the name fsync clashed with the #define we have on Windows that  
redefines it to _commit. Naming it sync should remove that conflict.  
  
Per all the Windows buildfarm members  

M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h

Fix obviously too quickly applied fix to zlib issue

commit   : a5c17c1dcef4a656559152d3f6a5a27ae4957843    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 23 Oct 2016 16:07:31 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 23 Oct 2016 16:07:31 +0200    

Click here for diff

M src/bin/pg_basebackup/walmethods.c

Fix walmethods.c build without libz

commit   : 9ae6713cdf32122fa5a0bf15ddcd85f78f6f4631    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 23 Oct 2016 16:00:42 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 23 Oct 2016 16:00:42 +0200    

Click here for diff

Per numerous buildfarm manuals  

M src/bin/pg_basebackup/walmethods.c

Remove extra comma at end of enum list

commit   : d97a59a4c5597af5f53869a5a1c753893752c66b    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 23 Oct 2016 15:56:07 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 23 Oct 2016 15:56:07 +0200    

Click here for diff

C99-specific feature, and wasn't intentional in the first place.  
  
Per buildfarm member mylodon  

M src/bin/pg_basebackup/walmethods.h

Allow pg_basebackup to stream transaction log in tar mode

commit   : 56c7d8d4552180fd66fe48423bb2a9bb767c2d87    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 23 Oct 2016 15:16:31 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 23 Oct 2016 15:16:31 +0200    

Click here for diff

This will write the received transaction log into a file called  
pg_wal.tar(.gz) next to the other tarfiles instead of writing it to  
base.tar. When using fetch mode, the transaction log is still written to  
base.tar like before, and when used against a pre-10 server, the file  
is named pg_xlog.tar.  
  
To do this, implement a new concept of a "walmethod", which is  
responsible for writing the WAL. Two implementations exist, one that  
writes to a plain directory (which is also used by pg_receivexlog) and  
one that writes to a tar file with optional compression.  
  
Reviewed by Michael Paquier  

M doc/src/sgml/ref/pg_basebackup.sgml
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/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
A src/bin/pg_basebackup/walmethods.c
A src/bin/pg_basebackup/walmethods.h
M src/include/pgtar.h
M src/port/tar.c

Improve documentation about use of Linux huge pages.

commit   : 1885c88459698251eca64f095d9942c540ba0fa8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Oct 2016 14:04:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Oct 2016 14:04:51 -0400    

Click here for diff

Show how to get the system's huge page size, rather than misleadingly  
referring to PAGE_SIZE (which is usually understood to be the regular  
page size).  Show how to confirm whether huge pages have been allocated.  
Minor wordsmithing.  Back-patch to 9.4 where this section appeared.  

M doc/src/sgml/runtime.sgml

First-draft release notes for 9.6.1.

commit   : eacaf6e29fd2a3047aff9738a35a8e9b05e55375    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Oct 2016 19:43:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Oct 2016 19:43:06 -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.6.sgml

Fix comment formatting.

commit   : 919c811ca1e2a545cb1db243af93d55270d84469    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 21 Oct 2016 12:04:21 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 21 Oct 2016 12:04:21 -0400    

Click here for diff

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

postgres_fdw: Attempt to stabilize regression results.

commit   : ad13a09d762f0c903a52ed0ec668a0ba51a61047    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 21 Oct 2016 11:27:32 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 21 Oct 2016 11:27:32 -0400    

Click here for diff

Set enable_hashagg to false for tests involving least_agg(), so that  
we get the same plan regardless of local costing variances.  Also,  
remove a test involving sqrt(); it's there to test deparsing of  
HAVING clauses containing expressions, but that's tested elsewhere  
anyway, and sqrt(2) deparses with different amounts of precision on  
different machines.  
  
Per buildfarm.  

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

Doc: wording tweak for PERL, PYTHON, TCLSH configuration variables.

commit   : 7aa2c10ac6785a2de683609b98da607e588a6d02    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Oct 2016 11:01:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Oct 2016 11:01:35 -0400    

Click here for diff

Replace "Full path to ..." with "Full path name of ...".  At least one  
user has misinterpreted the existing wording as meaning "Directory  
containing ...".  

M doc/src/sgml/installation.sgml

postgres_fdw: Push down aggregates to remote servers.

commit   : 7012b132d07c2b4ea15b0b3cb1ea9f3278801d98    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 21 Oct 2016 09:54:29 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 21 Oct 2016 09:54:29 -0400    

Click here for diff

Now that the upper planner uses paths, and now that we have proper hooks  
to inject paths into the upper planning process, it's possible for  
foreign data wrappers to arrange to push aggregates to the remote side  
instead of fetching all of the rows and aggregating them locally.  This  
figures to be a massive win for performance, so teach postgres_fdw to  
do it.  
  
Jeevan Chalke and Ashutosh Bapat.  Reviewed by Ashutosh Bapat with  
additional testing by Prabhat Sahu.  Various mostly cosmetic changes  
by 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 src/backend/optimizer/plan/createplan.c

Fix EXPLAIN so that it doesn't emit invalid XML in corner cases.

commit   : 709e461befa8a4999c4ccdbfc7260ef8092e805c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Oct 2016 17:17:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Oct 2016 17:17:50 -0400    

Click here for diff

With track_io_timing = on, EXPLAIN (ANALYZE, BUFFERS) will emit fields  
named like "I/O Read Time".  The slash makes that invalid as an XML  
element name, so that adding FORMAT XML would produce invalid XML.  
  
We already have code in there to translate spaces to dashes, so let's  
generalize that to convert anything that isn't a valid XML name character,  
viz letters, digits, hyphens, underscores, and periods.  We could just  
reject slashes, which would run a bit faster.  But the fact that this went  
unnoticed for so long doesn't give me a warm feeling that we'd notice the  
next creative violation, so let's make it a permanent fix.  
  
Reported by Markus Winand, though this isn't his initial patch proposal.  
  
Back-patch to 9.2 where track_io_timing was added.  The problem is only  
latent in 9.1, so I don't feel a need to fix it there.  
  
Discussion: <[email protected]>  

M src/backend/commands/explain.c

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

commit   : 5e21b6811148fdc1fce9dcdcdc777418cc901fe4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Oct 2016 15:40:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Oct 2016 15:40:07 -0400    

Click here for diff

This absorbs a fix for a symlink-manipulation bug in zic that was  
introduced in 2016g.  It probably isn't interesting for our use-case,  
but I'm not quite sure, so let's update while we're at it.  

M src/timezone/zic.c

Update time zone data files to tzdata release 2016h.

commit   : d8fc45bd0f62fcebac80c63840b753f8e3b737ff    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Oct 2016 15:20:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Oct 2016 15:20:11 -0400    

Click here for diff

(Didn't I just do this?  Oh well.)  
  
DST law changes in Palestine.  Historical corrections for Turkey.  
Switch to numeric abbreviations for Asia/Colombo.  

M src/timezone/data/asia
M src/timezone/data/australasia
M src/timezone/data/europe
M src/timezone/data/northamerica
M src/timezone/known_abbrevs.txt

Rename "pg_xlog" directory to "pg_wal".

commit   : f82ec32ac30ae7e3ec7c84067192535b2ff8ec0e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 20 Oct 2016 11:24:37 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 20 Oct 2016 11:24:37 -0400    

Click here for diff

"xlog" is not a particularly clear abbreviation for "write-ahead log",  
and it sometimes confuses users into believe that the contents of the  
"pg_xlog" directory are not critical data, leading to unpleasant  
consequences.  So, rename the directory to "pg_wal".  
  
This patch modifies pg_upgrade and pg_basebackup to understand both  
the old and new directory layouts; the former is necessary given the  
purpose of the tool, while the latter merely avoids an unnecessary  
backward-compatibility break.  
  
We may wish to consider renaming other programs, switches, and  
functions which still use the old "xlog" naming to also refer to  
"wal".  However, that's still under discussion, so let's do just this  
much for now.  
  
Discussion: CAB7nPqTeC-8+zux8_-4ZD46V7YPwooeFxgndfsq5Rg8ibLVm1A@mail.gmail.com  
  
Michael Paquier  

M doc/src/sgml/backup.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_resetxlog.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pg_xlogdump.sgml
M doc/src/sgml/ref/pgtestfsync.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/storage.sgml
M doc/src/sgml/wal.sgml
M src/backend/access/transam/timeline.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/replication/README
M src/backend/replication/basebackup.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/storage/file/fd.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/pg_upgrade/exec.c
M src/bin/pg_xlogdump/pg_xlogdump.c
M src/common/file_utils.c
M src/include/access/xlog_internal.h
M src/include/catalog/catversion.h
M src/include/common/file_utils.h
M src/include/postmaster/pgarch.h

Remove a comment which is now incorrect.

commit   : ec7db2b483e0ff247ed41612cdb5716022401fe6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 20 Oct 2016 10:23:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 20 Oct 2016 10:23:39 -0400    

Click here for diff

Before 5d305d86bd917723f09ab4f15c075d90586a210a, this comment was  
correct, but now it says we do something which we don't actually do.  
Accordingly, remove the comment.  

M src/interfaces/libpq/libpq-int.h

Another portability fix for tzcode2016g update.

commit   : 23ed2ba8121178474f8c51774c6c258cb165a562    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Oct 2016 23:32:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Oct 2016 23:32:08 -0400    

Click here for diff

clang points out that SIZE_MAX wouldn't fit into an int, which means  
this comparison is pretty useless.  Per report from Thomas Munro.  

M src/timezone/zic.c

Windows portability fix.

commit   : ad90ac4d671d320ade3c127f215e97cd49c307fb    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Oct 2016 19:28:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Oct 2016 19:28:11 -0400    

Click here for diff

Per buildfarm.  

M src/timezone/zic.c

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

commit   : f3094920a567cde6c86adf36a1a033d7431b11ff    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Oct 2016 18:55:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Oct 2016 18:55:52 -0400    

Click here for diff

This is mostly to absorb some corner-case fixes in zic for year-2037  
timestamps.  The other changes that have been made are unlikely to affect  
our usage, but nonetheless we may as well take 'em.  

M src/timezone/localtime.c
M src/timezone/private.h
M src/timezone/strftime.c
M src/timezone/zic.c

Suppress "Factory" zone in pg_timezone_names view for tzdata >= 2016g.

commit   : a3215431ab7c667bf581728f10c80a36abbe1d5a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Oct 2016 18:11:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Oct 2016 18:11:49 -0400    

Click here for diff

IANA got rid of the really silly "abbreviation" and replaced it with one  
that's only moderately silly.  But it's still pointless, so keep on not  
showing it.  

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

Update time zone data files to tzdata release 2016g.

commit   : ecbac3e6e038e990f24a2e0eacdcd6738292105f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Oct 2016 17:56:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Oct 2016 17:56:38 -0400    

Click here for diff

DST law changes in Turkey.  Historical corrections for America/Los_Angeles,  
Europe/Kirov, Europe/Moscow, Europe/Samara, and Europe/Ulyanovsk.  
Rename Asia/Rangoon to Asia/Yangon, with a backward compatibility link.  
  
The IANA crew continue their campaign to replace invented time zone  
abbrevations with numeric GMT offsets.  This update changes numerous zones  
in Antarctica and the former Soviet Union, for instance Antarctica/Casey  
now reports "+08" not "AWST" in the pg_timezone_names view.  I kept these  
abbreviations in the tznames/ data files, however, so that we will still  
accept them for input.  (We may want to start trimming those files someday,  
but today is not that day.)  
  
An exception is that since IANA no longer claims that "AMT" is in use  
in Armenia for GMT+4, I replaced it in the Default file with GMT-4,  
corresponding to Amazon Time which is in use in South America.  It may be  
that that meaning is also invented and IANA will drop it in a future  
update; but for now, it seems silly to give pride of place to a meaning  
not traceable to IANA over one that is.  

M src/timezone/data/africa
M src/timezone/data/antarctica
M src/timezone/data/asia
M src/timezone/data/australasia
M src/timezone/data/backward
M src/timezone/data/backzone
M src/timezone/data/etcetera
M src/timezone/data/europe
M src/timezone/data/factory
M src/timezone/data/northamerica
M src/timezone/data/southamerica
M src/timezone/known_abbrevs.txt
M src/timezone/tznames/Antarctica.txt
M src/timezone/tznames/Asia.txt
M src/timezone/tznames/Default
M src/timezone/tznames/Europe.txt
M src/timezone/tznames/Indian.txt

Make getrusage() output a little more readable

commit   : 9ffe4a8b4cbb713bf8137f8414f02d97b6b2eb08    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Oct 2016 12:00:00 -0400    

Click here for diff

Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Peter Geoghegan <[email protected]>  

M doc/src/sgml/ref/vacuum.sgml
M src/backend/tcop/postgres.c
M src/backend/utils/misc/pg_rusage.c

Use pg_ctl promote -w in TAP tests

commit   : e5a9bcb529c474a07d1aa077665c5fade4c83cfc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Oct 2016 12:00:00 -0400    

Click here for diff

Switch TAP tests to use the new wait mode of pg_ctl promote.  This  
allows avoiding extra logic with poll_query_until() to be sure that a  
promoted standby is ready for read-write queries.  
  
From: Michael Paquier <[email protected]>  

M src/bin/pg_rewind/RewindTest.pm
M src/test/perl/PostgresNode.pm
M src/test/recovery/t/004_timeline_switch.pl

initdb pg_basebackup: Rename --noxxx options to --no-xxx

commit   : 5d58c07a441414ae29a8e315d2f9868d3d8e20be    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Oct 2016 12:00:00 -0400    

Click here for diff

--noclean and --nosync were the only options spelled without a hyphen,  
so change this for consistency with other options.  The options in  
pg_basebackup have not been in a release, so we just rename them.  For  
initdb, we retain the old variants.  
  
Vik Fearing and me  

M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/test/perl/PostgresNode.pm
M src/test/regress/pg_regress.c

pg_ctl: Add long option for -o

commit   : caf936b09fc7c74844575332b07c667a178cb078    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Oct 2016 12:00:00 -0400    

Click here for diff

Now all normally used options are covered by long options as well.  

M doc/src/sgml/ref/pg_ctl-ref.sgml
M src/bin/pg_ctl/pg_ctl.c

doc: Consistently use = sign in long options synopses

commit   : c709c6074083a8cc5f1ba431c741ff04e3a8a906    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Oct 2016 12:00:00 -0400    

Click here for diff

This was already the predominant form in man pages and help output.  

M doc/src/sgml/ref/clusterdb.sgml
M doc/src/sgml/ref/pg_ctl-ref.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/ref/reindexdb.sgml
M doc/src/sgml/ref/vacuumdb.sgml

pg_ctl: Add long options for -w and -W

commit   : 0be22457d730da8971f761b9c948f742a12b50b2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Oct 2016 12:00:00 -0400    

Click here for diff

From: Vik Fearing <[email protected]>  

M doc/src/sgml/ref/pg_ctl-ref.sgml
M src/bin/pg_ctl/pg_ctl.c

Fix WAL-logging of FSM and VM truncation.

commit   : 917dc7d2393ce680dea7a59418be9ff341df3c14    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 19 Oct 2016 14:26:05 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 19 Oct 2016 14:26:05 +0300    

Click here for diff

When a relation is truncated, it is important that the FSM is truncated as  
well. Otherwise, after recovery, the FSM can return a page that has been  
truncated away, leading to errors like:  
  
ERROR:  could not read block 28991 in file "base/16390/572026": read only 0  
of 8192 bytes  
  
We were using MarkBufferDirtyHint() to dirty the buffer holding the last  
remaining page of the FSM, but during recovery, that might in fact not  
dirty the page, and the FSM update might be lost.  
  
To fix, use the stronger MarkBufferDirty() function. MarkBufferDirty()  
requires us to do WAL-logging ourselves, to protect from a torn page, if  
checksumming is enabled.  
  
Also fix an oversight in visibilitymap_truncate: it also needs to WAL-log  
when checksumming is enabled.  
  
Analysis by Pavan Deolasee.  
  
Discussion: <CABOikdNr5vKucqyZH9s1Mh0XebLs_jRhKv6eJfNnD2wxTn=_9A@mail.gmail.com>  

M src/backend/access/heap/visibilitymap.c
M src/backend/storage/freespace/freespace.c
A src/test/recovery/t/008_fsm_truncation.pl

Improve regression test coverage for hash indexes.

commit   : b801e120080de836b834c1b756c4c4d81ce841b5    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 18 Oct 2016 15:55:03 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 18 Oct 2016 15:55:03 -0400    

Click here for diff

On my system, this improves coverage for src/backend/access/hash from  
61.3% of lines to 88.2% of lines, and from 83.5% of functions to 97.5%  
of functions, which is pretty good for 36 lines of tests.  
  
Mithun Cy, reviewing by Amit Kapila and Ɓlvaro Herrera  

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

Fix a few typos in simplehash.h.

commit   : 90d3da11c9417218ebd4f86b2003c98421824712    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 18 Oct 2016 10:55:56 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 18 Oct 2016 10:55:56 -0700    

Click here for diff

Author: Erik Rijkers  
Discussion: <[email protected]>  

M src/include/lib/simplehash.h

Fix typo in comment.

commit   : fca41acb86902b90218dcc3bc0ffc462850a090f    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 18 Oct 2016 13:43:01 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 18 Oct 2016 13:43:01 -0400    

Click here for diff

Amit Langote  

M src/include/foreign/foreign.h

Fix cidin() to handle values above 2^31 platform-independently.

commit   : 6f13a682c86801cfb9ae4f3126888b42f3cb5c46    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Oct 2016 12:24:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Oct 2016 12:24:46 -0400    

Click here for diff

CommandId is declared as uint32, and values up to 4G are indeed legal.  
cidout() handles them properly by treating the value as unsigned int.  
But cidin() was just using atoi(), which has platform-dependent behavior  
for values outside the range of signed int, as reported by Bart Lengkeek  
in bug #14379.  Use strtoul() instead, as xidin() does.  
  
In passing, make some purely cosmetic changes to make xidin/xidout  
look more like cidin/cidout; the former didn't have a monopoly on  
best practice IMO.  
  
Neither xidin nor cidin make any attempt to throw error for invalid input.  
I didn't change that here, and am not sure it's worth worrying about  
since neither is really a user-facing type.  The point is just to ensure  
that indubitably-valid inputs work as expected.  
  
It's been like this for a long time, so back-patch to all supported  
branches.  
  
Report: <[email protected]>  

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

Revert "Replace PostmasterRandom() with a stronger way of generating randomness."

commit   : faae1c918e8aaae034eaf3ea103fcb6ba9adc5ab    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 18 Oct 2016 16:28:23 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 18 Oct 2016 16:28:23 +0300    

Click here for diff

This reverts commit 9e083fd4683294f41544e6d0d72f6e258ff3a77c. That was a  
few bricks shy of a load:  
  
* Query cancel stopped working  
* Buildfarm member pademelon stopped working, because the box doesn't have  
  /dev/urandom nor /dev/random.  
  
This clearly needs some more discussion, and a quite different patch, so  
revert for now.  

M contrib/pgcrypto/Makefile
M contrib/pgcrypto/internal.c
A contrib/pgcrypto/random.c
M src/backend/libpq/auth.c
M src/backend/postmaster/postmaster.c
M src/include/port.h
M src/port/Makefile
D src/port/pg_strong_random.c
M src/tools/msvc/Mkvcbuild.pm

By default, set log_line_prefix = '%m [%p] '.

commit   : 7d3235ba42f8d5fc70c58e242702cc5e2e3549a6    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 17 Oct 2016 16:31:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 17 Oct 2016 16:31:13 -0400    

Click here for diff

This value might not be to everyone's taste; in particular, some  
people might prefer %t to %m, and others may want %u, %d, or other  
fields.  However, it's a vast improvement on the old default of ''.  
  
Christoph Berg  

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

Use OpenSSL EVP API for symmetric encryption in pgcrypto.

commit   : 5ff4a67f63fd6d3eb01ff9707d4674ed54a89f3b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 17 Oct 2016 17:29:33 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 17 Oct 2016 17:29:33 +0300    

Click here for diff

The old "low-level" API is deprecated, and doesn't support hardware  
acceleration. And this makes the code simpler, too.  
  
Discussion: <[email protected]>  

M contrib/pgcrypto/openssl.c

Fix use-after-free around DISTINCT transition function calls.

commit   : d8589946ddd5c43e1ebd01c5e92d0e177cbfc198    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 17 Oct 2016 12:13:16 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 17 Oct 2016 12:13:16 +0300    

Click here for diff

Have tuplesort_gettupleslot() copy the contents of its current table slot  
as needed. This is based on an approach taken by tuplestore_gettupleslot().  
In the future, tuplesort_gettupleslot() may also be taught to avoid copying  
the tuple where caller can determine that that is safe (the  
tuplestore_gettupleslot() interface already offers this option to callers).  
  
Patch by Peter Geoghegan. Fixes bug #14344, reported by Regina Obe.  
  
Report: <[email protected]>  
  
Backpatch-through: 9.6  

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

Replace PostmasterRandom() with a stronger way of generating randomness.

commit   : 9e083fd4683294f41544e6d0d72f6e258ff3a77c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 17 Oct 2016 11:52:50 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 17 Oct 2016 11:52:50 +0300    

Click here for diff

This adds a new routine, pg_strong_random() for generating random bytes,  
for use in both frontend and backend. At the moment, it's only used in  
the backend, but the upcoming SCRAM authentication patches need strong  
random numbers in libpq as well.  
  
pg_strong_random() is based on, and replaces, the existing implementation  
in pgcrypto. It can acquire strong random numbers from a number of sources,  
depending on what's available:  
- OpenSSL RAND_bytes(), if built with OpenSSL  
- On Windows, the native cryptographic functions are used  
- /dev/urandom  
- /dev/random  
  
Original patch by Magnus Hagander, with further work by Michael Paquier  
and me.  
  
Discussion: <CAB7nPqRy3krN8quR9XujMVVHYtXJ0_60nqgVc6oUk8ygyVkZsA@mail.gmail.com>  

M contrib/pgcrypto/Makefile
M contrib/pgcrypto/internal.c
D contrib/pgcrypto/random.c
M src/backend/libpq/auth.c
M src/backend/postmaster/postmaster.c
M src/include/port.h
M src/port/Makefile
A src/port/pg_strong_random.c
M src/tools/msvc/Mkvcbuild.pm

Use more efficient hashtable for execGrouping.c to speed up hash aggregation.

commit   : 5dfc198146b49ce7ecc8a1fc9d5e171fb75f6ba5    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 14 Oct 2016 17:22:51 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 14 Oct 2016 17:22:51 -0700    

Click here for diff

The more efficient hashtable speeds up hash-aggregations with more than  
a few hundred groups significantly. Improvements of over 120% have been  
measured.  
  
Due to the the different hash table queries that not fully  
determined (e.g. GROUP BY without ORDER BY) may change their result  
order.  
  
The conversion is largely straight-forward, except that, due to the  
static element types of simplehash.h type hashes, the additional data  
some users store in elements (e.g. the per-group working data for hash  
aggregaters) is now stored in TupleHashEntryData->additional.  The  
meaning of BuildTupleHashTable's entrysize (renamed to additionalsize)  
has been changed to only be about the additionally stored size.  That  
size is only used for the initial sizing of the hash-table.  
  
Reviewed-By: Tomas Vondra  
Discussion: <[email protected]>  

M src/backend/executor/execGrouping.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSubplan.c
M src/backend/optimizer/plan/planner.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/tools/pgindent/typedefs.list

Use more efficient hashtable for tidbitmap.c to speed up bitmap scans.

commit   : 75ae538bc3168bf44475240d4e0487ee2f3bb376    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 14 Oct 2016 16:05:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 14 Oct 2016 16:05:30 -0700    

Click here for diff

Use the new simplehash.h to speed up tidbitmap.c uses. For bitmap scan  
heavy queries speedups of over 100% have been measured. Both lossy and  
exact scans benefit, but the wins are bigger for mostly exact scans.  
  
The conversion is mostly trivial, except that tbm_lossify() now restarts  
lossifying at the point it previously stopped. Otherwise the hash table  
becomes unbalanced because the scan in done in hash-order, leaving the  
end of the hashtable more densely filled then the beginning. That caused  
performance issues with dynahash as well, but due to the open chaining  
they were less pronounced than with the linear adressing from  
simplehash.h.  
  
Reviewed-By: Tomas Vondra  
Discussion: <[email protected]>  

M src/backend/nodes/tidbitmap.c

Add a macro templatized hashtable.

commit   : b30d3ea824c5ccba43d3e942704f20686e7dbab8    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 14 Oct 2016 16:05:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 14 Oct 2016 16:05:30 -0700    

Click here for diff

dynahash.c hash tables aren't quite fast enough for some  
use-cases. There are several reasons for lacking performance:  
- the use of chaining for collision handling makes them cache  
  inefficient, that's especially an issue when the tables get bigger.  
- as the element sizes for dynahash are only determined at runtime,  
  offset computations are somewhat expensive  
- hash and element comparisons are indirect function calls, causing  
  unnecessary pipeline stalls  
- it's two level structure has some benefits (somewhat natural  
  partitioning), but increases the number of indirections  
to fix several of these the hash tables have to be adjusted to the  
individual use-case at compile-time. C unfortunately doesn't provide a  
good way to do compile code generation (like e.g. c++'s templates for  
all their weaknesses do).  Thus the somewhat ugly approach taken here is  
to allow for code generation using a macro-templatized header file,  
which generates functions and types based on a prefix and other  
parameters.  
  
Later patches use this infrastructure to use such hash tables for  
tidbitmap.c (bitmap scans) and execGrouping.c (hash aggregation,  
...). In queries where these use up a large fraction of the time, this  
has been measured to lead to performance improvements of over 100%.  
  
There are other cases where this could be useful (e.g. catcache.c).  
  
The hash table design chosen is a variant of linear open-addressing. The  
biggest disadvantage of simple linear addressing schemes are highly  
variable lookup times due to clustering, and deletions leaving a lot of  
tombstones around.  To address these issues a variant of "robin hood"  
hashing is employed.  Robin hood hashing optimizes chaining lengths by  
moving elements close to their optimal bucket ("rich" elements), out of  
the way if a to-be-inserted element is further away from its optimal  
position (i.e. it's "poor").  While that can make insertions slower, the  
average lookup performance is a lot better, and higher fill factors can  
be used in a still performant manner.  To avoid tombstones - which  
normally solve the issue that a deleted node's presence is relevant to  
determine whether a lookup needs to continue looking or is done -  
buckets following a deleted element are shifted backwards, unless  
they're empty or already at their optimal position.  
  
There's further possible improvements that can be made to this  
implementation. Amongst others:  
- Use distance as a termination criteria during searches. This is  
  generally a good idea, but I've been able to see the overhead of  
  distance calculations in some cases.  
- Consider combining the 'empty' status into the hashvalue, and enforce  
  storing the hashvalue. That could, in some cases, increase memory  
  density and remove a few instructions.  
- Experiment further with the, very conservatively choosen, fillfactor.  
- Make maximum size of hashtable configurable, to allow storing very  
  very large tables. That'd require 64bit hash values to be more common  
  than now, though.  
- some smaller memcpy calls could be optimized to copy larger chunks  
But since the new implementation is already considerably faster than  
dynahash it seem sensible to start using it.  
  
Reviewed-By: Tomas Vondra  
Discussion: <[email protected]>  

A src/include/lib/simplehash.h
M src/tools/pgindent/typedefs.list

Add likely/unlikely() branch hint macros.

commit   : aa3ca5e3dd60bf0b992b74f955378f28e601292a    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 14 Oct 2016 16:05:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 14 Oct 2016 16:05:30 -0700    

Click here for diff

These are useful for very hot code paths. Because it's easy to guess  
wrongly about likelihood, and because such likelihoods change over time,  
they should be used sparingly.  
  
Past tests have shown it'd be a good idea to use them in some places,  
e.g. in error checks around ereports that ERROR out, but that's work for  
later.  
  
Discussion: <[email protected]>  

M src/include/c.h

Fix assorted integer-overflow hazards in varbit.c.

commit   : 32fdf42cf546f613aab9ca98935c40a046187fa9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Oct 2016 16:28:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Oct 2016 16:28:34 -0400    

Click here for diff

bitshiftright() and bitshiftleft() would recursively call each other  
infinitely if the user passed INT_MIN for the shift amount, due to integer  
overflow in negating the shift amount.  To fix, clamp to -VARBITMAXLEN.  
That doesn't change the results since any shift distance larger than the  
input bit string's length produces an all-zeroes result.  
  
Also fix some places that seemed inadequately paranoid about input typmods  
exceeding VARBITMAXLEN.  While a typmod accepted by anybit_typmodin() will  
certainly be much less than that, at least some of these spots are  
reachable with user-chosen integer values.  
  
Andreas Seltenreich and Tom Lane  
  
Discussion: <[email protected]>  

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

Fix typo.

commit   : 13d3180fd14c624bbb274e200e98ddb50e260216    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Fri, 14 Oct 2016 09:03:25 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Fri, 14 Oct 2016 09:03:25 +0900    

Click here for diff

Confirmed by Michael Paquier.  

M doc/src/sgml/parallel.sgml

Fix handling of pgstat counters for TRUNCATE in a prepared transaction.

commit   : 81e82a2bd48865f9a294b63d9492f9fde6a32787    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Oct 2016 19:45:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Oct 2016 19:45:58 -0400    

Click here for diff

pgstat_twophase_postcommit is supposed to duplicate the math in  
AtEOXact_PgStat, but it had missed out the bit about clearing  
t_delta_live_tuples/t_delta_dead_tuples for a TRUNCATE.  
  
It's harder than you might think to replicate the issue here, because  
those counters would only be nonzero when a previous transaction in  
the same backend had added/deleted tuples in the truncated table,  
and those counts hadn't been sent to the stats collector yet.  
  
Evident oversight in commit d42358efb.  I've not added a regression  
test for this; we tried to add one in d42358efb, and had to revert it  
because it was too timing-sensitive for the buildfarm.  
  
Back-patch to 9.5 where d42358efb came in.  
  
Stas Kelvich  
  
Discussion: <[email protected]>  

M src/backend/postmaster/pgstat.c

Fix typo.

commit   : b1ee762a6138df073d4b2b80c235dd9025a8532c    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Fri, 14 Oct 2016 07:45:25 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Fri, 14 Oct 2016 07:45:25 +0900    

Click here for diff

Confirmed by Tom Lane.  

M doc/src/sgml/parallel.sgml

Fix another bug in merging of inherited CHECK constraints.

commit   : 3cca13cbfcc5312f7ae1728213e197c6f37ca62a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Oct 2016 17:05:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Oct 2016 17:05:14 -0400    

Click here for diff

It's not good for an inherited child constraint to be marked connoinherit;  
that would result in the constraint not propagating to grandchild tables,  
if any are created later.  The code mostly prevented this from happening  
but there was one case that was missed.  
  
This is somewhat related to commit e55a946a8, which also tightened checks  
on constraint merging.  Hence, back-patch to 9.2 like that one.  This isn't  
so much because there's a concrete feature-related reason to stop there,  
as to avoid having more distinct behaviors than we have to in this area.  
  
Amit Langote  
  
Discussion: <[email protected]>  

M src/backend/catalog/heap.c
M src/test/regress/expected/inherit.out
M src/test/regress/sql/inherit.sql

Remove dead code in pg_dump.

commit   : c08521eb55135c493cee23541c233870cdff14b7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Oct 2016 16:08:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Oct 2016 16:08:16 -0400    

Click here for diff

I'm not sure if this provision for "pg_backup" behaving a bit differently  
from "pg_dump" ever did anything useful in a released version.  But it's  
definitely dead code now.  
  
Michael Paquier  

M src/bin/pg_dump/pg_dump.c

Try to find out the actual hugepage size when making a MAP_HUGETLB request.

commit   : cb775768e3e37d466d69b7177a92508b81c1c204    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Oct 2016 15:06:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Oct 2016 15:06:46 -0400    

Click here for diff

Even if Linux's mmap() is okay with a partial-hugepage request, munmap()  
is not, as reported by Chris Richards.  Therefore it behooves us to try  
a bit harder to find out the actual hugepage size, instead of assuming  
that we can skate by with a guess.  
  
For the moment, just look into /proc/meminfo to find out the default  
hugepage size, and use that.  Later, on kernels that support requests  
for nondefault sizes, we might try to consider other alternatives.  
But that smells more like a new feature than a bug fix, especially if  
we want to provide any way for the DBA to control it, so leave it for  
another day.  
  
I set this up to allow easy addition of platform-specific code for  
non-Linux platforms, if needed; but right now there are no reports  
suggesting that we need to work harder on other platforms.  
  
Back-patch to 9.4 where hugepage support was introduced.  
  
Discussion: <[email protected]>  

M src/backend/port/sysv_shmem.c

Clean up handling of anonymous mmap'd shared-memory segment.

commit   : 15fc5e15811337f5a81d4ae44c6149256f6dd15f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Oct 2016 13:59:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Oct 2016 13:59:56 -0400    

Click here for diff

Fix detaching of the mmap'd segment to have its own on_shmem_exit callback,  
rather than piggybacking on the one for detaching from the SysV segment.  
That was confusing, and given the distance between the two attach calls,  
it was trouble waiting to happen.  
  
Make the detaching calls idempotent by clearing AnonymousShmem to show  
we've already unmapped.  I spent quite a bit of time yesterday trying  
to find a path that would allow the munmap()'s to be done twice, and  
while I did not succeed, it seems silly that there's even a question.  
  
Make the #ifdef logic less confusing by separating "do we want to use  
anonymous shmem" from EXEC_BACKEND.  Even though there's no current  
scenario where those conditions are different, it is not helpful for  
different places in the same file to be testing EXEC_BACKEND for what  
are fundamentally different reasons.  
  
Don't do on_exit_reset() in StartBackgroundWorker().  At best that's  
useless (InitPostmasterChild would have done it already) and at worst  
it could zap some callback that's unrelated to shared memory.  
  
Improve comments, and simplify the huge_pages enablement logic slightly.  
  
Back-patch to 9.4 where hugepage support was introduced.  
Arguably this should go into 9.3 as well, but the code looks  
significantly different there, and I doubt it's worth the  
trouble of adapting the patch given I can't show a live bug.  

M src/backend/port/sysv_shmem.c
M src/backend/postmaster/bgworker.c

Fix pg_dumpall regression test to be locale-independent.

commit   : 0a4bf6b192377bef8e69c92d0c95434a91509f12    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Oct 2016 10:46:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Oct 2016 10:46:22 -0400    

Click here for diff

The expected results in commit b4fc64578 seem to have been generated  
in a non-C locale, which just points up the fact that the ORDER BY  
clause was locale-sensitive.  
  
Per buildfarm.  

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

Fix broken jsonb_set() logic for replacing array elements.

commit   : 9c4cc9e2c75e84a8267396be5cccbfe25b8f63f6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Oct 2016 00:25:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Oct 2016 00:25:28 -0400    

Click here for diff

Commit 0b62fd036 did a fairly sloppy job of refactoring setPath()  
to support jsonb_insert() along with jsonb_set().  In its defense,  
though, there was no regression test case exercising the case of  
replacing an existing element in a jsonb array.  
  
Per bug #14366 from Peng Sun.  Back-patch to 9.6 where bug was introduced.  
  
Report: <[email protected]>  

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

Fix further hash table order dependent tests.

commit   : ccbb852cd6101e93976111676a90f1e5d9268951    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Oct 2016 18:31:45 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Oct 2016 18:31:45 -0700    

Click here for diff

Similar to 0137caf273, this makes contrib and pl tests less dependant on  
hash-table order.  After this commit, at least some order affecting  
changes to execGrouping.c don't result in regression test changes  
anymore.  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M src/pl/plpython/expected/plpython_spi.out
M src/pl/plpython/sql/plpython_spi.sql

Make pg_dumpall's database ACL query independent of hash table order.

commit   : b4fc645787cc7c614c0c97fc9fffacf2bdc6a388    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Oct 2016 18:29:57 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Oct 2016 18:29:57 -0700    

Click here for diff

Previously GRANT order on databases was not well defined, due to the use  
of EXCEPT without an ORDER BY.  Add an ORDER BY, adapt test output.  
  
I don't, at the moment, see reason to backpatch this.  

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

Remove spurious word.

commit   : 248776ea06c240ae4605e77369d66bcd7ae4f9e3    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 12 Oct 2016 17:01:19 -0700    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 12 Oct 2016 17:01:19 -0700    

Click here for diff

Tatsuo Ishii  

M doc/src/sgml/parallel.sgml

Revert addition of PGDLLEXPORT in PG_FUNCTION_INFO_V1 macro.

commit   : 4f52fd3c6d28a4380a5afc51ae6f774c91837a38    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Oct 2016 18:01:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Oct 2016 18:01:43 -0400    

Click here for diff

This turns out not to be as harmless as I thought: MSVC will complain  
if it sees an "extern" declaration without PGDLLEXPORT and then one with.  
(Seems fairly silly, given that this can be changed after the fact by the  
linker, but there you have it.)  Therefore, contrib modules that have  
extern's for V1 functions in header files are falling over in the  
buildfarm, since none of those externs are marked PGDLLEXPORT.  
  
We might or might not conclude that we're willing to plaster those  
declarations with PGDLLEXPORT in HEAD, but in any case there's no way we're  
going to ship this change in the back branches.  Third-party authors would  
not thank us for breaking their code in a minor release.  Hence, revert  
the addition of PGDLLEXPORT (but let's keep the extra info in the comment).  
If we do the other changes we can revert this commit in HEAD.  
  
Per buildfarm.  

M src/include/fmgr.h

pg_dump's getTypes() needn't retrieve typinput or typoutput anymore.

commit   : c0a3b211bcb790a8d76022cb2b3ffe9795aaf5e9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Oct 2016 15:11:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Oct 2016 15:11:31 -0400    

Click here for diff

Commit 64f3524e2 removed the stanza of code that examined these values.  
I failed to notice they were unnecessary because my compiler didn't  
warn about the un-read variables.  Noted by Peter Eisentraut.  

M src/bin/pg_dump/pg_dump.c

Remove unnecessary int2vector-specific hash function and equality operator.

commit   : 5c80642aa8de8393b08cd3cbf612b325cedd98dc    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Oct 2016 14:54:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Oct 2016 14:54:08 -0400    

Click here for diff

These functions were originally added in commit d8cedf67a to support  
use of int2vector columns as catcache lookup keys.  However, there are  
no catcaches that use such columns.  (Indeed I now think it must always  
have been dead code: a catcache with such a key column would need an  
underlying unique index on the column, but we've never had an int2vector  
btree opclass.)  
  
Getting rid of the int2vector-specific operator and function does not  
lose any functionality, because operations on int2vectors will now fall  
back to the generic anyarray support.  This avoids a wart that a btree  
index on an int2vector column (made using anyarray_ops) would fail to  
match equality searches, because int2vectoreq wasn't a member of the  
opclass.  We don't really care much about that, since int2vector is not  
meant as a type for users to use, but it's silly to have extra code and  
less functionality.  
  
If we ever do want a catcache to be indexed by an int2vector column,  
we'd need to put back full btree and hash opclasses for int2vector,  
comparable to the support for oidvector.  (The anyarray code can't be  
used at such a low level, because it needs to do catcache lookups.)  
But we'll deal with that if/when the need arises.  
  
Also worth noting is that removal of the hash int2vector_ops opclass will  
break any user-created hash indexes on int2vector columns.  While hash  
anyarray_ops would serve the same purpose, it would probably not compute  
the same hash values and thus wouldn't be on-disk-compatible.  Given that  
int2vector isn't a user-facing type and we're planning other incompatible  
changes in hash indexes for v10 anyway, this doesn't seem like something  
to worry about, but it's probably worth mentioning here.  
  
Amit Langote  
  
Discussion: <[email protected]>  

M src/backend/access/hash/hashfunc.c
M src/backend/utils/adt/int.c
M src/backend/utils/cache/catcache.c
M src/include/access/hash.h
M src/include/catalog/catversion.h
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_operator.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h

Provide DLLEXPORT markers for C functions via PG_FUNCTION_INFO_V1 macro.

commit   : 8518583cdb10340bab3464121629a1a9ec387afa    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Oct 2016 12:45:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Oct 2016 12:45:50 -0400    

Click here for diff

This isn't really necessary for our own code, because we use a .DEF file  
in MSVC builds (see gendef.pl), or --export-all-symbols in MinGW and  
Cygwin builds, to ensure that all global symbols in loadable modules  
will be exported on Windows.  However, third-party authors might use  
different build processes that need this marker, and it's harmless  
enough for our own builds.  
  
To some extent, this is an oversight in commit e7128e8db, so back-patch  
to 9.4 where that was added.  
  
Laurenz Albe  
  
Discussion: <A737B7A37273E048B164557ADEF4A58B539300BD@ntex2010a.host.magwien.gv.at>  

M src/include/fmgr.h

Remove pg_dump/pg_dumpall support for dumping from pre-8.0 servers.

commit   : 64f3524e2c8deebc02808aa5ebdfa17859473add    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Oct 2016 12:19:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Oct 2016 12:19:56 -0400    

Click here for diff

The need for dumping from such ancient servers has decreased to about nil  
in the field, so let's remove all the code that catered to it.  Aside  
from removing a lot of boilerplate variant queries, this allows us to not  
have to cope with servers that don't have (a) schemas or (b) pg_depend.  
That means we can get rid of assorted squishy code around that.  There  
may be some nonobvious additional simplifications possible, but this patch  
already removes about 1500 lines of code.  
  
I did not remove the ability for pg_restore to read custom-format archives  
generated by these old versions (and light testing says that that does  
still work).  If you have an old server, you probably also have a pg_dump  
that will work with it; but you have an old custom-format backup file,  
that might be all you have.  
  
It'd be possible at this point to remove fmtQualifiedId()'s version  
argument, but I refrained since that would affect code outside pg_dump.  
  
Discussion: <[email protected]>  

M doc/src/sgml/ref/pg_dump.sgml
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c

Fix copy-pasto in comment.

commit   : bb55dd6059dddf2cd44423da6a3f6946826953cf    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 12 Oct 2016 12:07:54 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 12 Oct 2016 12:07:54 +0300    

Click here for diff

Amit Langote  

M src/include/catalog/pg_cast.h

Simplify the code for logical tape read buffers.

commit   : b75f467b6eec0678452fd8d7f8d306e6df3a1076    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 12 Oct 2016 12:05:45 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 12 Oct 2016 12:05:45 +0300    

Click here for diff

Pass the buffer size as argument to LogicalTapeRewindForRead, rather than  
setting it earlier with the separate LogicTapeAssignReadBufferSize call.  
This way, the buffer size is set closer to where it's actually used, which  
makes the code easier to understand.  
  
This makes the calculation for how much memory to use for the buffers less  
precise. We now use the same amount of memory for every tape, rounded down  
to the nearest BLCKSZ boundary, instead of using one more block for some  
tapes, to get the total up to exact amount of memory available. That should  
be OK, merging isn't too sensitive to the exact amount of memory used.  
  
Reviewed by Peter Geoghegan  
  
Discussion: <[email protected]>  

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

Drop server support for FE/BE protocol version 1.0.

commit   : 2f1eaf87e868a1c42f2b159958623daa6a666de4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Oct 2016 12:19:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Oct 2016 12:19:18 -0400    

Click here for diff

While this isn't a lot of code, it's been essentially untestable for  
a very long time, because libpq doesn't support anything older than  
protocol 2.0, and has not since release 6.3.  There's no reason to  
believe any other client-side code still uses that protocol, either.  
  
Discussion: <[email protected]>  

M src/backend/access/common/printtup.c
M src/backend/commands/copy.c
M src/backend/tcop/dest.c
M src/backend/tcop/postgres.c
M src/include/libpq/pqcomm.h

Remove "sco" and "unixware" ports.

commit   : 2b860f52ed1b1784cdf3f03886805f5bf250ea74    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Oct 2016 11:26:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Oct 2016 11:26:04 -0400    

Click here for diff

SCO OpenServer and SCO UnixWare are more or less dead platforms.  
We have never had a buildfarm member testing the "sco" port, and  
the last "unixware" member was last heard from in 2012, so it's  
fair to doubt that the code even compiles anymore on either one.  
Remove both ports.  We can always undo this if someone shows up  
with an interest in maintaining and testing these platforms.  
  
Discussion: <[email protected]>  

M configure
M configure.in
M doc/src/sgml/Makefile
M doc/src/sgml/dfunc.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/runtime.sgml
M src/Makefile.global.in
M src/Makefile.shlib
M src/backend/libpq/pqcomm.c
D src/backend/port/dynloader/sco.c
D src/backend/port/dynloader/sco.h
D src/backend/port/dynloader/unixware.c
D src/backend/port/dynloader/unixware.h
D src/include/port/sco.h
D src/include/port/unixware.h
M src/include/storage/s_lock.h
D src/makefiles/Makefile.sco
D src/makefiles/Makefile.unixware
M src/port/getrusage.c
D src/template/sco
D src/template/unixware

Docs: grammatical fix.

commit   : c7e56811fa38cbc39efd6bdd4bb45f2f0444803e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Oct 2016 10:33:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Oct 2016 10:33:59 -0400    

Click here for diff

Fix poor grammar introduced in 741ccd501.  

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

Improve documentation for CREATE RECURSIVE VIEW.

commit   : e34318725ca5b274efd6f57ea7460e89f4dca9f9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Oct 2016 10:08:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Oct 2016 10:08:45 -0400    

Click here for diff

It was perhaps not entirely clear that internal self-references shouldn't  
be schema-qualified even if the view name is written with a schema.  
Spell it out.  
  
Discussion: <[email protected]>  

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

Update user docs for switch to POSIX semaphores.

commit   : 3d21f08bccd316c3850a1943c1ee1e381dab1588    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Oct 2016 15:11:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Oct 2016 15:11:33 -0400    

Click here for diff

Since commit ecb0d20a9 hasn't crashed and burned, here's the promised  
docs update for it.  
  
In addition to explaining that Linux and FreeBSD ports now use POSIX  
semaphores, I did some wordsmithing on pre-existing wording; in  
particular trying to clarify which SysV parameters need to be set with  
an eye to total usage across all applications.  

M doc/src/sgml/runtime.sgml

Make regression tests less dependent on hash table order.

commit   : 0137caf273f4297c4d36df3a542d7c0c853e75be    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 10 Oct 2016 13:41:57 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 10 Oct 2016 13:41:57 -0700    

Click here for diff

Upcoming changes to the hash table code used, among others, for grouping  
and set operations will change the output order for a few queries. To  
make it less likely that actual bugs are hidden between regression test  
ordering changes, and to make the tests robust against platform  
dependant ordering, add ORDER BYs guaranteeing the output order.  
  
As it's possible that some of the changes expose platform dependant  
ordering, push this earlier, to let the buildfarm shake out potentially  
unstable results.  
  
Discussion: <[email protected]>  

M src/test/regress/expected/matview.out
M src/test/regress/expected/psql.out
M src/test/regress/expected/tsrf.out
M src/test/regress/expected/union.out
M src/test/regress/expected/with.out
M src/test/regress/sql/matview.sql
M src/test/regress/sql/psql.sql
M src/test/regress/sql/tsrf.sql
M src/test/regress/sql/union.sql
M src/test/regress/sql/with.sql

In PQsendQueryStart(), avoid leaking any left-over async result.

commit   : 886f6c5ccdb500eeeec7e0abdf1500e20a304c45    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Oct 2016 10:35:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Oct 2016 10:35:58 -0400    

Click here for diff

Ordinarily there would not be an async result sitting around at this  
point, but it appears that in corner cases there can be.  Considering  
all the work we're about to launch, it's hardly going to cost anything  
noticeable to check.  
  
It's been like this forever, so back-patch to all supported branches.  
  
Report: <CAD-Qf1eLUtBOTPXyFQGW-4eEsop31tVVdZPu4kL9pbQ6tJPO8g@mail.gmail.com>  

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

Remove some unnecessary #includes.

commit   : 6fb12cbcd6f1a971e113d7d32cc7ee920db4e097    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 10 Oct 2016 12:22:58 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 10 Oct 2016 12:22:58 +0300    

Click here for diff

Amit Langote  

M src/backend/commands/aggregatecmds.c
M src/backend/commands/collationcmds.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/lockcmds.c

Add a noreturn attribute to help static analyzers

commit   : 52f0142eb4c755d1f4c390464769d35f21e998c3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 9 Oct 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 9 Oct 2016 12:00:00 -0400    

Click here for diff

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

Use unnamed POSIX semaphores, if available, on Linux and FreeBSD.

commit   : ecb0d20a9d2e09b7112d3b192047f711f9ff7e59    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Oct 2016 18:03:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Oct 2016 18:03:45 -0400    

Click here for diff

We've had support for using unnamed POSIX semaphores instead of System V  
semaphores for quite some time, but it was not used by default on any  
platform.  Since many systems have rather small limits on the number of  
SysV semaphores allowed, it seems desirable to switch to POSIX semaphores  
where they're available and don't create performance or kernel resource  
problems.  Experimentation by me shows that unnamed POSIX semaphores  
are at least as good as SysV semaphores on Linux, and we previously had  
a report from Maksym Sobolyev that FreeBSD is significantly worse with  
SysV semaphores than POSIX ones.  So adjust those two platforms to use  
unnamed POSIX semaphores, if configure can find the necessary library  
functions.  If this goes well, we may switch other platforms as well,  
but it would be advisable to test them individually first.  
  
It's not currently contemplated that we'd encourage users to select  
a semaphore API for themselves, but anyone who wants to experiment  
can add PREFERRED_SEMAPHORES=UNNAMED_POSIX (or NAMED_POSIX, or SYSV)  
to their configure command line to do so.  
  
I also tweaked configure to report which API it's selected, mainly  
so that we can tell that from buildfarm reports.  
  
I did not touch the user documentation's discussion about semaphores;  
that will need some adjustment once the dust settles.  
  
Discussion: <[email protected]>  

M configure
M configure.in
M src/template/freebsd
M src/template/linux

Fix incorrect handling of polymorphic aggregates used as window functions.

commit   : ac4a9d92fcb6869e757cc729dca2ca5ccf94b185    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Oct 2016 12:49:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Oct 2016 12:49:37 -0400    

Click here for diff

The transfunction was told that its first argument and result were  
of the window function output type, not the aggregate state type.  
This'd only matter if the transfunction consults get_fn_expr_argtype,  
which typically only polymorphic functions would do.  
  
Although we have several regression tests around polymorphic aggs,  
none of them detected this mistake --- in fact, they still didn't  
fail when I injected the same mistake into nodeAgg.c.  So add some  
more tests covering both plain agg and window-function-agg cases.  
  
Per report from Sebastian Luque.  Back-patch to 9.6 where the error  
was introduced (by sloppy refactoring in commit 804163bc2, looks like).  
  
Report: <[email protected]>  

M src/backend/executor/nodeWindowAgg.c
M src/test/regress/expected/polymorphism.out
M src/test/regress/sql/polymorphism.sql

Fix two bugs in merging of inherited CHECK constraints.

commit   : e55a946a81c6648c5ff3a0ccdda242f639e33c6f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 8 Oct 2016 19:29:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 8 Oct 2016 19:29:27 -0400    

Click here for diff

Historically, we've allowed users to add a CHECK constraint to a child  
table and then add an identical CHECK constraint to the parent.  This  
results in "merging" the two constraints so that the pre-existing  
child constraint ends up with both conislocal = true and coninhcount > 0.  
However, if you tried to do it in the other order, you got a duplicate  
constraint error.  This is problematic for pg_dump, which needs to issue  
separated ADD CONSTRAINT commands in some cases, but has no good way to  
ensure that the constraints will be added in the required order.  
And it's more than a bit arbitrary, too.  The goal of complaining about  
duplicated ADD CONSTRAINT commands can be served if we reject the case of  
adding a constraint when the existing one already has conislocal = true;  
but if it has conislocal = false, let's just make the ADD CONSTRAINT set  
conislocal = true.  In this way, either order of adding the constraints  
has the same end result.  
  
Another problem was that the code allowed creation of a parent constraint  
marked convalidated that is merged with a child constraint that is  
!convalidated.  In this case, an inheritance scan of the parent table could  
emit some rows violating the constraint condition, which would be an  
unexpected result given the marking of the parent constraint as validated.  
Hence, forbid merging of constraints in this case.  (Note: valid child and  
not-valid parent seems fine, so continue to allow that.)  
  
Per report from Benedikt Grundmann.  Back-patch to 9.2 where we introduced  
possibly-not-valid check constraints.  The second bug obviously doesn't  
apply before that, and I think the first doesn't either, because pg_dump  
only gets into this situation when dealing with not-valid constraints.  
  
Report: <CADbMkNPT-Jz5PRSQ4RbUASYAjocV_KHUWapR%2Bg8fNvhUAyRpxA%40mail.gmail.com>  
Discussion: <[email protected]>  

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

commit   : 8811f5d3a4a1ebf79ccb00da336d70041b003dd2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Oct 2016 21:12:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Oct 2016 21:12:25 -0400    

Click here for diff

The need for this was previously obscured even on picky platforms  
by the hack we used to support direct cross-module references in  
the transforms contrib modules.  Now that that hack is gone, the  
undefined symbol is exposed, as reported by Robert Haas.  
  
Back-patch to 9.5 where we started to use -Wl,-undefined,dynamic_lookup.  
I'm a bit surprised that the older branches don't seem to contain  
any gettext references in this module, but since they don't fail  
at build time, they must not.  (We might be able to get away with  
leaving this alone in 9.5/9.6, but I think it's cleaner if the  
reference gets resolved at link time.)  
  
Report: <CA+TgmoaHJKU5kcWZcYduATYVT7Mnx+8jUnycaYYL7OtCwCigug@mail.gmail.com>  

M src/backend/replication/libpqwalreceiver/Makefile

Fix fallback implementation of pg_atomic_write_u32().

commit   : b0779abb3add11d4dd745779dd81ea8ecdd00a1d    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Oct 2016 16:55:15 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Oct 2016 16:55:15 -0700    

Click here for diff

I somehow had assumed that in the spinlock (in turn possibly using  
semaphores) based fallback atomics implementation 32 bit writes could be  
done without a lock. As far as the write goes that's correct, since  
postgres supports only platforms with single-copy atomicity for aligned  
32bit writes.  But writing without holding the spinlock breaks  
read-modify-write operations like pg_atomic_compare_exchange_u32(),  
since they'll potentially "miss" a concurrent write, which can't happen  
in actual hardware implementations.  
  
In 9.6+ when using the fallback atomics implementation this could lead  
to buffer header locks not being properly marked as released, and  
potentially some related state corruption.  I don't see a related danger  
in 9.5 (earliest release with the API), because pg_atomic_write_u32()  
wasn't used in a concurrent manner there.  
  
The state variable of local buffers, before this change, were  
manipulated using pg_atomic_write_u32(), to avoid unnecessary  
synchronization overhead. As that'd not be the case anymore, introduce  
and use pg_atomic_unlocked_write_u32(), which does not correctly  
interact with RMW operations.  
  
This bug only caused issues when postgres is compiled on platforms  
without atomics support (i.e. no common new platform), or when compiled  
with --disable-atomics, which explains why this wasn't noticed in  
testing.  
  
Reported-By: Tom Lane  
Discussion: <[email protected]>  
Backpatch: 9.5-, where the atomic operations API was introduced.  

M src/backend/port/atomics.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/include/port/atomics.h
M src/include/port/atomics/fallback.h
M src/include/port/atomics/generic.h
M src/include/storage/buf_internals.h

Remove bogus mapping from UTF-8 to SJIS conversion table.

commit   : 0aec7f9aec8b828e074b8f2f3cbea2ec3e5c0209    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Oct 2016 23:56:42 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Oct 2016 23:56:42 +0300    

Click here for diff

0xc19c is not a valid UTF-8 byte sequence. It doesn't do any harm, AFAICS,  
but it's surely not intentional. No backpatching though, just to be sure.  
  
In the passing, also add a file header comment to the file, like the  
UCS_to_SJIS.pl script would produce. (The file was originally created with  
UCS_to_SJIS.pl, but has been modified by hand since then. That's  
questionable, but I'll leave fixing that for later.)  
  
Kyotaro Horiguchi  
  
Discussion: <[email protected]>  

M src/backend/utils/mb/Unicode/utf8_to_sjis.map

Make TAP test suites to work, when @INC does not contain current dir.

commit   : d668b03378c28b927d0ba458681ca1b4c1e18e53    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Oct 2016 21:48:21 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Oct 2016 21:48:21 +0300    

Click here for diff

Recent Perl and/or new Linux distributions are starting to remove "." from  
the @INC list by default. That breaks pg_rewind and ssl test suites, which  
use helper perl modules that reside in the same directory. To fix, add the  
current source directory explicitly to prove's include dir.  
  
The vcregress.pl script probably also needs something like this, but I  
wasn't able to remove '.' from @INC on Windows to test this, and don't want  
to try doing that blindly.  
  
Discussion: <[email protected]>  

M src/Makefile.global.in

Fix python shlib probe for Cygwin.

commit   : 17a3a1eb0efc5d84c81e46a26fe6bd21dbe90de9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Oct 2016 11:27:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Oct 2016 11:27:34 -0400    

Click here for diff

On buildfarm member cockatiel, that library is in /usr/bin.  
(Possibly we should look at $PATH on this platform?)  
Per off-list report from Andrew Dunstan.  

M config/python.m4
M configure

Fix pg_dump to work against pre-9.0 servers again.

commit   : 4806f26f9e4273888cbf85f42b3bdc5e9d950ba6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Oct 2016 09:51:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Oct 2016 09:51:18 -0400    

Click here for diff

getBlobs' queries for pre-9.0 servers were broken in two ways:  
the 7.x/8.x query uses DISTINCT so it can't have unspecified-type  
NULLs in the target list, and both that query and the 7.0 one  
failed to provide the correct output column labels, so that the  
subsequent code to extract data from the PGresult would fail.  
  
Back-patch to 9.6 where the breakage was introduced (by commit 23f34fa4b).  
  
Amit Langote and Tom Lane  
  
Discussion: <[email protected]>  

M src/bin/pg_dump/pg_dump.c

Don't allow both --source-server and --source-target args to pg_rewind.

commit   : 0d4d7d61850f4f4bc5f6fd0b7a9adb70232aed61    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Oct 2016 14:35:17 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Oct 2016 14:35:17 +0300    

Click here for diff

They are supposed to be mutually exclusive, but there was no check for  
that.  
  
Michael Banck  
  
Discussion: <[email protected]>  

M src/bin/pg_rewind/pg_rewind.c

Clear OpenSSL error queue after failed X509_STORE_load_locations() call.

commit   : 275bf98601b230e530003ef20193d095b9309c24    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Oct 2016 12:51:52 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Oct 2016 12:51:52 +0300    

Click here for diff

Leaving the error in the error queue used to be harmless, because the  
X509_STORE_load_locations() call used to be the last step in  
initialize_SSL(), and we would clear the queue before the next  
SSL_connect() call. But previous commit moved things around. The symptom  
was that if a CRL file was not found, and one of the subsequent  
initialization steps, like loading the client certificate or private key,  
failed, we would incorrectly print the "no such file" error message from  
the earlier X509_STORE_load_locations() call as the reason.  
  
Backpatch to all supported versions, like the previous patch.  

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

Don't share SSL_CTX between libpq connections.

commit   : 8bb14cdd33deecc6977cf5638f73e80f76ab658b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Oct 2016 12:20:39 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Oct 2016 12:20:39 +0300    

Click here for diff

There were several issues with the old coding:  
  
1. There was a race condition, if two threads opened a connection at the  
   same time. We used a mutex around SSL_CTX_* calls, but that was not  
   enough, e.g. if one thread SSL_CTX_load_verify_locations() with one  
   path, and another thread set it with a different path, before the first  
   thread got to establish the connection.  
  
2. Opening two different connections, with different sslrootcert settings,  
   seemed to fail outright with "SSL error: block type is not 01". Not sure  
   why.  
  
3. We created the SSL object, before calling SSL_CTX_load_verify_locations  
   and SSL_CTX_use_certificate_chain_file on the SSL context. That was  
   wrong, because the options set on the SSL context are propagated to the  
   SSL object, when the SSL object is created. If they are set after the  
   SSL object has already been created, they won't take effect until the  
   next connection. (This is bug #14329)  
  
At least some of these could've been fixed while still using a shared  
context, but it would've been more complicated and error-prone. To keep  
things simple, let's just use a separate SSL context for each connection,  
and accept the overhead.  
  
Backpatch to all supported versions.  
  
Report, analysis and test case by Kacper Zuk.  
  
Discussion: <[email protected]>  

M src/interfaces/libpq/fe-secure-openssl.c
M src/test/ssl/Makefile
M src/test/ssl/README
M src/test/ssl/ServerSetup.pm
A src/test/ssl/ssl/client+client_ca.crt
M src/test/ssl/t/001_ssltests.pl

Disable synchronous commits in pg_rewind.

commit   : d7eb76b908a3aac68c23c7d3553c65c80e92b823    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Oct 2016 13:24:46 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Oct 2016 13:24:46 +0300    

Click here for diff

If you point pg_rewind to a server that is using synchronous replication,  
with "pg_rewind --source-server=...", and the replication is not working  
for some reason, pg_rewind will get stuck because it creates a temporary  
table, which needs to be replicated. You could call broken replication a  
pilot error, but pg_rewind is often used in special circumstances, when  
there are changes to the replication setup.  
  
We don't do any "real" updates, and we don't care about fsyncing or  
replicating the operations on the temporary tables, so fix that by  
setting synchronous_commit off.  
  
Michael Banck, Michael Paquier. Backpatch to 9.5, where pg_rewind was  
introduced.  
  
Discussion: <[email protected]>  

M src/bin/pg_rewind/libpq_fetch.c

Fix excessive memory consumption in the new sort pre-reading code.

commit   : b56fb691b0033f9b86e0552bd5adfd485f05eef6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Oct 2016 09:46:40 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Oct 2016 09:46:40 +0300    

Click here for diff

LogicalTapeRewind() should not allocate large read buffer, if the tape  
is completely empty. The calling code relies on that, for its  
calculation of how much memory to allocate for the read buffers. That  
lead to massive overallocation of memory, if maxTapes was high, but  
only a few tapes were actually used.  
  
Reported by Tomas Vondra  
  
Discussion: <[email protected]>  

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

Remove -Wl,-undefined,dynamic_lookup in macOS build.

commit   : bfe2e847811a4d0a46c8cdf16195c0e5929b6f83    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Oct 2016 23:03:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Oct 2016 23:03:55 -0400    

Click here for diff

We don't need this anymore, and it prevents build-time error checking  
that's usually good to have, so remove it.  Undoes one change of commit  
cac765820.  
  
Unfortunately, it's much harder to get a similar effect on other common  
platforms, because we don't want the linker to throw errors for symbols  
that will be resolved in the core backend.  Only macOS and AIX expect the  
core backend executable to be available while linking loadable modules,  
so only these platforms can usefully throw errors for unresolved symbols  
at link time.  
  
Discussion: <[email protected]>  

M src/Makefile.shlib

Try to fix python shlib probe for MinGW.

commit   : 11c0e743b67acc9a0406b6058ed24de5e5527cf0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Oct 2016 22:47:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Oct 2016 22:47:23 -0400    

Click here for diff

Per discussion with Andrew Dunstan, it seems there are three peculiarities  
of the Python installation on MinGW (or at least, of the instance on  
buildfarm member frogmouth).  First, the library name doesn't contain  
"2.7" but just "27".  It looks like we can deal with that by consulting  
get_config_vars('VERSION') to see whether a dot should be used or not.  
Second, the library might be in c:/Windows/System32, analogously to it  
possibly being in /usr/lib on Unix-oid platforms.  Third, it's apparently  
not standard to use the prefix "lib" on the file name.  This patch will  
accept files with or without "lib", but the first part of that may well  
be dead code.  

M config/python.m4
M configure

Update obsolete comments and perldoc.

commit   : 61f9e7ba3c4e4bde887f980b9316fb818ede59b6    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 5 Oct 2016 13:08:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 5 Oct 2016 13:08:48 -0400    

Click here for diff

Loose ends from commit 2a0f89cd717ce6d49cdc47850577823682167e87.  
  
Daniel Gustafsson  

M src/test/perl/PostgresNode.pm

In python shlib probe, cater for OpenBSD, which omits the .so symlink.

commit   : ddd4f82cb6f65354776541dfac3bedf680e0e303    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Oct 2016 11:44:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Oct 2016 11:44:57 -0400    

Click here for diff

Most Unix-oid platforms provide a symlink "libfoo.so" -> "libfoo.so.n.n"  
to allow the linker to resolve a reference "-lfoo" to a version-numbered  
shared library.  OpenBSD has apparently hacked ld(1) to do this internally,  
because there are no such symlinks to be found in their library  
directories.  Tweak the new code in PGAC_CHECK_PYTHON_EMBED_SETUP to cope.  
Per buildfarm member curculio.  

M config/python.m4
M configure

Re-alphabetize #include directives.

commit   : eb3bc0bd1a68e30f09f36937da5aa5338b3b994c    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 5 Oct 2016 08:24:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 5 Oct 2016 08:24:25 -0400    

Click here for diff

Thomas Munro  

M src/backend/postmaster/bgworker.c

Rename WAIT_* constants to PG_WAIT_*.

commit   : d2ce38e204583bc444eebffd800d492cf56e3b38    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 5 Oct 2016 08:04:52 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 5 Oct 2016 08:04:52 -0400    

Click here for diff

Windows apparently has a constant named WAIT_TIMEOUT, and some of these  
other names are pretty generic, too.  Insert "PG_" at the front of each  
name in order to disambiguate.  
  
Michael Paquier  

M contrib/postgres_fdw/connection.c
M src/backend/postmaster/pgstat.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/proc.c
M src/include/pgstat.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/worker_spi/worker_spi.c

commit   : eda04886c1e048d695728206504ab4198462168e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Oct 2016 17:49:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Oct 2016 17:49:07 -0400    

Click here for diff

Just turning the crank on the project started in commit d51924be8.  
These cases turn out to be exact subsets of the boilerplate needed  
for hstore_plpython.  
  
Discussion: <[email protected]>  

M contrib/hstore_plperl/Makefile
M contrib/hstore_plperl/hstore_plperl–1.0.sql
M contrib/hstore_plperl/hstore_plperl.c
M contrib/hstore_plperl/hstore_plperlu–1.0.sql
M contrib/ltree_plpython/Makefile
M contrib/ltree_plpython/ltree_plpython.c
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 src/tools/msvc/Mkvcbuild.pm

Huh, we do need to look in $python_configdir for the Python shlib.

commit   : fc76259f5b8473dbd3d2009b0e4a267cf3a7e704    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Oct 2016 16:38:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Oct 2016 16:38:45 -0400    

Click here for diff

Debian does it that way, for no doubt what seems to them a good reason.  
Thanks to Aidan Van Dyk for confirmation.  

M config/python.m4
M configure

Improve (I hope) our autolocation of the Python shared library.

commit   : 46ddbbb1177a7e6ce5a4fe0ef8fa8ac49f36d0bb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Oct 2016 15:23:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Oct 2016 15:23:02 -0400    

Click here for diff

Older versions of Python produce garbage (or at least useless) values of  
get_config_vars('LDLIBRARY').  Newer versions produce garbage (or at least  
useless) values of get_config_vars('SO'), which was defeating our configure  
logic that attempted to identify where the Python shlib really is.  The net  
result, at least with a stock Python 3.5 installation on macOS, was that  
we were linking against a static library in the mistaken belief that it was  
a shared library.  This managed to work, if you count statically absorbing  
libpython into plpython.so as working.  But it no longer works as of commit  
d51924be8, because now we get separate static copies of libpython in  
plpython.so and hstore_plpython.so, and those can't interoperate on the  
same data.  There are some other infelicities like assuming that nobody  
ever installs a private version of Python on a macOS machine.  
  
Hence, forget about looking in $python_configdir for the Python shlib;  
as far as I can tell no version of Python has ever put one there, and  
certainly no currently-supported version does.  Also, rather than relying  
on get_config_vars('SO'), just try all the possibilities for shlib  
extensions.  Also, rather than trusting Py_ENABLE_SHARED, believe we've  
found a shlib only if it has a recognized extension.  Last, explicitly  
cope with the possibility that the shlib is really in /usr/lib and  
$python_libdir is a red herring --- this is the actual situation on older  
macOS, but we were only accidentally working with it.  
  
Discussion: <[email protected]>  

M config/python.m4
M configure
M configure.in

Fix another Windows compile break.

commit   : 6c9c95ed1b89add3a78d115a90e92d765b4c859a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 4 Oct 2016 13:14:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 4 Oct 2016 13:14:19 -0400    

Click here for diff

Commit 6f3bd98ebfc008cbd676da777bb0b2376c4c4bfa is still making  
the buildfarm unhappy.  This time it's mastodon that is complaining.  

M src/backend/postmaster/syslogger.c

Fix Windows compile break in 6f3bd98ebfc008cbd676da777bb0b2376c4c4bfa.

commit   : 9445d1121d28d0a8ae32c907320b5d6ff985077b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 4 Oct 2016 12:17:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 4 Oct 2016 12:17:14 -0400    

Click here for diff

M src/backend/postmaster/pgstat.c

Fix another outdated comment.

commit   : d4fca5e6c7363ba6ee4de7b8d72d68064fa864ca    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 4 Oct 2016 19:16:00 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 4 Oct 2016 19:16:00 +0300    

Click here for diff

Preloading is done by logtape.c now.  

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

Remove trailing commas from enums.

commit   : 23843dcb60f941786ab57fec804234bfadd5d17f    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 4 Oct 2016 11:49:09 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 4 Oct 2016 11:49:09 -0400    

Click here for diff

Buildfarm member mylodon doesn't like them.  Actually, I don't like  
them either, but I failed to notice these before pushing commit  
6f3bd98ebfc008cbd676da777bb0b2376c4c4bfa.  

M src/include/pgstat.h

Adjust worker_spi for 6f3bd98ebfc008cbd676da777bb0b2376c4c4bfa.

commit   : 976a1ce91008944121d0b9d2b84c9644c36f7fbb    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 4 Oct 2016 11:18:43 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 4 Oct 2016 11:18:43 -0400    

Click here for diff

M src/test/modules/worker_spi/worker_spi.c

Extend framework from commit 53be0b1ad to report latch waits.

commit   : 6f3bd98ebfc008cbd676da777bb0b2376c4c4bfa    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 4 Oct 2016 10:50:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 4 Oct 2016 10:50:13 -0400    

Click here for diff

WaitLatch, WaitLatchOrSocket, and WaitEventSetWait now taken an  
additional wait_event_info parameter; legal values are defined in  
pgstat.h.  This makes it possible to uniquely identify every point in  
the core code where we are waiting for a latch; extensions can pass  
WAIT_EXTENSION.  
  
Because latches were the major wait primitive not previously covered  
by this patch, it is now possible to see information in  
pg_stat_activity on a large number of important wait events not  
previously addressed, such as ClientRead, ClientWrite, and SyncRep.  
  
Unfortunately, many of the wait events added by this patch will fail  
to appear in pg_stat_activity because they're only used in background  
processes which don't currently appear in pg_stat_activity.  We should  
fix this either by creating a separate view for such information, or  
else by deciding to include them in pg_stat_activity after all.  
  
Michael Paquier and Robert Haas, reviewed by Alexander Korotkov and  
Thomas Munro.  

M contrib/postgres_fdw/connection.c
M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/parallel.c
M src/backend/access/transam/xlog.c
M src/backend/executor/nodeGather.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/pqmq.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/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/basebackup.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/latch.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/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/adt/misc.c
M src/include/pgstat.h
M src/include/storage/latch.h
M src/include/storage/lwlock.h
M src/include/storage/proc.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c

Fix hstore_plpython for Python 3.

commit   : 490ed1ebb9b26fb342a1e3240107092e9c5aec02    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Oct 2016 09:38:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Oct 2016 09:38:43 -0400    

Click here for diff

In commit d51924be8, I overlooked the need to provide linkage for  
PLyUnicode_FromStringAndSize, because that's only used (and indeed  
only exists) in Python 3 builds.  
  
In light of the need to #if this item, rearrange the ordering of  
the code related to each function pointer, so as not to need more  
#if's than absolutely necessary.  
  
Per buildfarm.  

M contrib/hstore_plpython/hstore_plpython.c

Update comment.

commit   : c86c2d9d57c1e6c5fec860873734cccaf31df5b0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 4 Oct 2016 09:46:43 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 4 Oct 2016 09:46:43 +0300    

Click here for diff

mergepreread()/mergeprereadone() don't exist anymore, the function that  
does roughly the same is now called mergereadnext().  

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

Correct logical decoding restore behaviour for subtransactions.

commit   : 61633f79048d040aefeed68dcac0e0b996a06189    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 3 Oct 2016 22:11:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 3 Oct 2016 22:11:36 -0700    

Click here for diff

Before initializing iteration over a subtransaction's changes, the last  
few changes were not spilled to disk. That's correct if the transaction  
didn't spill to disk, but otherwise... This bug can lead to missed or  
misorderd subtransaction contents when they were spilled to disk.  
  
Move spilling of the remaining in-memory changes to  
ReorderBufferIterTXNInit(), where it can easily be applied to the top  
transaction and, if present, subtransactions.  
  
Since this code had too many bugs already, noticeably increase test  
coverage.  
  
Fixes: #14319  
Reported-By: Huan Ruan  
Discussion: <[email protected]>  
Backport: 9,4-, where logical decoding was added  

M contrib/test_decoding/Makefile
A contrib/test_decoding/expected/spill.out
A contrib/test_decoding/sql/spill.sql
M src/backend/replication/logical/reorderbuffer.c

Convert contrib/hstore_plpython to not use direct linking to other modules.

commit   : d51924be886c2a05e691fa05b16cb6b30ab8370f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2016 22:27:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2016 22:27:11 -0400    

Click here for diff

Previously, on most platforms, we allowed hstore_plpython's references  
to hstore and plpython to be unresolved symbols at link time, trusting  
the dynamic linker to resolve them when the module is loaded.  This  
has a number of problems, the worst being that the dynamic linker  
does not know where the references come from and can do nothing but  
fail if those other modules haven't been loaded.  We've more or less  
gotten away with that for the limited use-case of datatype transform  
modules, but even there, it requires some awkward hacks, most recently  
commit 83c249200.  
  
Instead, let's not treat these references as linker-resolvable at all,  
but use function pointers that are manually filled in by the module's  
_PG_init function.  There are few enough contact points that this  
doesn't seem unmaintainable, at least for these use-cases.  (Note that  
the same technique wouldn't work at all for decoupling from libpython  
itself, but fortunately that's just a standard shared library and can  
be linked to normally.)  
  
This is an initial patch that just converts hstore_plpython.  If the  
buildfarm doesn't find any fatal problems, I'll work on the other  
transform modules soon.  
  
Tom Lane, per an idea of Andres Freund's.  
  
Discussion: <[email protected]>  

M contrib/hstore_plpython/Makefile
M contrib/hstore_plpython/hstore_plpython.c
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 src/tools/msvc/Mkvcbuild.pm

Show a sensible value in pg_settings.unit for GUC_UNIT_XSEGS variables.

commit   : 6bc811c992a804bdb8d228ce0be9f0a8e7198df6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2016 16:40:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2016 16:40:05 -0400    

Click here for diff

Commit 88e982302 invented GUC_UNIT_XSEGS for min_wal_size and max_wal_size,  
but neglected to make it display sensibly in pg_settings.unit (by adding a  
case to the switch in GetConfigOptionByNum).  Fix that, and adjust said  
switch to throw a run-time error the next time somebody forgets.  
  
In passing, avoid using a static buffer for the output string --- the rest  
of this function pstrdup's from a local buffer, and I see no very good  
reason why the units code should do it differently and less safely.  
  
Per report from Otar Shavadze.  Back-patch to 9.5 where the new unit type  
was added.  
  
Report: <CAG-jOyA=iNFhN+yB4vfvqh688B7Tr5SArbYcFUAjZi=0Exp-Lg@mail.gmail.com>  

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

Fix RLS with COPY (col1, col2) FROM tab

commit   : 814b9e9b8edf36cac65e0d8fcef17e50a04b1617    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 3 Oct 2016 16:22:57 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 3 Oct 2016 16:22:57 -0400    

Click here for diff

Attempting to COPY a subset of columns from a table with RLS enabled  
would fail due to an invalid query being constructed (using a single  
ColumnRef with the list of fields to exact in 'fields', but that's for  
the different levels of an indirection for a single column, not for  
specifying multiple columns).  
  
Correct by building a ColumnRef and then RestTarget for each column  
being requested and then adding those to the targetList for the select  
query.  Include regression tests to hopefully catch if this is broken  
again in the future.  
  
Patch-By: Adam Brightwell  
Reviewed-By: Michael Paquier  

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

Enforce a specific order for probing library loadability in pg_upgrade.

commit   : 83c2492002162bf79d2a0811bff5724e395909d7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2016 10:07:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2016 10:07:39 -0400    

Click here for diff

pg_upgrade checks whether all the shared libraries used in the old cluster  
are also available in the new one by issuing LOAD for each library name.  
Previously, it cared not what order it did the LOADs in.  Ideally it  
should not have to care, but currently the transform modules in contrib  
fail unless both the language and datatype modules they depend on are  
loaded first.  A backend-side solution for that looks possible but  
probably not back-patchable, so as a stopgap measure, let's do the LOAD  
tests in order by library name length.  That should fix the problem for  
reasonably-named transform modules, eg "hstore_plpython" will be loaded  
after both "hstore" and "plpython".  (Yeah, it's a hack.)  
  
In a larger sense, having a predictable order of these probes is a good  
thing, since it will make upgrades predictably work or not work in the  
face of inter-library dependencies.  Also, this patch replaces O(N^2)  
de-duplication logic with O(N log N) logic, which could matter in  
installations with very many databases.  So I don't foresee reverting this  
even after we have a proper fix for the library-dependency problem.  
  
In passing, improve a couple of SQL queries used here.  
  
Per complaint from Andrew Dunstan that pg_upgrade'ing the transform contrib  
modules failed.  Back-patch to 9.5 where transform modules were introduced.  
  
Discussion: <[email protected]>  

M src/bin/pg_upgrade/function.c

Change the way pre-reading in external sort's merge phase works.

commit   : e94568ecc10f2638e542ae34f2990b821bbf90ac    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Oct 2016 13:37:49 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Oct 2016 13:37:49 +0300    

Click here for diff

Don't pre-read tuples into SortTuple slots during merge. Instead, use the  
memory for larger read buffers in logtape.c. We're doing the same number  
of READTUP() calls either way, but managing the pre-read SortTuple slots  
is much more complicated. Also, the on-tape representation is more compact  
than SortTuples, so we can fit more pre-read tuples into the same amount  
of memory this way. And we have better cache-locality, when we use just a  
small number of SortTuple slots.  
  
Now that we only hold one tuple from each tape in the SortTuple slots, we  
can greatly simplify the "batch memory" management. We now maintain a  
small set of fixed-sized slots, to hold the tuples, and fall back to  
palloc() for larger tuples. We use this method during all merge phases,  
not just the final merge, and also when randomAccess is requested, and  
also in the TSS_SORTEDONTAPE case. In other words, it's used whenever we  
do an external sort.  
  
Reviewed by Peter Geoghegan and Claudio Freire.  
  
Discussion: <CAM3SWZTpaORV=yQGVCG8Q4axcZ3MvF-05xe39ZvORdU9JcD6hQ@mail.gmail.com>  

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

Add ALTER EXTENSION ADD/DROP ACCESS METHOD, and use it in pg_upgrade.

commit   : e8bdee2770ff52aab208bc6f8965a4a01979d0aa    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Oct 2016 14:31:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Oct 2016 14:31:28 -0400    

Click here for diff

Without this, an extension containing an access method is not properly  
dumped/restored during pg_upgrade --- the AM ends up not being a member  
of the extension after upgrading.  
  
Another oversight in commit 473b93287, reported by Andrew Dunstan.  
  
Report: <[email protected]>  

M doc/src/sgml/ref/alter_extension.sgml
M src/backend/parser/gram.y
M src/bin/pg_dump/pg_dump.c

Avoid leaking FDs after an fsync failure.

commit   : 728ceba938dfadb204a4854bb76ae3b11b635401    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Oct 2016 12:33:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Oct 2016 12:33:46 -0400    

Click here for diff

Fixes errors introduced in commit bc34223bc, as detected by Coverity.  
  
In passing, report ENOSPC for a short write while padding a new wal file in  
open_walfile, make certain that close_walfile closes walfile in all cases,  
and improve a couple of comments.  
  
Michael Paquier and Tom Lane  

M src/bin/pg_basebackup/receivelog.c
M src/common/file_utils.c

Do ClosePostmasterPorts() earlier in SubPostmasterMain().

commit   : 3b90e38c5d592ea8ec8236287dd5c749fc041728    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Oct 2016 17:15:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Oct 2016 17:15:09 -0400    

Click here for diff

In standard Unix builds, postmaster child processes do ClosePostmasterPorts  
immediately after InitPostmasterChild, that is almost immediately after  
being spawned.  This is important because we don't want children holding  
open the postmaster's end of the postmaster death watch pipe.  
  
However, in EXEC_BACKEND builds, SubPostmasterMain was postponing this  
responsibility significantly, in order to make it slightly more convenient  
to pass the right flag value to ClosePostmasterPorts.  This is bad,  
particularly seeing that process_shared_preload_libraries() might invoke  
nearly-arbitrary code.  Rearrange so that we do it as soon as we've  
fetched the socket FDs via read_backend_variables().  
  
Also move the comment explaining about randomize_va_space to before the  
call of PGSharedMemoryReAttach, which is where it's relevant.  The old  
placement was appropriate when the reattach happened inside  
CreateSharedMemoryAndSemaphores, but that was a long time ago.  
  
Back-patch to 9.3; the patch doesn't apply cleanly before that, and  
it doesn't seem worth a lot of effort given that we've had no actual  
field complaints traceable to this.  
  
Discussion: <[email protected]>  

M src/backend/postmaster/postmaster.c

Fix bugs in contrib/pg_visibility.

commit   : 9a109452da1b923e183f20fcf5516984d448ece9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Oct 2016 16:32:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Oct 2016 16:32:54 -0400    

Click here for diff

collect_corrupt_items() failed to initialize tuple.t_self.  While  
HeapTupleSatisfiesVacuum() doesn't actually use that value, it does  
Assert that it's valid, so that the code would dump core if ip_posid  
chanced to be zero.  (That's somewhat unlikely, which probably explains  
how this got missed.  In any case it wouldn't matter for field use.)  
  
Also, collect_corrupt_items was returning the wrong TIDs, that is the  
contents of t_ctid rather than the tuple's own location.  This would  
be the same thing in simple cases, but it could be wrong if, for  
example, a past update attempt had been rolled back, leaving a live  
tuple whose t_ctid doesn't point at itself.  
  
Also, in pg_visibility(), guard against trying to read a page past  
the end of the rel.  The VM code handles inquiries beyond the end  
of the map by silently returning zeroes, and it seems like we should  
do the same thing here.  
  
I ran into the assertion failure while using pg_visibility to check  
pg_upgrade's behavior, and then noted the other problems while  
reading the code.  
  
Report: <[email protected]>  

M contrib/pg_visibility/pg_visibility.c

Copy-editing for contrib/pg_visibility documentation.

commit   : 33596edf09516a7cab65914e16cfd6adf9fc55d1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Oct 2016 15:32:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Oct 2016 15:32:53 -0400    

Click here for diff

Add omitted names for some function parameters.  
Fix some minor grammatical issues.  

M doc/src/sgml/pgvisibility.sgml

Fix misstatement in comment in Makefile.shlib.

commit   : ea046f08d1bcee56c3bedfa16a05c38a0515b41d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Oct 2016 13:45:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Oct 2016 13:45:16 -0400    

Click here for diff

There is no need for "all: all-lib" to be placed before inclusion of  
Makefile.shlib.  Makefile.global is what ensures that "all" is the  
default target, and we already document that that has to be included  
first.  Per comment from Pavel Raiskup.  
  
Discussion: <[email protected]>  

M src/Makefile.shlib

Fix misplacement of submake-generated-headers prerequisites.

commit   : 7107d58ec5a3c45967e77525809612a5f89b97f3    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Oct 2016 13:35:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Oct 2016 13:35:13 -0400    

Click here for diff

The sequence "configure; cd src/pl/plpython; make -j" failed due to  
trying to compile plpython's .o files before the generated headers  
finished building.  (This is an important real-world case, since it's  
the typical second step when building both plpython2 and plpython3.)  
This happens because the submake-generated-headers target is not  
placed in a way to make it a prerequisite to compiling the .o files.  
Fix that.  
  
Checking other uses of submake-generated-headers, I noted that the one  
attached to pg_regress was similarly misplaced; but it's actually not  
needed at all for pg_regress.o, rather regress.o, so move it to be a  
prerequisite of that.  
  
Back-patch to 9.6 where submake-generated-headers was introduced  
(by commit 548af97fc).  It's not immediately clear to me why the  
previous coding didn't have the same issue; but since we've not  
had field reports of plpython make failing, leave it alone in the  
older branches.  
  
Pavel Raiskup and Tom Lane  
  
Discussion: <[email protected]>  

M src/pl/plpython/Makefile
M src/test/regress/GNUmakefile

Set log_line_prefix and application name in test drivers

commit   : a4327296df7366ecc657b706a9b5e87aa921311a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Sep 2016 12:00:00 -0400    

Click here for diff

Before pg_regress runs psql, set the application name to the test name.  
Similarly, set the application name to the test file name in the TAP  
tests.  Also, set a default log_line_prefix that show the application  
name, as well as the PID and a time stamp.  
  
That way, the server log output can be correlated to the test input  
files, making debugging a bit easier.  

M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress_main.c

Improve error reporting in pg_upgrade's file copying/linking/rewriting.

commit   : f002ed2b8e45286fe73a36e119cba2016ea0de19    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Sep 2016 20:40:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Sep 2016 20:40:27 -0400    

Click here for diff

The previous design for this had copyFile(), linkFile(), and  
rewriteVisibilityMap() returning strerror strings, with the caller  
producing one-size-fits-all error messages based on that.  This made it  
impossible to produce messages that described the failures with any degree  
of precision, especially not short-read problems since those don't set  
errno at all.  
  
Since pg_upgrade has no intention of continuing after any error in this  
area, let's fix this by just letting these functions call pg_fatal() for  
themselves, making it easy for each point of failure to have a suitable  
error message.  Taking this approach also allows dropping cleanup code  
that was unnecessary and was often rather sloppy about preserving errno.  
To not lose relevant info that was reported before, pass in the schema name  
and table name of the current table so that they can be included in the  
error reports.  
  
An additional problem was the use of getErrorText(), which was flat out  
wrong for all but a couple of call sites, because it unconditionally did  
"_dosmaperr(GetLastError())" on Windows.  That's only appropriate when  
reporting an error from a Windows-native API, which only a couple of  
the callers were actually doing.  Thus, even the reported strerror string  
would be unrelated to the actual failure in many cases on Windows.  
To fix, get rid of getErrorText() altogether, and just have call sites  
do strerror(errno) instead, since that's the way all the rest of our  
frontend programs do it.  Add back the _dosmaperr() calls in the two  
places where that's actually appropriate.  
  
In passing, make assorted messages hew more closely to project style  
guidelines, notably by removing initial capitals in not-complete-sentence  
primary error messages.  (I didn't make any effort to clean up places  
I didn't have another reason to touch, though.)  
  
Per discussion of a report from Thomas Kellerer.  Back-patch to 9.6,  
but no further; given the relative infrequency of reports of problems  
here, it's not clear it's worth adapting the patch to older branches.  
  
Patch by me, but with credit to Alvaro Herrera for spotting the issue  
with getErrorText's misuse of _dosmaperr().  
  
Discussion: <[email protected]>  

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

Fix multiple portability issues in pg_upgrade's rewriteVisibilityMap().

commit   : 5afcd2aa740f87fa6cec7c6693a4891b9df2b67d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Sep 2016 20:39:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Sep 2016 20:39:00 -0400    

Click here for diff

This is new code in 9.6, and evidently we missed out testing it as  
thoroughly as it should have been.  Bugs fixed here:  
  
1. Use binary not text mode to open the files on Windows.  Before, if  
the visibility map chanced to contain two bytes that looked like \r\n,  
Windows' read() would convert that to \n, which both corrupts the map  
data and causes the file to look shorter than it should.  Unless you  
were *very* unlucky and had an exact multiple of 8K such occurrences  
in each VM file, this would cause pg_upgrade to report a failure,  
though with a rather obscure error message.  
  
2. The code for copying rebuilt bytes into the output was simply wrong.  
It chanced to work okay on little-endian machines but would emit the  
bytes in the wrong order on big-endian, leading to silent corruption  
of the visibility map data.  
  
3. The code was careless about alignment of the working buffers.  Given  
all three of an alignment-picky architecture, a compiler that chooses  
to put the new_vmbuf[] local variable at an odd starting address, and  
a checksum-enabled database, pg_upgrade would dump core.  
  
Point one was reported by Thomas Kellerer, the other two detected by  
code-reading.  
  
Point two is much the nastiest of these issues from an impact standpoint,  
though fortunately it affects only a minority of users.  The Windows issue  
will definitely bite people, but it seems quite unlikely that there would  
be undetected corruption from that.  
  
In addition, I failed to resist the temptation to do some minor cosmetic  
adjustments, mostly improving the comments.  
  
It would be a good idea to try to improve the error reporting here, but  
that seems like material for a separate patch.  
  
Discussion: <[email protected]>  

M src/bin/pg_upgrade/file.c

Fix breakage in previous change

commit   : cd03890d0b5d9cbcfca169195d71f1693f84cafa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Sep 2016 12:00:00 -0400    

Click here for diff

M src/include/utils/jsonb.h

Separate enum from struct

commit   : 330b48b94b53bcbbc490f952d6798d5ab637721a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Sep 2016 12:00:00 -0400    

Click here for diff

Otherwise the enum symbols are not visible outside the struct in C++.  
  
Reviewed-by: Thomas Munro <[email protected]>  

M src/include/utils/jsonb.h

Remove unnecessary prototypes

commit   : 0665023b4435a469e42289d7065c436967a022b6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 30 Aug 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 30 Aug 2016 12:00:00 -0400    

Click here for diff

Prototypes for functions implementing V1-callable functions are no  
longer necessary.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  

M contrib/bloom/bloom.h
M contrib/btree_gist/btree_gist.h
M contrib/dblink/dblink.h
M contrib/isn/isn.h
M contrib/pgcrypto/pgcrypto.h
M contrib/tablefunc/tablefunc.h

Add missing include files to configure tests

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

Click here for diff

atoi() needs stdlib.h  
strcmp() needs string.h  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  

M config/c-library.m4
M configure

Use return instead of exit() in configure

commit   : 1c0cf52b39ca3a9a79661129cff918dc000a55eb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 30 Aug 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 30 Aug 2016 12:00:00 -0400    

Click here for diff

Using exit() requires stdlib.h, which is not included.  Use return  
instead.  Also add return type for main().  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  

M config/c-compiler.m4
M config/c-library.m4
M configure

Fix use of offsetof()

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

Click here for diff

Using offsetof() with a run-time computed argument is not allowed in  
either C or C++.  Apparently, gcc allows it, but g++ doesn't.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  

M contrib/bloom/blutils.c

Retry opening new segments in pg_xlogdump --folllow

commit   : 3d39244e6e7374febff59eba338f7a82f696a618    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 30 Sep 2016 11:19:30 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 30 Sep 2016 11:19:30 +0200    

Click here for diff

There is a small window between when the server closes out the existing  
segment and the new one is created. Put a loop around the open call in  
this case to make sure we wait for the new file to actually appear.  

M src/bin/pg_xlogdump/pg_xlogdump.c

Remove superuser checks in pgstattuple

commit   : fd321a1dfd64d30bf1652ea6b39b654304f68ae4    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 29 Sep 2016 22:13:38 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 29 Sep 2016 22:13:38 -0400    

Click here for diff

Now that we track initial privileges on extension objects and changes to  
those permissions, we can drop the superuser() checks from the various  
functions which are part of the pgstattuple extension and rely on the  
GRANT system to control access to those functions.  
  
Since a pg_upgrade will preserve the version of the extension which  
existed prior to the upgrade, we can't simply modify the existing  
functions but instead need to create new functions which remove the  
checks and update the SQL-level functions to use the new functions  
(and to REVOKE EXECUTE rights on those functions from PUBLIC).  
  
Thanks to Tom and Andres for adding support for extensions to follow  
update paths (see: 40b449a), allowing this patch to be much smaller  
since no new base version script needed to be included.  
  
Approach suggested by Noah.  
  
Reviewed by Michael Paquier.  

M contrib/pgstattuple/Makefile
M contrib/pgstattuple/pgstatapprox.c
M contrib/pgstattuple/pgstatindex.c
A contrib/pgstattuple/pgstattuple–1.4–1.5.sql
M contrib/pgstattuple/pgstattuple.c
M contrib/pgstattuple/pgstattuple.control
M doc/src/sgml/pgstattuple.sgml

Fix compiler warnings

commit   : f2af8dc5ba8801c126d877a52076d441cac78646    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 29 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Sep 2016 12:00:00 -0400    

Click here for diff

This was missed in bf5bb2e85b6492c7245b9446efaf43d52a98db13, because the  
code is only visible under PG_FLUSH_DATA_WORKS.  

M src/common/file_utils.c

Allow contrib/file_fdw to read from a program, like COPY FROM PROGRAM.

commit   : 8e91e12bc3af85ba2287866669268f6825d2cc03    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Sep 2016 13:32:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Sep 2016 13:32:27 -0400    

Click here for diff

This patch just exposes COPY's FROM PROGRAM option in contrib/file_fdw.  
There don't seem to be any security issues with that that are any worse  
than what already exist with file_fdw and COPY; as in the existing cases,  
only superusers are allowed to control what gets executed.  
  
A regression test case might be nice here, but choosing a 100% portable  
command to run is hard.  (We haven't got a test for COPY FROM PROGRAM  
itself, either.)  
  
Corey Huinker and Adam Gomaa, reviewed by Amit Langote  
  
Discussion: <CADkLM=dGDGmaEiZ=UDepzumWg-CVn7r8MHPjr2NArj8S3TsROQ@mail.gmail.com>  

M contrib/file_fdw/file_fdw.c
M contrib/file_fdw/output/file_fdw.source
M doc/src/sgml/file-fdw.sgml

Switch pg_basebackup commands in Postgres.pm to use --nosync

commit   : 728a3e73e96173bb0b0b2afc0da061991f9e3d5d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 29 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Sep 2016 12:00:00 -0400    

Click here for diff

On slow machines, this greatly reduces the I/O pressure induced by the  
tests.  
  
From: Michael Paquier <[email protected]>  

M src/test/perl/PostgresNode.pm

pg_basebackup: Add --nosync option

commit   : 6ed2d8584cc680a2d6898480de74a57cd96176b5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 29 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Sep 2016 12:00:00 -0400    

Click here for diff

This is useful for testing, similar to initdb's --nosync.  
  
From: 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/pg_receivexlog.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h

pg_basebackup pg_receivexlog: Issue fsync more carefully

commit   : bc34223bc1e2c51dff2007b3d3bd492a09b5a491    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 29 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Sep 2016 12:00:00 -0400    

Click here for diff

Several places weren't careful about fsyncing in the way.  See 1d4a0ab1  
and 606e0f98 for details about required fsyncs.  
  
This adds a couple of functions in src/common/ that have an equivalent  
in the backend: durable_rename(), fsync_parent_path()  
  
From: Michael Paquier <[email protected]>  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/receivelog.c
M src/common/file_utils.c
M src/include/common/file_utils.h

Move fsync routines of initdb into src/common/

commit   : bf5bb2e85b6492c7245b9446efaf43d52a98db13    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 29 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Sep 2016 12:00:00 -0400    

Click here for diff

The intention is to used those in other utilities such as pg_basebackup  
and pg_receivexlog.  
  
From: Michael Paquier <[email protected]>  

M src/bin/initdb/initdb.c
M src/bin/initdb/nls.mk
M src/bin/pg_basebackup/nls.mk
M src/common/Makefile
A src/common/file_utils.c
A src/include/common/file_utils.h
M src/tools/msvc/Mkvcbuild.pm

Don't bother to lock bufmgr partitions in pg_buffercache.

commit   : 6e654546fb61f62cc982d0c8f62241b3b30e7ef8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 29 Sep 2016 13:16:30 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 29 Sep 2016 13:16:30 +0300    

Click here for diff

That makes the view a lot less disruptive to use on a production system.  
Without the locks, you don't get a consistent snapshot across all buffers,  
but that's OK. It wasn't a very useful guarantee in practice.  
  
Ivan Kartyshov, reviewed by Tomas Vondra and Robert Haas.  
  
Discusssion: <[email protected]>  

M contrib/pg_buffercache/pg_buffercache_pages.c

Exclude additional directories in pg_basebackup

commit   : 6ad8ac6026287e3ccbc4d606b6ab6116ccc0eec8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Sep 2016 12:00:00 -0400    

Click here for diff

The list of files and directories that pg_basebackup excludes from the  
backup was somewhat incomplete and unorganized.  Change that with having  
the exclusion driven from tables.  Clean up some code around it.  Also  
document the exclusions in more detail so that users of pg_start_backup  
can make use of it as well.  
  
The contents of these directories are now excluded from the backup:  
pg_dynshmem, pg_notify, pg_serial, pg_snapshots, pg_subtrans  
  
Also fix a bug that a pg_repl_slot or pg_stat_tmp being a symlink would  
cause a corrupt tar header to be created.  Now such symlinks are  
included in the backup as empty directories.  Bug found by Ashutosh  
Sharma <[email protected]>.  
  
From: David Steele <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/backup.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/replication/basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Silence compiler warnings

commit   : b82d5a2c7c9dd1a01041feef2834db27a46fb2d3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 28 Sep 2016 19:31:58 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 28 Sep 2016 19:31:58 -0300    

Click here for diff

Reported by Peter Eisentraut.  Coding suggested by Tom Lane.  

M src/backend/catalog/objectaddress.c

Rationalize format-picture caching logic in formatting.c.

commit   : 83bed06be4e808f3da30f99b6c91e9efda3961ad    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Sep 2016 17:08:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Sep 2016 17:08:40 -0400    

Click here for diff

Add a validity flag to DCHCacheEntry and NUMCacheEntry entries, and  
do not set it true until after we've parsed the supplied format string.  
This allows dealing with possible errors while parsing the format  
without the baroque hack that was there before (which only covered  
errors within NUMDesc_prepare, anyway).  We can get rid of the PG_TRY in  
NUMDesc_prepare, as well as last_NUMCacheEntry and NUM_cache_remove.  
(Essentially, this reverts commit ff783fbae in favor of a less fragile  
solution; the problems with that approach are well illustrated by later  
hacking such as 55f927a46.)  
  
In passing, define the size of these caches as DCH_CACHE_ENTRIES not  
DCH_CACHE_FIELDS + 1 (whoever thought that was a good definition?)  
and likewise for the NUM cache.  Also const-ify format string parameters  
where convenient, and merge duplicated cache lookup logic.  
  
This is primarily driven by a proposed patch from Artur Zakirov,  
which introduced some ereport's into format string parsing for  
the datetime case.  He proposed preventing the creation of invalid  
cache entries by parsing the format string first into a local-variable  
array, and then copying that to a cache entry.  That seemed a bit  
ugly to me, and anyway randomly different from the way the identical  
problem had been solved for the numeric case.  Let's make the two  
sets of code more similar not less so.  
  
I'm not sure whether we'll adopt the new error conditions Artur proposes,  
but this patch seems like good code cleanup and future-proofing in any  
case.  The existing code is critically (and undocumented-ly) dependent on  
no elog being thrown out of several nontrivial functions, which is trouble  
waiting to happen, though it doesn't seem to be actively broken today.  
  
Discussion: <[email protected]>  

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

Make to_timestamp() and to_date() range-check fields of their input.

commit   : d3cd36a133d96ad5578b6c10279b55fd5b538093    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Sep 2016 14:36:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Sep 2016 14:36:04 -0400    

Click here for diff

Historically, something like to_date('2009-06-40','YYYY-MM-DD') would  
return '2009-07-10' because there was no prohibition on out-of-range  
month or day numbers.  This has been widely panned, and it also turns  
out that Oracle throws an error in such cases.  Since these functions  
are nominally Oracle-compatibility features, let's change that.  
  
There's no particular restriction on year (modulo the fact that the  
scanner may not believe that more than 4 digits are year digits,  
a matter to be addressed separately if at all).  But we now check month,  
day, hour, minute, second, and fractional-second fields, as well as  
day-of-year and second-of-day fields if those are used.  
  
Currently, no checks are made on ISO-8601-style week numbers or day  
numbers; it's not very clear what the appropriate rules would be there,  
and they're probably so little used that it's not worth sweating over.  
  
Artur Zakirov, reviewed by Amul Sul, further adjustments by me  
  
Discussion: <[email protected]>  
See-Also: <[email protected]>  

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

Remove dead line of code

commit   : 967ed9205bfcd89c1dde1e85735b32b404721399    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Sep 2016 12:00:00 -0400    

Click here for diff

M src/backend/commands/alter.c

worker_spi: Call pgstat_report_stat.

commit   : 4929704acb3b4cdde8e890af977cdacaf1ac2ccb    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Sep 2016 12:38:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Sep 2016 12:38:33 -0400    

Click here for diff

Without this, statistics changes accumulated by the worker never get  
reported to the stats collector, which is bad.  
  
Julien Rouhaud  

M src/test/modules/worker_spi/worker_spi.c

Fix CRC check handling in get_controlfile

commit   : e79e6c4da152154544913b38354b98d07b65e411    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Sep 2016 12:00:00 -0400    

Click here for diff

The previous patch broke this by returning NULL for a failed CRC check,  
which pg_controldata would then try to read.  Fix by returning the  
result of the CRC check in a separate argument.  
  
Michael Paquier and myself  

M src/backend/utils/misc/pg_controldata.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_ctl/pg_ctl.c
M src/common/controldata_utils.c
M src/include/common/controldata_utils.h

Fix dangling pointer problem in ReorderBufferSerializeChange.

commit   : 308985b0b404a5891a1a629f38cc46c2b2dcb4be    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Sep 2016 11:19:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Sep 2016 11:19:46 -0400    

Click here for diff

Commit 3fe3511d05127cc024b221040db2eeb352e7d716 introduced a new  
case into this function, but neglected to ensure that the "ondisk"  
pointer got updated after a possible reallocation as the code does  
in other cases.  
  
Stas Kelvich, per diagnosis by Konstantin Knizhnik.  

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

Turn password_encryption GUC into an enum.

commit   : babe05bc2b781eb3eb84a18d7010d08277e2e399    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Sep 2016 12:22:44 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Sep 2016 12:22:44 +0300    

Click here for diff

This makes the parameter easier to extend, to support other password-based  
authentication protocols than MD5. (SCRAM is being worked on.)  
  
The GUC still accepts on/off as aliases for "md5" and "plain", although  
we may want to remove those once we actually add support for another  
password hash type.  
  
Michael Paquier, reviewed by David Steele, with some further edits by me.  
  
Discussion: <CAB7nPqSMXU35g=W9X74HVeQp0uvgJxvYOuA4A-A3M+0wfEBv-w@mail.gmail.com>  

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

Disallow pushing volatile quals past set-returning functions.

commit   : 72daabc7a3e75788df862104b8f723513c2471ae    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Sep 2016 18:43:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Sep 2016 18:43:36 -0400    

Click here for diff

Pushing an upper-level restriction clause into an unflattened  
subquery-in-FROM is okay when the subquery contains no SRFs in its  
targetlist, or when it does but the SRFs are unreferenced by the clause  
*and the clause is not volatile*.  Otherwise, we're changing the number  
of times the clause is evaluated, which is bad for volatile quals, and  
possibly changing the result, since a volatile qual might succeed for some  
SRF output rows and not others despite not referencing any of the changing  
columns.  (Indeed, if the clause is something like "random() > 0.5", the  
user is probably expecting exactly that behavior.)  
  
We had most of these restrictions down, but not the one about the upper  
clause not being volatile.  Fix that, and add a regression test to  
illustrate the expected behavior.  
  
Although this is definitely a bug, it doesn't seem like back-patch  
material, since possibly some users don't realize that the broken  
behavior is broken and are relying on what happens now.  Also, while  
the added test is quite cheap in the wake of commit a4c35ea1c, it would  
be much more expensive (or else messier) in older branches.  
  
Per report from Tom van Tilburg.  
  
Discussion: <CAP3PPDiucxYCNev52=YPVkrQAPVF1C5PFWnrQPT7iMzO1fiKFQ@mail.gmail.com>  

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

Make struct ParallelSlot private within pg_dump/parallel.c.

commit   : 0109ab27609c0d58c1eddc6b799077d0968083de    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Sep 2016 14:29:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Sep 2016 14:29:12 -0400    

Click here for diff

The only field of this struct that other files have any need to touch  
is the pointer to the TocEntry a worker is working on.  (Well,  
pg_backup_archiver.c is actually looking at workerStatus too, but that  
can be finessed by specifying that the TocEntry pointer is NULL for a  
non-busy worker.)  
  
Hence, move out the TocEntry pointers to a separate array within  
struct ParallelState, and then we can make struct ParallelSlot private.  
  
I noted the possibility of this previously, but hadn't got round to  
actually doing it.  
  
Discussion: <[email protected]>  

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

Rationalize parallel dump/restore's handling of worker cmd/status messages.

commit   : fb03d08a89e81a68585f17fd8e7f21c618f4e851    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Sep 2016 13:56:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Sep 2016 13:56:04 -0400    

Click here for diff

The existing APIs for creating and parsing command and status messages are  
rather messy; for example, archive-format modules have to provide code  
for constructing command messages, which is entirely pointless since  
the code to read them is hard-wired in WaitForCommands() and hence  
no format-specific variation is actually possible.  But there's little  
foreseeable reason to need format-specific variation anyway.  
  
The situation for status messages is no better; at least those are both  
constructed and parsed by format-specific code, but said code is quite  
redundant since there's no actual need for format-specific variation.  
  
To add insult to injury, the first API involves returning pointers to  
static buffers, which is bad, while the second involves returning pointers  
to malloc'd strings, which is safer but randomly inconsistent.  
  
Hence, get rid of the MasterStartParallelItem and MasterEndParallelItem  
APIs, and instead write centralized functions that construct and parse  
command and status messages.  If we ever do need more flexibility, these  
functions can be the standard implementations of format-specific  
callback methods, but that's a long way off if it ever happens.  
  
Tom Lane, reviewed by Kevin Grittner  
  
Discussion: <[email protected]>  

M src/bin/pg_dump/parallel.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_tar.c

Redesign parallel dump/restore's wait-for-workers logic.

commit   : b7b8cc0cfcf1c956b752f3e25894f9ad607583b7    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Sep 2016 13:22:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Sep 2016 13:22:39 -0400    

Click here for diff

The ListenToWorkers/ReapWorkerStatus APIs were messy and hard to use.  
Instead, make DispatchJobForTocEntry register a callback function that  
will take care of state cleanup, doing whatever had been done by the caller  
of ReapWorkerStatus in the old design.  (This callback is essentially just  
the old mark_work_done function in the restore case, and a trivial test for  
worker failure in the dump case.)  Then we can have ListenToWorkers call  
the callback immediately on receipt of a status message, and return the  
worker to WRKR_IDLE state; so the WRKR_FINISHED state goes away.  
  
This allows us to design a unified wait-for-worker-messages loop:  
WaitForWorkers replaces EnsureIdleWorker and EnsureWorkersFinished as well  
as the mess in restore_toc_entries_parallel.  Also, we no longer need the  
fragile API spec that the caller of DispatchJobForTocEntry is responsible  
for ensuring there's an idle worker, since DispatchJobForTocEntry can just  
wait until there is one.  
  
In passing, I got rid of the ParallelArgs struct, which was a net negative  
in terms of notational verboseness, and didn't seem to be providing any  
noticeable amount of abstraction either.  
  
Tom Lane, reviewed by Kevin Grittner  
  
Discussion: <[email protected]>  

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_custom.c
M src/bin/pg_dump/pg_backup_directory.c

Improve contrib/cube's handling of zero-D cubes, infinities, and NaNs.

commit   : f31a931fade868d788ef4480c59753a2d5059246    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Sep 2016 11:38:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Sep 2016 11:38:33 -0400    

Click here for diff

It's always been possible to create a zero-dimensional cube by converting  
from a zero-length float8 array, but cube_in failed to accept the '()'  
representation that cube_out produced for that case, resulting in a  
dump/reload hazard.  Make it accept the case.  Also fix a couple of  
other places that didn't behave sanely for zero-dimensional cubes:  
cube_size would produce 1.0 when surely the answer should be 0.0,  
and g_cube_distance risked a divide-by-zero failure.  
  
Likewise, it's always been possible to create cubes containing float8  
infinity or NaN coordinate values, but cube_in couldn't parse such input,  
and cube_out produced platform-dependent spellings of the values.  Convert  
them to use float8in_internal and float8out_internal so that the behavior  
will be the same as for float8, as we recently did for the core geometric  
types (cf commit 50861cd68).  As in that commit, I don't pretend that this  
patch fixes all insane corner-case behaviors that may exist for NaNs, but  
it's a step forward.  
  
(This change allows removal of the separate cube_1.out and cube_3.out  
expected-files, as the platform dependency that previously required them  
is now gone: an underflowing coordinate value will now produce an error  
not plus or minus zero.)  
  
Make errors from cube_in follow project conventions as to spelling  
("invalid input syntax for cube" not "bad cube representation")  
and errcode (INVALID_TEXT_REPRESENTATION not SYNTAX_ERROR).  
  
Also a few marginal code cleanups and comment improvements.  
  
Tom Lane, reviewed by Amul Sul  
  
Discussion: <[email protected]>  

M contrib/cube/cube.c
M contrib/cube/cubedata.h
M contrib/cube/cubeparse.y
M contrib/cube/cubescan.l
M contrib/cube/expected/cube.out
D contrib/cube/expected/cube_1.out
M contrib/cube/expected/cube_2.out
D contrib/cube/expected/cube_3.out
M contrib/cube/sql/cube.sql

Include <sys/select.h> where needed

commit   : 51c3e9fade76c12e4aa37bffdf800bbf74fb3fb1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Sep 2016 01:05:21 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Sep 2016 01:05:21 -0300    

Click here for diff

<sys/select.h> is required by POSIX.1-2001 to get the prototype of  
select(2), but nearly no systems enforce that because older standards  
let you get away with including some other headers.  Recent OpenBSD  
hacking has removed that frail touch of friendliness, however, which  
broke some compiles; fix all the way back to 9.1 by adding the required  
standard.  Only vacuumdb.c was reported to fail, but it seems easier to  
fix the whole lot in a fell swoop.  
  
Per bug #14334 by Sean Farrell.  

M src/backend/libpq/auth.c
M src/backend/postmaster/pgstat.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_dump/parallel.c
M src/bin/scripts/vacuumdb.c
M src/port/pgsleep.c
M src/test/examples/testlibpq2.c

Fix some typos in comment

commit   : 440c8d1bbc8c62d225ab7c3e30e0a7db2639cd0f    
  
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

M src/include/access/hash.h

Fix newly-introduced issues in pgbench.

commit   : 9779bda86c026e645773a3308f9169c7c0791f7c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2016 20:23:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2016 20:23:50 -0400    

Click here for diff

The result of FD_ISSET() doesn't necessarily fit in a bool, though  
assigning it to one might accidentally work depending on platform and which  
socket FD number is being inquired of.  Rewrite to test it with if(),  
rather than making any specific assumption about the result width,  
to match the way every other such call in PG is written.  
  
Don't break out of the input_mask-filling loop after finding the first  
client that we're waiting for results from.  That mostly breaks parallel  
query management.  
  
Also, if we choose not to call select(), be sure to clear out any bits  
the mask-filling loop might have set, so that we don't accidentally call  
doCustom for clients we don't know have input.  Doing so would likely  
be harmless, but it's a waste of cycles and doesn't seem to be intended.  
  
Make this_usec wide enough.  (Yeah, the value would usually fit in an  
int, but then why are we using int64 everywhere else?)  
  
Minor cosmetic adjustments, mostly comment improvements.  
  
Problems introduced by commit 12788ae49.  The first issue was discovered  
by buildfarm testing, the others by code review.  

M src/bin/pgbench/pgbench.c

Replace the built-in GIN array opclasses with a single polymorphic opclass.

commit   : fdc9186f7ed1ead827509584f3b763f8dc332c43    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2016 14:52:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2016 14:52:44 -0400    

Click here for diff

We had thirty different GIN array opclasses sharing the same operators and  
support functions.  That still didn't cover all the built-in types, nor  
did it cover arrays of extension-added types.  What we want is a single  
polymorphic opclass for "anyarray".  There were two missing features needed  
to make this possible:  
  
1. We have to be able to declare the index storage type as ANYELEMENT  
when the opclass is declared to index ANYARRAY.  This just takes a few  
more lines in index_create().  Although this currently seems of use only  
for GIN, there's no reason to make index_create() restrict it to that.  
  
2. We have to be able to identify the proper GIN compare function for  
the index storage type.  This patch proceeds by making the compare function  
optional in GIN opclass definitions, and specifying that the default btree  
comparison function for the index storage type will be looked up when the  
opclass omits it.  Again, that seems pretty generically useful.  
  
Since the comparison function lookup is done in initGinState(), making  
use of the second feature adds an additional cache lookup to GIN index  
access setup.  It seems unlikely that that would be very noticeable given  
the other costs involved, but maybe at some point we should consider  
making GinState data persist longer than it now does --- we could keep it  
in the index relcache entry, perhaps.  
  
Rather fortuitously, we don't seem to need to do anything to get this  
change to play nice with dump/reload or pg_upgrade scenarios: the new  
opclass definition is automatically selected to replace existing index  
definitions, and the on-disk data remains compatible.  Also, if a user has  
created a custom opclass definition for a non-builtin type, this doesn't  
break that, since CREATE INDEX will prefer an exact match to opcintype  
over a match to ANYARRAY.  However, if there's anyone out there with  
handwritten DDL that explicitly specifies _bool_ops or one of the other  
replaced opclass names, they'll need to adjust that.  
  
Tom Lane, reviewed by Enrique Meneses  
  
Discussion: <[email protected]>  

M doc/src/sgml/gin.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/ref/create_opclass.sgml
M doc/src/sgml/xindex.sgml
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvalidate.c
M src/backend/catalog/index.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_opclass.h

Document has_type_privilege().

commit   : a4afb2b5c0b409bb175c20104b2ae9d47cf71be6    
  
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

Refactor script execution state machine in pgbench.

commit   : 12788ae49e1933f463bc59a6efe46c4a01701b76    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 26 Sep 2016 10:56:02 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 26 Sep 2016 10:56:02 +0300    

Click here for diff

The doCustom() function had grown into quite a mess. Rewrite it, in a more  
explicit state machine style, for readability.  
  
This also fixes one minor bug: if a script consisted entirely of meta  
commands, doCustom() never returned to the caller, so progress reports  
with the -P option were not printed. I don't want to backpatch this  
refactoring, and the bug is quite insignificant, so only commit this to  
master, and leave the bug unfixed in back-branches.  
  
Review and original bug report by Fabien Coelho.  
  
Discussion: <alpine.DEB.2.20.1607090850120.3412@sto>  

M src/bin/pgbench/pgbench.c

Refer to OS X as "macOS", except for the port name which is still "darwin".

commit   : da6c4f6ca88df346573bdada2aa2544510bf167e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Sep 2016 15:40:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Sep 2016 15:40:57 -0400    

Click here for diff

We weren't terribly consistent about whether to call Apple's OS "OS X"  
or "Mac OS X", and the former is probably confusing to people who aren't  
Apple users.  Now that Apple has rebranded it "macOS", follow their lead  
to establish a consistent naming pattern.  Also, avoid the use of the  
ancient project name "Darwin", except as the port code name which does not  
seem desirable to change.  (In short, this patch touches documentation and  
comments, but no actual code.)  
  
I didn't touch contrib/start-scripts/osx/, either.  I suspect those are  
obsolete and due for a rewrite, anyway.  
  
I dithered about whether to apply this edit to old release notes, but  
those were responsible for quite a lot of the inconsistencies, so I ended  
up changing them too.  Anyway, Apple's being ahistorical about this,  
so why shouldn't we be?  

M config/c-library.m4
M configure
M configure.in
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/dfunc.sgml
M doc/src/sgml/docguide.sgml
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/release-7.4.sgml
M doc/src/sgml/release-8.0.sgml
M doc/src/sgml/release-8.1.sgml
M doc/src/sgml/release-8.2.sgml
M doc/src/sgml/release-8.3.sgml
M doc/src/sgml/release-8.4.sgml
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
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/release-old.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/uuid-ossp.sgml
M doc/src/sgml/wal.sgml
M src/Makefile.shlib
M src/backend/Makefile
M src/backend/port/dynloader/darwin.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/probes.d
M src/bin/psql/input.c
M src/include/port/darwin.h
M src/interfaces/libpq/fe-connect.c
M src/port/README
M src/port/chklocale.c
M src/template/darwin
M src/test/regress/pg_regress.c
M src/tools/find_typedef

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

commit   : 98c2d3332b30006ff71add99bc9d619c9457e71f    
  
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   : c3a0818460a8f4a5e1a9109b035ac30e84b7e06f    
  
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   : 5a7bae0699657315b487896810a30bd7425f6a08    
  
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   : 12f6eadffd075e39570a0170f6791de0b96ddfde    
  
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   : 959ea7fa76120449efa5d85ae351abd1d6e5480c    
  
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   : 8e6b4ee21f486e6800aaa6955ff3d98e1a521b49    
  
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   : 49a91b88e6c4afb840745c78942dd99ce125a6d6    
  
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

pg_ctl: Add promote wait option to help output

commit   : 6fa51c79c7a645248a63205ce17af98ed404790d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Sep 2016 12:00:00 -0400    

Click here for diff

pointed out by Masahiko Sawada <[email protected]>  

M src/bin/pg_ctl/pg_ctl.c

Improve error message on MSVC if perl*.lib is not found.

commit   : 3c2d5d6600de388729c7d613962d524352b7a67f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 23 Sep 2016 14:21:59 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 23 Sep 2016 14:21:59 +0300    

Click here for diff

John Harvey, reviewed by Michael Paquier  
  
Discussion: <CABcP5fjEjgOsh097cWnQrsK9yCswo4DZxp-V47DKCH-MxY9Gig@mail.gmail.com>  

M src/tools/msvc/Mkvcbuild.pm

Fix typo in comment.

commit   : 674e2de64d66b3a1e261bf07825be54c7cd2f3f6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 23 Sep 2016 08:04:19 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 23 Sep 2016 08:04:19 +0300    

Click here for diff

Daniel Gustafsson  

M src/interfaces/libpq/libpq-int.h

C comment: fix function header comment

commit   : 1ff0042165cf835d1b6a2ab2c3b84c201eb6577b    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 22 Sep 2016 17:34:21 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 22 Sep 2016 17:34:21 -0400    

Click here for diff

Fix for transformOnConflictClause().  
  
Author: Tomonari Katsumata  

M src/backend/parser/analyze.c

Remove nearly-unused SizeOfIptrData macro.

commit   : 8023b5827fbada6815ce269db4f3373ac77ec7c3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Sep 2016 14:30:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Sep 2016 14:30:33 -0400    

Click here for diff

Past refactorings have removed all but one reference to SizeOfIptrData  
(and that one place was in a pretty noncritical spot).  Since nobody's  
complained, it seems probable that there are no supported compilers  
that don't think sizeof(ItemPointerData) is 6.  If there are, we're  
wasting MAXALIGN per heap tuple anyway, so it's rather silly to worry  
about whether we can shave space in places like WAL records.  
  
Pavan Deolasee  
  
Discussion: <CABOikdOOawDda4hwLOT6zdA6MFfPLu3Z2YBZkX0JdayNS6JOeQ@mail.gmail.com>  

M src/backend/executor/nodeTidscan.c
M src/include/storage/itemptr.h

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

commit   : 96dd77d349424f270d129f8f40e75f762ddcca7d    
  
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 tests for various connection string issues

commit   : 8b845520fb0aa50fea7aae44a45cee1b6d87845d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Aug 2016 14:44:23 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Aug 2016 14:44:23 -0400    

Click here for diff

Add tests for consistent support of connection strings in frontend  
programs as well as proper handling of unusual characters in database  
and user names.  These tests were developed for the issues of  
CVE-2016-5424.  
  
To allow testing of names with spaces, change the pg_regress  
command-line options --create-role and --dbname to split their arguments  
by comma only, not space or comma as before.  Only commas were actually  
used in existing uses.  
  
Noah Misch, Michael Paquier, Peter Eisentraut  

A src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_rewind/RewindTest.pm
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/100_vacuumdb.pl
A src/bin/scripts/t/200_connstr.pl
M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm
M src/test/regress/pg_regress.c

pg_ctl: Add wait option to promote action

commit   : e7010ce4794a4c12a6a8bfb0ca1de49b61046847    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 5 Aug 2016 21:35:19 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 5 Aug 2016 21:35:19 -0400    

Click here for diff

When waiting is selected for the promote action, look into pg_control  
until the state changes, then use the PQping-based waiting until the  
server is reachable.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/ref/pg_ctl-ref.sgml
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_ctl/t/003_promote.pl

Delay updating control file to "in production"

commit   : ebdf5bf7d1c97a926e2b0cb6523344c2643623c7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Jul 2016 12:08:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Jul 2016 12:08:49 -0400    

Click here for diff

Move the updating of the control file to "in production" status until  
the point where WAL writes are allowed.  Before, there could be a  
significant gap between the control file update and write transactions  
actually being allowed.  This makes it more reliable to use the control  
status to verify the end of a promotion.  
  
From: Michael Paquier <[email protected]>  

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

pg_ctl: Detect current standby state from pg_control

commit   : c1dc51d4844e2a37412b034c07c1c5a439ba0b9d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Jul 2016 11:23:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Jul 2016 11:23:43 -0400    

Click here for diff

pg_ctl used to determine whether a server was in standby mode by looking  
for a recovery.conf file.  With this change, it instead looks into  
pg_control, which is potentially more accurate.  There are also  
occasional discussions about removing recovery.conf, so this removes one  
dependency.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/utils/misc/pg_controldata.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_ctl/pg_ctl.c
M src/common/controldata_utils.c
M src/include/common/controldata_utils.h

pg_ctl: Add tests for promote action

commit   : eb5089a05ba0852cc3eafea53c5d23e7633fca81    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Jul 2016 10:48:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Jul 2016 10:48:43 -0400    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  

A src/bin/pg_ctl/t/003_promote.pl
M src/test/perl/TestLib.pm

Make command_like output more compact

commit   : e767db2242079b4ec2a7bbd18da7649d9ee1d696    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Jul 2016 11:39:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Jul 2016 11:39:43 -0400    

Click here for diff

Consistently print the test name, not the full command, which can be  
quite lenghty and include temporary directory names and other  
distracting details.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/test/perl/TestLib.pm

Fix typo

commit   : c91b34bab19bdc4fca4de37cd37c8a4e79dae4d0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Sep 2016 12:00:00 -0400    

Click here for diff

From: Michael Paquier <[email protected]>  

M src/include/pgstat.h

Add more parallel query documentation.

commit   : 60270e5e00850ee8cc34296e38d0000415c8b152    
  
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   : 2a7f4f76434d82eb0d1b5f4f7051043e1dd3ee1a    
  
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   : 65c65563842cc99fb1c349211581a62dc728eee2    
  
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

pg_restore: Add -N option to exclude schemas

commit   : 46b55e7f853dc0ef60ae3b1042b883fa4ffac95f    
  
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

This is similar to the -N option in pg_dump, except that it doesn't take  
a pattern, just like the existing -n option in pg_restore.  
  
From: Michael Banck <[email protected]>  

M doc/src/sgml/ref/pg_restore.sgml
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_restore.c

doc: Fix documentation to match actual make output

commit   : 16d1adb35cf887325b7c5dbf473632d557065171    
  
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   : 4f6494cfd26c1dfe708c4598c11eea5fce168fd1    
  
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   : 90c9648212f7c3f0838fdaafe006ed40556a1364    
  
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   : 470d886c32efafa1b068b5ca48afafc2198c68d4    
  
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   : 419113dfdc4c729f6c763cc30a9b02ee68a7da94    
  
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   : 45310221a9afccd98e78813459472370ade9dc4c    
  
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   : 40c3fe4980e73acb0db75a3c737a4a52e09d4cf4    
  
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

Remove obsolete warning from docs.

commit   : 6cc54f38a9fe1f4103c45a9858804d1d5d4de0fd    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 19 Sep 2016 21:56:16 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 19 Sep 2016 21:56:16 +0300    

Click here for diff

Python 2.4 and Fedora 4 are both obsolete at this point, especially  
unpatched debug builds.  
  
Discussion: <[email protected]>  

M doc/src/sgml/plpython.sgml

MSVC: Include pg_recvlogical in client-only install.

commit   : 8614b39bca8fc64b1128c7911424647c9a1d1da1    
  
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   : 2c8f0d6e53e5dbcf28ee127303b81a6e12942665    
  
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   : 3fcc98c990ede7d3b415cc06eb6664aac6e7bbbc    
  
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

Add debugging aid "bmsToString(Bitmapset *bms)".

commit   : d8c61c9765339351409f06bbf964dcb8c1929e8b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Sep 2016 09:36:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Sep 2016 09:36:19 -0400    

Click here for diff

This function has no direct callers at present, but it's convenient for  
manual use in a debugger, rather than having to inspect memory and do  
bit-counting in your head.  
  
In passing, get rid of useless outBitmapset() wrapper around  
_outBitmapset(); let's just export the function that does the work.  
Likewise for outToken().  
  
Ashutosh Bapat, tweaked a bit by me  
  
Discussion: <CAFjFpRdiht8e1HTVirbubr4YzaON5iZTzFJjq909y4sU8M_6eA@mail.gmail.com>  

M src/backend/nodes/outfuncs.c
M src/include/nodes/nodes.h

Clarify policy on marking inherited constraints as valid.

commit   : 5225c66336a1e4b46925e9f169086fc70f49736f    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 15 Sep 2016 17:24:54 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 15 Sep 2016 17:24:54 -0400    

Click here for diff

Amit Langote and Robert Haas  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c

Fix building with LibreSSL.

commit   : 5c6df67e0c961f68e73e7c1e6312211ed59da00a    
  
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

Fix typo in comment.

commit   : ffccee473682ed18a27d667b7a4f45d802dd61c4    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 15 Sep 2016 11:35:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 15 Sep 2016 11:35:57 -0400    

Click here for diff

Amit Langote  

M src/backend/executor/execIndexing.c

Make min_parallel_relation_size's default value platform-independent.

commit   : 5472ed3e9bc23eff0b4e457fe564ac667cb69441    
  
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   : 8a503526e455b981718c2d24bd1630fd5b4cf7ac    
  
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   : 593d4e47db7af1a3a5dd6b6b1971f181b5566dbd    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 15 Sep 2016 12:36:21 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 15 Sep 2016 12:36:21 +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 all supported branches, per popular demand. 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/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   : c99dd5bfed23d9787dcf7d00197c1ed42bcfdb02    
  
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

Add overflow checks to money type input function

commit   : 656df624c0d7b50e1714f2a3a14e143e63799a80    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Sep 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Sep 2016 12:00:00 -0400    

Click here for diff

The money type input function did not have any overflow checks at all.  
There were some regression tests that purported to check for overflow,  
but they actually checked for the overflow behavior of the int8 type  
before casting to money.  Remove those unnecessary checks and add some  
that actually check the money input function.  
  
Reviewed-by: Fabien COELHO <[email protected]>  

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

Tweak targetlist-SRF tests some more.

commit   : 0dac5b5174bde3d6fb4b444a2aa4ca1f0091e258    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Sep 2016 19:48:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Sep 2016 19:48:42 -0400    

Click here for diff

Seems like it would be good to have a test case documenting the  
existing behavior for non-top-level SRFs.  

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

Improve code comment for GatherPath's single_copy flag.

commit   : 6415ba502bdc540e21f122d4c6c87d4a35f8ec27    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 14 Sep 2016 15:43:26 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 14 Sep 2016 15:43:26 -0400    

Click here for diff

Discussion: [email protected]  

M src/include/nodes/relation.h

Tweak targetlist-SRF tests.

commit   : a163c006ca3e6026546ee0f6c487a0dcfc66f82b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Sep 2016 14:30:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Sep 2016 14:30:40 -0400    

Click here for diff

Add a test case showing that we don't support SRFs in window-function  
arguments.  Remove a duplicate test case for SRFs in aggregate arguments.  

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

Be pickier about converting between Name and Datum.

commit   : 55c3391d1e6a201b5b891781d21fe682a8c64fe6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Sep 2016 17:17:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Sep 2016 17:17:48 -0400    

Click here for diff

We were misapplying NameGetDatum() to plain C strings in some places.  
This worked, because it was just a pointer cast anyway, but it's a type  
cheat in some sense.  Use CStringGetDatum instead, and modify the  
NameGetDatum macro so it won't compile if applied to something that's  
not a pointer to NameData.  This should result in no changes to  
generated code, but it is logically cleaner.  
  
Mark Dilger, tweaked a bit by me  
  
Discussion: <[email protected]>  

M src/backend/commands/dbcommands.c
M src/backend/commands/proclang.c
M src/backend/commands/typecmds.c
M src/include/postgres.h

Fix executor/README to reflect disallowing SRFs in UPDATE.

commit   : fdc79e1909dc3866a385ffb74bdd6ce6a082a300    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Sep 2016 14:25:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Sep 2016 14:25:35 -0400    

Click here for diff

The parenthetical comment here is obsoleted by commit a4c35ea1c.  
Noted by Andres Freund.  

M src/backend/executor/README

Improve parser's and planner's handling of set-returning functions.

commit   : a4c35ea1c2f05dd5b56739fcd0dc36a4870ea0c0    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Sep 2016 13:54:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Sep 2016 13:54:24 -0400    

Click here for diff

Teach the parser to reject misplaced set-returning functions during parse  
analysis using p_expr_kind, in much the same way as we do for aggregates  
and window functions (cf commit eaccfded9).  While this isn't complete  
(it misses nesting-based restrictions), it's much better than the previous  
error reporting for such cases, and it allows elimination of assorted  
ad-hoc expression_returns_set() error checks.  We could add nesting checks  
later if it seems important to catch all cases at parse time.  
  
There is one case the parser will now throw error for although previous  
versions allowed it, which is SRFs in the tlist of an UPDATE.  That never  
behaved sensibly (since it's ill-defined which generated row should be  
used to perform the update) and it's hard to see why it should not be  
treated as an error.  It's a release-note-worthy change though.  
  
Also, add a new Query field hasTargetSRFs reporting whether there are  
any SRFs in the targetlist (including GROUP BY/ORDER BY expressions).  
The parser can now set that basically for free during parse analysis,  
and we can use it in a number of places to avoid expression_returns_set  
searches.  (There will be more such checks soon.)  In some places, this  
allows decontorting the logic since it's no longer expensive to check for  
SRFs in the tlist --- so I made the checks parallel to the handling of  
hasAggs/hasWindowFuncs wherever it seemed appropriate.  
  
catversion bump because adding a Query field changes stored rules.  
  
Andres Freund and Tom Lane  
  
Discussion: <[email protected]>  

M src/backend/catalog/heap.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_utilcmd.c
M src/backend/rewrite/rewriteHandler.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/include/parser/parse_func.h
M src/include/parser/parse_node.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/expected/tsrf.out
M src/test/regress/sql/tsrf.sql

Have heapam.h include lockdefs.h rather than lock.h.

commit   : 445a38aba26cb80a4506af2248e3b425f795a099    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 13 Sep 2016 09:21:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 13 Sep 2016 09:21:35 -0400    

Click here for diff

lockdefs.h was only split from lock.h relatively recently, and  
represents a minimal subset of the old lock.h.  heapam.h only needs  
that smaller subset, so adjust it to include only that.  This requires  
some corresponding adjustments elsewhere.  
  
Peter Geoghegan  

M src/backend/access/heap/syncscan.c
M src/backend/access/transam/commit_ts.c
M src/include/access/heapam.h
M src/include/access/relscan.h
M src/include/nodes/execnodes.h

Remove user_relns() SRF from regression tests.

commit   : 0dba54f1666ead71c54ce100b39efda67596d297    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 12 Sep 2016 19:01:16 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 12 Sep 2016 19:01:16 -0700    

Click here for diff

The output of the function changes whenever previous (or, as in this  
case, concurrent) tests leave a table in place. That causes unneeded  
churn.  
  
This should fix failures due to the tests added bfe16d1a5, like on  
lapwing, caused by the tsrf test running concurrently with misc. Those  
could also have been addressed by using temp tables, but that test has  
annoyed me before.  
  
Discussion: <[email protected]>  

M src/test/regress/input/create_function_2.source
M src/test/regress/input/misc.source
M src/test/regress/output/create_function_2.source
M src/test/regress/output/misc.source

Address portability issues in bfe16d1a5 test output.

commit   : 9f478b4f19d8e26300ae19e42c26343f5791e32a    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 12 Sep 2016 18:15:10 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 12 Sep 2016 18:15:10 -0700    

Click here for diff

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

Add more tests for targetlist SRFs.

commit   : bfe16d1a5dec0d23c917c37de646256c71e07ee8    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 3 Aug 2016 18:29:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 3 Aug 2016 18:29:42 -0700    

Click here for diff

We're considering changing the implementation of targetlist SRFs  
considerably, and a lot of the current behaviour isn't tested in our  
regression tests. Thus it seems useful to increase coverage to avoid  
accidental behaviour changes.  
  
It's quite possible that some of the plans here will require adjustments  
to avoid falling afoul of ordering differences (e.g. hashed group  
bys). The buildfarm will tell us.  
  
Reviewed-By: Tom Lane  
Discussion: <[email protected]>  

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

Docs: assorted minor cleanups.

commit   : 42fd984c0b7b53d1bc961c9ed6bb84fe28eae52b    
  
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

pg_basebackup: Clean created directories on failure

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

Click here for diff

Like initdb, clean up created data and xlog directories, unless the new  
-n/--noclean option is specified.  
  
Tablespace directories are not cleaned up, but a message is written  
about that.  
  
Reviewed-by: Masahiko Sawada <[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

Fix recent commit for tab-completion of database template.

commit   : 63c1a871940c7c4798788e98fdb1a24408a49d05    
  
author   : Kevin Grittner <[email protected]>    
date     : Mon, 12 Sep 2016 09:22:57 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Mon, 12 Sep 2016 09:22:57 -0500    

Click here for diff

The details of commit 52803098ab26051c0c9802f3c19edffc90de8843 were  
based on a misunderstanding of the role inheritance allowing use  
of a database for a template.  While the CREATEDB privilege is not  
inherited, the database ownership is privileges are.  
  
Pointed out by Vitaly Burovoy and Tom Lane.  
Fix provided by Tom Lane, reviewed by Vitaly Burovoy.  

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

Fix copy/pasto in file identification

commit   : 4068eb9918cbbeaba8042fa6fe0c1f5382f2f05f    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 12 Sep 2016 09:01:58 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 12 Sep 2016 09:01:58 +0100    

Click here for diff

Daniel Gustafsson  

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

Identify walsenders in pg_stat_activity

commit   : fc3d4a44e9375f79709f470cb3c83d4ca28fb370    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 12 Sep 2016 08:57:14 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 12 Sep 2016 08:57:14 +0100    

Click here for diff

Following 8299471c37fff0b walsender procs are now visible in pg_stat_activity.  
Set query to ā€˜walsenderā€™ for walsender procs to allow them to be identified.  
  
Discussion:CAB7nPqS8c76KPSufK_HSDeYrbtg+zZ7D0EEkjeM6txSEuCB_jA@mail.gmail.com  
  
Michael Paquier, issue raised by Fujii Masao, reviewed by Tom Lane  

M src/backend/replication/walsender.c

Raise max setting of checkpoint_timeout to 1d

commit   : c3c0d7bd701dae4737c974a59ffa9b366110f9c1    
  
author   : Simon Riggs <[email protected]>    
date     : Sun, 11 Sep 2016 23:26:18 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Sun, 11 Sep 2016 23:26:18 +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

psql tab completion for CREATE DATABASE ... TEMPLATE ...

commit   : 52803098ab26051c0c9802f3c19edffc90de8843    
  
author   : Kevin Grittner <[email protected]>    
date     : Sun, 11 Sep 2016 15:37:27 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Sun, 11 Sep 2016 15:37:27 -0500    

Click here for diff

Sehrope Sarkuni, reviewed by Merlin Moncure & Vitaly Burovoy  
with some editing by me  

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

Allow CREATE EXTENSION to follow extension update paths.

commit   : 40b449ae84dcf71177d7749a7b0c582b64dc15f0    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Sep 2016 14:15:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Sep 2016 14:15:07 -0400    

Click here for diff

Previously, to update an extension you had to produce both a version-update  
script and a new base installation script.  It's become more and more  
obvious that that's tedious, duplicative, and error-prone.  This patch  
attempts to improve matters by allowing the new base installation script  
to be omitted.  CREATE EXTENSION will install a requested version if it  
can find a base script and a chain of update scripts that will get there.  
As in the existing update logic, shorter chains are preferred if there's  
more than one possibility, with an arbitrary tie-break rule for chains  
of equal length.  
  
Also adjust the pg_available_extension_versions view to show such versions  
as installable.  
  
While at it, refactor the code so that CASCADE processing works for  
extensions requested during ApplyExtensionUpdates().  Without this,  
addition of a new requirement in an updated extension would require  
creating a new base script, even if there was no other reason to do that.  
(It would be easy at this point to add a CASCADE option to ALTER EXTENSION  
UPDATE, to allow the same thing to happen during a manually-commanded  
version update, but I have not done that here.)  
  
Tom Lane, reviewed by Andres Freund  
  
Discussion: <[email protected]>  

M doc/src/sgml/extend.sgml
M src/backend/commands/extension.c

Fix and simplify MSVC build's handling of xml/xslt/uuid dependencies.

commit   : 28e5e5648cc3666537c393b2636c4aa34fdb22c1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Sep 2016 12:46:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Sep 2016 12:46:55 -0400    

Click here for diff

Solution.pm mistakenly believed that the xml option requires the xslt  
option, when actually the dependency is the other way around; and it  
believed that libxml requires libiconv, which is not necessarily so,  
so we shouldn't enforce it here.  Fix the option cross-checking logic.  
  
Also, since AddProject already takes care of adding libxml and libxslt  
include and library dependencies to every project, there's no need  
for the custom code that did that in mkvcbuild.  While at it, let's  
handle the similar dependencies for uuid in a similar fashion.  
  
Given the lack of field complaints about these overly strict build  
dependency requirements, there seems no need for a back-patch.  
  
Michael Paquier  
  
Discussion: <CAB7nPqR0+gpu3mRQvFjf-V-bMxmiSJ6NpTg9_WzVDL+a31cV2g@mail.gmail.com>  

M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm

Implement binary heap replace-top operation in a smarter way.

commit   : 24598337c8d214ba8dcf354130b72c49636bba69    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 11 Sep 2016 16:27:27 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 11 Sep 2016 16:27:27 +0300    

Click here for diff

In external sort's merge phase, we maintain a binary heap holding the next  
tuple from each input tape. On each step, the topmost tuple is returned,  
and replaced with the next tuple from the same tape. We were doing the  
replacement by deleting the top node in one operation, and inserting the  
next tuple after that. However, you can do a "replace-top" operation more  
efficiently, in one "sift-up". A deletion will always walk the heap from  
top to bottom, but in a replacement, we can stop as soon as we find the  
right place for the new tuple. This is particularly helpful, if the tapes  
are not in completely random order, so that the next tuple from a tape is  
likely to land near the top of the heap.  
  
Peter Geoghegan, reviewed by Claudio Freire, with some editing by me.  
  
Discussion: <CAM3SWZRhBhiknTF_=NjDSnNZ11hx=U_SEYwbc5vd=x7M4mMiCw@mail.gmail.com>  

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

Improve unreachability recognition in elog() macro.

commit   : f2717c79eeecaf5997016d52fd81881301dcfc5e    
  
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   : ddc889317912fd8b654439701195a43cecfd4e79    
  
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

Rewrite PageIndexDeleteNoCompact into a form that only deletes 1 tuple.

commit   : 24992c6db9fd40f342db1f22747ec9e56483796d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2016 19:00:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2016 19:00:59 -0400    

Click here for diff

The full generality of deleting an arbitrary number of tuples is no longer  
needed, so let's save some code and cycles by replacing the original coding  
with an implementation based on PageIndexTupleDelete.  
  
We can always get back the old code from git if we need it again for new  
callers (though I don't care for its willingness to mess with line pointers  
it wasn't told to mess with).  
  
Discussion: <[email protected]>  

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

Convert PageAddItem into a macro to save a few cycles.

commit   : 1a4be103a523db8d47b464463ba175cc664442b2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2016 18:17:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2016 18:17:07 -0400    

Click here for diff

Nowadays this is just a backwards-compatibility wrapper around  
PageAddItemExtended, so let's avoid the extra level of function call.  
In addition, because pretty much all callers are passing constants  
for the two bool arguments, compilers will be able to constant-fold  
the conversion to a flags bitmask.  
  
Discussion: <[email protected]>  

M src/backend/storage/page/bufpage.c
M src/include/storage/bufpage.h

Invent PageIndexTupleOverwrite, and teach BRIN and GiST to use it.

commit   : b1328d78f88cdf4f7504004159e530b776f0de16    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2016 18:02:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2016 18:02:24 -0400    

Click here for diff

PageIndexTupleOverwrite performs approximately the same function as  
PageIndexTupleDelete (or PageIndexDeleteNoCompact) followed by PageAddItem  
targeting the same item pointer offset.  But in the case where the new  
tuple is the same size as the old, it avoids shuffling other data around on  
the page, because the new tuple is placed where the old one was rather than  
being appended to the end of the page.  This has been shown to provide a  
substantial speedup for some GiST use-cases.  
  
Also, this change allows some API simplifications: we can get rid of  
the rather klugy and error-prone PAI_ALLOW_FAR_OFFSET flag for  
PageAddItemExtended, since that was used only to cover a corner case  
for BRIN that's better expressed by using PageIndexTupleOverwrite.  
  
Note that this patch causes a rather subtle WAL incompatibility: the  
physical page content change represented by certain WAL records is now  
different than it was before, because while the tuples have the same  
itempointer line numbers, the tuples themselves are in different places.  
I have not bumped the WAL version number because I think it doesn't matter  
unless you are trying to do bitwise comparisons of original and replayed  
pages, and in any case we're early in a devel cycle and there will probably  
be more WAL changes before v10 gets out the door.  
  
There is probably room to make use of PageIndexTupleOverwrite in SP-GiST  
and GIN too, but that is left for a future patch.  
  
Andrey Borodin, reviewed by Anastasia Lubennikova, whacked around a bit  
by me  
  
Discussion: <CAJEAwVGQjGGOj6mMSgMwGvtFd5Kwe6VFAxY=uEPZWMDjzbn4VQ@mail.gmail.com>  

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

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

commit   : 5c609a742f294907512b946dbaf1feaa3b71ddc7    
  
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

In PageIndexTupleDelete, don't assume stored item lengths are MAXALIGNed.

commit   : 984d0a14e8d0141a68da5bd56ce6821042298904    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2016 12:20:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2016 12:20:58 -0400    

Click here for diff

PageAddItem stores the item length as-is.  It MAXALIGN's the amount of  
space actually allocated for each tuple, but not the stored length.  
PageRepairFragmentation, PageIndexMultiDelete, and PageIndexDeleteNoCompact  
are all on board with this and MAXALIGN item lengths after fetching them.  
But PageIndexTupleDelete expects the stored length to be a MAXALIGN  
multiple already.  This accidentally works for existing index AMs because  
they all maxalign their tuple sizes internally; but we don't do that for  
heap tuples, and it shouldn't be a requirement for index tuples either.  
  
So, sync PageIndexTupleDelete with the rest of bufpage.c by having it  
maxalign the item size after fetching.  
  
Also add a check that pd_special is maxaligned, to ensure that the test  
"(offset + size) > phdr->pd_special" is still doing the right thing.  
(If offset and pd_special are aligned, it doesn't matter whether size is.)  
Again, this is in sync with the rest of the routines here, except for  
PageAddItem which doesn't test because it doesn't actually do anything  
for which pd_special alignment matters.  
  
This shouldn't have any immediate functional impact; it just adds the  
flexibility to use PageIndexTupleDelete on index tuples with non-aligned  
lengths.  
  
Discussion: <[email protected]>  

M src/backend/storage/page/bufpage.c

Make better use of existing enums in plpgsql

commit   : e0013deb5983303d945aacd56909ac4ce227fde1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Aug 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Aug 2016 12:00:00 -0400    

Click here for diff

plpgsql.h defines a number of enums, but most of the code passes them  
around as ints.  Update structs and function prototypes to take enum  
types instead.  This clarifies the struct definitions in plpgsql.h in  
particular.  
  
Reviewed-by: Pavel Stehule <[email protected]>  

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/plpgsql.h

Avoid reporting "cache lookup failed" for some user-reachable cases.

commit   : 967a7b0fc9c8f4e07b697148238566203cb060de    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2016 09:20:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2016 09:20:34 -0400    

Click here for diff

We have a not-terribly-thoroughly-enforced-yet project policy that internal  
errors with SQLSTATE XX000 (ie, plain elog) should not be triggerable from  
SQL.  record_in, domain_in, and PL validator functions all failed to meet  
this standard, because they threw plain elog("cache lookup failed for XXX")  
errors on bad OIDs, and those are all invokable from SQL.  
  
For record_in, the best fix is to upgrade typcache.c (lookup_type_cache)  
to throw a user-facing error for this case.  That seems consistent because  
it was more than halfway there already, having user-facing errors for shell  
types and non-composite types.  Having done that, tweak domain_in to rely  
on the typcache to throw an appropriate error.  (This costs little because  
InitDomainConstraintRef would fetch the typcache entry anyway.)  
  
For the PL validator functions, we already have a single choke point at  
CheckFunctionValidatorAccess, so just fix its error to be user-facing.  
  
Dilip Kumar, reviewed by Haribabu Kommi  
  
Discussion: <[email protected]>  

M src/backend/utils/adt/domains.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/fmgr/fmgr.c

Fix corruption of 2PC recovery with subxacts

commit   : ec253de1fd2e6002122de80815ac5b963af8277c    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 9 Sep 2016 11:55:12 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 9 Sep 2016 11:55:12 +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

Correct TABLESAMPLE docs

commit   : f66472428a51fc484bc5ca81791924d06a6f096d    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 9 Sep 2016 11:19:21 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 9 Sep 2016 11:19:21 +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

Improve scalability of md.c for large relations.

commit   : 45e191e3aa62d47a8bc1a33f784286b2051f45cb    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 8 Sep 2016 17:02:43 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 8 Sep 2016 17:02:43 -0700    

Click here for diff

So far md.c used a linked list of segments. That proved to be a problem  
when processing large relations, because every smgr.c/md.c level access  
to a page incurred walking through a linked list of all preceding  
segments. Thus making accessing pages O(#segments).  
  
Replace the linked list of segments hanging off SMgrRelationData with an  
array of opened segments. That allows O(1) access to individual  
segments, if they've previously been opened.  
  
Discussion: <[email protected]>  
Reviewed-By: Peter Geoghegan, Tom Lane (in an older version)  

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

Faster PageIsVerified() for the all zeroes case.

commit   : 417fefaf089fc0b73607cbbe8bcd0bc9e89d08ef    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 8 Sep 2016 17:02:43 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 8 Sep 2016 17:02:43 -0700    

Click here for diff

That's primarily useful for testing very large relations, using sparse  
files.  
  
Discussion: <[email protected]>  
Reviewed-By: Peter Geoghegan  

M src/backend/storage/page/bufpage.c

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

commit   : 769fd9d8e06bf862334a0e04134a3d2c665e5e5b    
  
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   : 19acee8c5adb68b96222e41c084efbc9b31d397a    
  
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   : df5d9bb8d5074138e6fea63ac8acd9b95a0eb859    
  
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   : e97e9c57bd22b2dfbfaf41f7d5c69789f7fad554    
  
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   : 67c6bd1ca3ce75778138bf4713444a5a6b46032e    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 8 Sep 2016 10:32:58 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 8 Sep 2016 10:32:58 +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

MSVC: Pass any user-set MSBFLAGS to MSBuild and VCBUILD.

commit   : d299eb41dfc7b73dec80f22554b952f01c9d54a4    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 8 Sep 2016 01:42:09 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 8 Sep 2016 01:42:09 -0400    

Click here for diff

This is particularly useful to pass /m, to perform a parallel build.  
  
Christian Ullrich, reviewed by Michael Paquier.  

M doc/src/sgml/install-windows.sgml
M src/tools/msvc/build.pl
M src/tools/msvc/clean.bat
M src/tools/msvc/vcregress.pl

MSVC: Place gendef.pl temporary file in the target directory.

commit   : 976a9bbd0251ea112898f85314646801e7e6207d    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 8 Sep 2016 01:40:53 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 8 Sep 2016 01:40:53 -0400    

Click here for diff

Until now, it used the current working directory.  This makes it safe  
for simultaneous invocations of gendef.pl, with different target  
directories, to run from a single current working directory, such as  
$(top_srcdir).  The MSVC build system will soon rely on this.  
  
Christian Ullrich, reviewed by Michael Paquier.  

M src/tools/msvc/gendef.pl

9.6 release notes: correct summary item about freeze

commit   : c9cf432ef32a9d29323b9b079178c1a6be126ff8    
  
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

Support renaming an existing value of an enum type.

commit   : 0ab9c56d0fe3acc9d4717a9cbac6ef3369275b90    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Sep 2016 16:11:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Sep 2016 16:11:56 -0400    

Click here for diff

Not much to be said about this patch: it does what it says on the tin.  
  
In passing, rename AlterEnumStmt.skipIfExists to skipIfNewValExists  
to clarify what it actually does.  In the discussion of this patch  
we considered supporting other similar options, such as IF EXISTS  
on the type as a whole or IF NOT EXISTS on the target name.  This  
patch doesn't actually add any such feature, but it might happen later.  
  
Dagfinn Ilmari MannsƄker, reviewed by Emre Hasegeli  
  
Discussion: <CAO=2mx6uvgPaPDf-rHqG8=1MZnGyVDMQeh8zS4euRyyg4D35OQ@mail.gmail.com>  

M doc/src/sgml/ref/alter_type.sgml
M src/backend/catalog/pg_enum.c
M src/backend/commands/typecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/include/catalog/pg_enum.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/enum.out
M src/test/regress/sql/enum.sql

Doc: minor documentation improvements about extensions.

commit   : bd180b607927c7757af17cd6fce0e545e5c48584    
  
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

Add a HINT for client-vs-server COPY failure cases.

commit   : 4f405c8ef4704b7fa7fd8ac14a66c5f5d13722c4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Sep 2016 23:55:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Sep 2016 23:55:55 -0400    

Click here for diff

Users often get confused between COPY and \copy and try to use client-side  
paths with COPY.  The server then cannot find the file (if remote), or sees  
a permissions problem (if local), or some variant of that.  Emit a hint  
about this in the most common cases.  
  
In future we might want to expand the set of errnos for which the hint  
gets printed, but be conservative for now.  
  
Craig Ringer, reviewed by Christoph Berg and Tom Lane  
  
Discussion: <CAMsr+YEqtD97qPEzQDqrCt5QiqPbWP_X4hmvy2pQzWC0GWiyPA@mail.gmail.com>  

M src/backend/commands/copy.c

Add location field to DefElem

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

Click here for diff

Add a location field to the DefElem struct, used to parse many utility  
commands.  Update various error messages to supply error position  
information.  
  
To propogate the error position information in a more systematic way,  
create a ParseState in standard_ProcessUtility() and pass that to  
interested functions implementing the utility commands.  This seems  
better than passing the query string and then reassembling a parse state  
ad hoc, which violates the encapsulation of the ParseState type.  
  
Reviewed-by: Pavel Stehule <[email protected]>  

M contrib/file_fdw/file_fdw.c
M src/backend/access/common/reloptions.c
M src/backend/catalog/aclchk.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/collationcmds.c
M src/backend/commands/copy.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/sequence.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/view.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/repl_gram.y
M src/backend/tcop/utility.c
M src/include/commands/collationcmds.h
M src/include/commands/copy.h
M src/include/commands/dbcommands.h
M src/include/commands/defrem.h
M src/include/commands/explain.h
M src/include/commands/extension.h
M src/include/commands/sequence.h
M src/include/commands/typecmds.h
M src/include/commands/user.h
M src/include/nodes/makefuncs.h
M src/include/nodes/parsenodes.h
M src/include/utils/acl.h

Doc: small improvements for documentation about VACUUM freezing.

commit   : 975768f8eae2581b89ceafe8b16a77ff375207fe    
  
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   : f032722f86a709277d44a317a3bc8acd74861a72    
  
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

Teach appendShellString() to not quote strings containing "-".

commit   : cdc70597c9ba62aad08a46e55c0c783bf4c21c9c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Sep 2016 14:53:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Sep 2016 14:53:31 -0400    

Click here for diff

Brain fade in commit a00c58314: I was thinking that a string starting with  
"-" could be taken as a switch depending on command line syntax.  That's  
true, but having appendShellString() quote it will not help, so we may as  
well not do so.  Per complaint from Peter Eisentraut.  

M src/fe_utils/string_utils.c

Repair whitespace in initdb message.

commit   : a2ee579b6def8e0bde876c6c2fc9d4b8ec2b6b67    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Sep 2016 13:26:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Sep 2016 13:26:43 -0400    

Click here for diff

What used to be four spaces somehow turned into a tab and a couple of  
spaces in commit a00c58314, no doubt from overhelpful emacs autoindent.  
Noted by Peter Eisentraut.  

M src/bin/initdb/initdb.c

Fix VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL

commit   : dcb12ce8d8691e0e526d3f38d14c4d7fc9c664f5    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 6 Sep 2016 15:35:47 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 6 Sep 2016 15:35:47 +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

C comment: fix file name mention on line 1

commit   : 67e1e2aaff109c507da013c66009f048dda96f3e    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 6 Sep 2016 00:03:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 6 Sep 2016 00:03:55 -0400    

Click here for diff

Author: Amit Langote  

M src/include/libpq/libpq-be.h

Cosmetic code cleanup in commands/extension.c.

commit   : 25794e841e5b86a0f90fac7f7f851e5d950e51e2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Sep 2016 18:53:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Sep 2016 18:53:25 -0400    

Click here for diff

Some of the comments added by the CREATE EXTENSION CASCADE patch were  
a bit sloppy, and I didn't care for redeclaring the same local variable  
inside a nested block either.  No functional changes.  

M src/backend/commands/extension.c

Have "make coverage" recurse into contrib as well

commit   : 2093f6630500c9d5e122748ac7d3719855d71174    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 5 Sep 2016 18:44:36 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 5 Sep 2016 18:44:36 -0300    

Click here for diff

M GNUmakefile.in

Make locale-dependent regex character classes work for large char codes.

commit   : c54159d44ceaba26ceda9fea1804f0de122a8f30    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Sep 2016 17:06:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Sep 2016 17:06:29 -0400    

Click here for diff

Previously, we failed to recognize Unicode characters above U+7FF as  
being members of locale-dependent character classes such as [[:alpha:]].  
(Actually, the same problem occurs for large pg_wchar values in any  
multibyte encoding, but UTF8 is the only case people have actually  
complained about.)  It's impractical to get Spencer's original code to  
handle character classes or ranges containing many thousands of characters,  
because it insists on considering each member character individually at  
regex compile time, whether or not the character will ever be of interest  
at run time.  To fix, choose a cutoff point MAX_SIMPLE_CHR below which  
we process characters individually as before, and deal with entire ranges  
or classes as single entities above that.  We can actually make things  
cheaper than before for chars below the cutoff, because the color map can  
now be a simple linear array for those chars, rather than the multilevel  
tree structure Spencer designed.  It's more expensive than before for  
chars above the cutoff, because we must do a binary search in a list of  
high chars and char ranges used in the regex pattern, plus call iswalpha()  
and friends for each locale-dependent character class used in the pattern.  
However, multibyte encodings are normally designed to give smaller codes  
to popular characters, so that we can expect that the slow path will be  
taken relatively infrequently.  In any case, the speed penalty appears  
minor except when we have to apply iswalpha() etc. to high character codes  
at runtime --- and the previous coding gave wrong answers for those cases,  
so whether it was faster is moot.  
  
Tom Lane, reviewed by Heikki Linnakangas  
  
Discussion: <[email protected]>  

M src/backend/regex/README
M src/backend/regex/regc_color.c
M src/backend/regex/regc_cvec.c
M src/backend/regex/regc_locale.c
M src/backend/regex/regc_pg_locale.c
M src/backend/regex/regcomp.c
M src/backend/regex/regexport.c
M src/backend/regex/regprefix.c
M src/include/regex/regcustom.h
M src/include/regex/regex.h
M src/include/regex/regguts.h
A src/test/regress/expected/regex.linux.utf8.out
A src/test/regress/sql/regex.linux.utf8.sql

C comment: align dashes in GroupState node header

commit   : f80049f76a32858601510eaaef19ab8160e4c9b3    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 5 Sep 2016 13:09:54 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 5 Sep 2016 13:09:54 -0400    

Click here for diff

Author: Jim Nasby  

M src/include/nodes/execnodes.h

Relax transactional restrictions on ALTER TYPE ... ADD VALUE.

commit   : 15bc038f9bcd1a9af3f625caffafc7c20322202d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Sep 2016 12:59:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Sep 2016 12:59:55 -0400    

Click here for diff

To prevent possibly breaking indexes on enum columns, we must keep  
uncommitted enum values from getting stored in tables, unless we  
can be sure that any such column is new in the current transaction.  
  
Formerly, we enforced this by disallowing ALTER TYPE ... ADD VALUE  
from being executed at all in a transaction block, unless the target  
enum type had been created in the current transaction.  This patch  
removes that restriction, and instead insists that an uncommitted enum  
value can't be referenced unless it belongs to an enum type created  
in the same transaction as the value.  Per discussion, this should be  
a bit less onerous.  It does require each function that could possibly  
return a new enum value to SQL operations to check this restriction,  
but there aren't so many of those that this seems unmaintainable.  
  
Andrew Dunstan and Tom Lane  
  
Discussion: <[email protected]>  

M doc/src/sgml/ref/alter_type.sgml
M src/backend/commands/typecmds.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/enum.c
M src/backend/utils/errcodes.txt
M src/include/commands/typecmds.h
M src/test/regress/expected/enum.out
M src/test/regress/sql/enum.sql

Add debug check function LWLockHeldByMeInMode()

commit   : 016abf1fb8333de82a259af0cc7572a4b868023b    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 5 Sep 2016 10:38:08 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 5 Sep 2016 10:38:08 +0100    

Click here for diff

Tests whether my process holds a lock in given mode.  
Add initial usage in MarkBufferDirty().  
  
Thomas Munro  

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

Document LSN acronym in WAL Internals

commit   : ec03f4121cec6cf885bf40d9dfb53b8368251e99    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 5 Sep 2016 09:47:49 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 5 Sep 2016 09:47:49 +0100    

Click here for diff

We previously didn't mention what an LSN actually was.  
  
Simon Riggs and Michael Paquier  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/wal.sgml

Dirty replication slots when using sql interface

commit   : d851bef2d60ff9345249ff67c053e37fe4b364cc    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 5 Sep 2016 09:44:38 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 5 Sep 2016 09:44:38 +0100    

Click here for diff

When pg_logical_slot_get_changes(...) sets confirmed_flush_lsn to the point at  
which replay stopped, it doesn't dirty the replication slot.  So if the replay  
didn't cause restart_lsn or catalog_xmin to change as well, this change will  
not get written out to disk. Even on a clean shutdown.  
  
If Pg crashes or restarts, a subsequent pg_logical_slot_get_changes(...) call  
will see the same changes already replayed since it uses the slot's  
confirmed_flush_lsn as the start point for fetching changes. The caller can't  
specify a start LSN when using the SQL interface.  
  
Mark the slot as dirty after reading changes using the SQL interface so that  
users won't see repeated changes after a clean shutdown. Repeated changes still  
occur when using the walsender interface or after an unclean shutdown.  
  
Craig Ringer  

M src/backend/replication/logical/logicalfuncs.c
M src/test/recovery/Makefile
A src/test/recovery/t/006_logical_decoding.pl

Remove duplicate code from ReorderBufferCleanupTXN().

commit   : b6182081be4a795d70b966be2542ad32d1ffbc20    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Sep 2016 20:49:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Sep 2016 20:49:44 -0400    

Click here for diff

Andres is apparently the only hacker who thinks this code is better as-is.  
I (tgl) follow some of his logic, but the fact that it's setting off  
warnings from static code analyzers seems like a sufficient reason to  
put the complexity into a comment rather than the code.  
  
Aleksander Alekseev  
  
Discussion: <20160404190345.54d84ee8@fujitsu>  

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

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

commit   : c7f68bea22bf680a4eab4b8b1592b3c90bc634ac    
  
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   : da6ea70c32bed99ca040a5e04d83c0edd5dfc615    
  
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   : 5a072244919a92b2c757b2e3985191f02d674627    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Sep 2016 13:19:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Sep 2016 13:19:54 -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

Remove useless pg_strdup() operations.

commit   : a2d75b67bccd24d17e328360080e4877d23bc369    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Sep 2016 12:33:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Sep 2016 12:33:58 -0400    

Click here for diff

split_to_stringlist() doesn't modify its first argument nor expect it  
to remain valid after exit, so there's no need to duplicate the optarg  
string at the call sites.  Per Coverity.  (This has been wrong all along,  
but commit 052cc223d changed the useless calls from "strdup" to  
"pg_strdup", which apparently made Coverity think it's a new bug.  
It's not, but it's also not worth back-patching.)  

M src/test/regress/pg_regress.c

Clarify the new Red-Black post-order traversal code a bit.

commit   : e21db14b8a6696a2b704b89df9c4be9cd0ea8a33    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 4 Sep 2016 15:02:06 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 4 Sep 2016 15:02:06 +0300    

Click here for diff

Coverity complained about the for(;;) loop, because it never actually  
iterated. It was used just to be able to use "break" to exit it early. I  
agree with Coverity, that's a bit confusing, so refactor the code to  
use if-else instead.  
  
While we're at it, use a local variable to hold the "current" node. That's  
shorter and clearer than referring to "iter->last_visited" all the time.  

M src/backend/lib/rbtree.c

Improve readability of the output of psql's \timing command.

commit   : 6591f4226c81104f7746da6a5c00519919c560ae    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Sep 2016 15:29:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Sep 2016 15:29:03 -0400    

Click here for diff

In addition to the existing decimal-milliseconds output value,  
display the same value in mm:ss.fff format if it exceeds one second.  
Tack on hours and even days fields if the interval is large enough.  
This avoids needing mental arithmetic to convert the values into  
customary time units.  
  
Corey Huinker, reviewed by Gerdan Santos; bikeshedding by many  
  
Discussion: <CADkLM=dbC4R8sbbuFXQVBFWoJGQkTEW8RWnC0PbW9nZsovZpJQ@mail.gmail.com>  

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

Fix multiple bugs in numeric_poly_deserialize().

commit   : 600dc4c0da3b8c094ccc1ae75b47c8320898c714    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Sep 2016 14:18:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Sep 2016 14:18:55 -0400    

Click here for diff

These were evidently introduced by yesterday's commit 9cca11c91,  
which perhaps needs more review than it got.  
  
Per report from Andreas Seltenreich and additional examination  
of nearby code.  
  
Report: <[email protected]>  

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

Fix corrupt GIN_SEGMENT_ADDITEMS WAL records on big-endian hardware.

commit   : 60893786d5180f5dd5aefd44d9cb6955d77b0473    
  
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

New recovery target recovery_target_lsn

commit   : 35250b6ad7a8ece5cfe54c0316c180df19f36c13    
  
author   : Simon Riggs <[email protected]>    
date     : Sat, 3 Sep 2016 17:48:01 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Sat, 3 Sep 2016 17:48:01 +0100    

Click here for diff

Michael Paquier  

M doc/src/sgml/recovery-config.sgml
M src/backend/access/transam/recovery.conf.sample
M src/backend/access/transam/xlog.c
M src/include/access/xlog.h
M src/test/recovery/t/003_recovery_targets.pl

Fix wording of logical decoding concepts

commit   : 0c40ab3a88edf654165e562deee0c303a6ebef5e    
  
author   : Simon Riggs <[email protected]>    
date     : Sat, 3 Sep 2016 16:19:11 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Sat, 3 Sep 2016 16:19:11 +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   : 39b691f251167bbb3d49203abfb39d430f68f411    
  
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

Move code shared between libpq and backend from backend/libpq/ to common/.

commit   : ec136d19b21791c845b1deeff43df137add0639e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 2 Sep 2016 13:49:59 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 2 Sep 2016 13:49:59 +0300    

Click here for diff

When building libpq, ip.c and md5.c were symlinked or copied from  
src/backend/libpq into src/interfaces/libpq, but now that we have a  
directory specifically for routines that are shared between the server and  
client binaries, src/common/, move them there.  
  
Some routines in ip.c were only used in the backend. Keep those in  
src/backend/libpq, but rename to ifaddr.c to avoid confusion with the file  
that's now in common.  
  
Fix the comment in src/common/Makefile to reflect how libpq actually links  
those files.  
  
There are two more files that libpq symlinks directly from src/backend:  
encnames.c and wchar.c. I don't feel compelled to move those right now,  
though.  
  
Patch by Michael Paquier, with some changes by me.  
  
Discussion: <[email protected]>  

M contrib/passwordcheck/passwordcheck.c
M src/backend/commands/user.c
M src/backend/libpq/Makefile
M src/backend/libpq/auth.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
R072 src/backend/libpq/ip.c src/backend/libpq/ifaddr.c
M src/backend/libpq/pqcomm.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/varlena.c
M src/common/Makefile
A src/common/ip.c
R098 src/backend/libpq/md5.c src/common/md5.c
R065 src/include/libpq/ip.h src/include/common/ip.h
R096 src/include/libpq/md5.h src/include/common/md5.h
A src/include/libpq/ifaddr.h
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/tools/ifaddrs/Makefile
M src/tools/ifaddrs/test_ifaddrs.c
M src/tools/msvc/Mkvcbuild.pm

Speed up SUM calculation in numeric aggregates.

commit   : 9cca11c915e458323d0e746c68203f2c11da0302    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 2 Sep 2016 11:51:49 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 2 Sep 2016 11:51:49 +0300    

Click here for diff

This introduces a numeric sum accumulator, which performs better than  
repeatedly calling add_var(). The performance comes from using wider digits  
and delaying carry propagation, tallying positive and negative values  
separately, and avoiding a round of palloc/pfree on every value. This  
speeds up SUM(), as well as other standard aggregates like AVG() and  
STDDEV() that also calculate a sum internally.  
  
Reviewed-by: Andrey Borodin  
Discussion: <[email protected]>  

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

Support multiple iterators in the Red-Black Tree implementation.

commit   : 9f85784cae4d057f307b83b0d33edede33434f04    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 2 Sep 2016 08:39:39 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 2 Sep 2016 08:39:39 +0300    

Click here for diff

While we don't need multiple iterators at the moment, the interface is  
nicer and less dangerous this way.  
  
Aleksander Alekseev, with some changes by me.  

M src/backend/access/gin/ginbulk.c
M src/backend/lib/rbtree.c
M src/include/access/gin_private.h
M src/include/lib/rbtree.h

Improve tab completion for BEGIN & START|SET TRANSACTION.

commit   : 76f9dd4fa82270899f7b56b002b5d34226dc99d8    
  
author   : Kevin Grittner <[email protected]>    
date     : Thu, 1 Sep 2016 16:10:30 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Thu, 1 Sep 2016 16:10:30 -0500    

Click here for diff

Andreas Karlsson with minor change by me for SET TRANSACTION  
SNAPSHOT.  

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

Change API of ShmemAlloc() so it throws error rather than returning NULL.

commit   : 6c03d981a6b64ed8caaed4e94b54ef926202c9f3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Sep 2016 10:13:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Sep 2016 10:13:55 -0400    

Click here for diff

A majority of callers seem to have believed that this was the API spec  
already, because they omitted any check for a NULL result, and hence  
would crash on an out-of-shared-memory failure.  The original proposal  
was to just add such error checks everywhere, but that does nothing to  
prevent similar omissions in future.  Instead, let's make ShmemAlloc()  
throw the error (so we can remove the caller-side checks that do exist),  
and introduce a new function ShmemAllocNoError() that has the previous  
behavior of returning NULL, for the small number of callers that need  
that and are prepared to do the right thing.  This also lets us remove  
the rather wishy-washy behavior of printing a WARNING for out-of-shmem,  
which never made much sense: either the caller has a strategy for  
dealing with that, or it doesn't.  It's not ShmemAlloc's business to  
decide whether a warning is appropriate.  
  
The v10 release notes will need to call this out as a significant  
source-code change.  It's likely that it will be a bug fix for  
extension callers too, but if not, they'll need to change to using  
ShmemAllocNoError().  
  
This is nominally a bug fix, but the odds that it's fixing any live  
bug are actually rather small, because in general the requests  
being made by the unchecked callers were already accounted for in  
determining the overall shmem size, so really they ought not fail.  
Between that and the possible impact on extensions, no back-patch.  
  
Discussion: <[email protected]>  

M src/backend/storage/ipc/shmem.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/shmem.h

Improve memory management for PL/Perl functions.

commit   : 6f7c0ea32f808a7dad3ec07db7e5fdf6514d2af0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2016 19:54:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2016 19:54:58 -0400    

Click here for diff

Unlike PL/Tcl, PL/Perl at least made an attempt to clean up after itself  
when a function gets redefined.  But it was still using TopMemoryContext  
for the fn_mcxt of argument/result I/O functions, resulting in the  
potential for memory leaks depending on what those functions did, and the  
retail alloc/free logic was pretty bulky as well.  Fix things to use a  
per-function memory context like the other PLs now do.  Tweak a couple of  
places where things were being done in a not-very-safe order (on the  
principle that a memory leak is better than leaving global state  
inconsistent after an error).  Also make some minor cosmetic adjustments,  
mostly in field names, to make the code look similar to the way PL/Tcl does  
now wherever it's essentially the same logic.  
  
Michael Paquier and Tom Lane  
  
Discussion: <CAB7nPqSOyAsHC6jL24J1B+oK3p=yyNoFU0Vs_B6fd2kdd5g5WQ@mail.gmail.com>  

M src/pl/plperl/plperl.c

Improve memory management for PL/Tcl functions.

commit   : d062245b5bd591edf6f78bab8d6b8bb3ff69c7a6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2016 17:27:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2016 17:27:09 -0400    

Click here for diff

Formerly, the memory used to represent a PL/Tcl function was allocated with  
malloc() or in TopMemoryContext, and we'd leak it all if the function got  
redefined during the session.  Instead, create a per-function context and  
keep everything in or under that context.  Add a reference-counting  
mechanism (like the one plpgsql has long had) so that we can safely clean  
up an old function definition, either immediately if it's not being  
executed or at the end of the outermost execution.  
  
Currently, we only detect that a cached function is obsolete when we next  
attempt to call that function.  So this covers the updated-definition case  
but leaves cruft around after DROP FUNCTION.  It's not clear whether it's  
worth installing a syscache invalidation callback to watch for drops;  
none of the other PLs do, so for now we won't do it here either.  
  
Michael Paquier and Tom Lane  
  
Discussion: <CAB7nPqSOyAsHC6jL24J1B+oK3p=yyNoFU0Vs_B6fd2kdd5g5WQ@mail.gmail.com>  

M src/pl/tcl/pltcl.c

Try to fix portability issue in enum renumbering (again).

commit   : 65a588b4c3b06aefe0b00d6222598d4cff3542c2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2016 13:58:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2016 13:58:01 -0400    

Click here for diff

The hack embodied in commit 4ba61a487 no longer works after today's change  
to allow DatumGetFloat4/Float4GetDatum to be inlined (commit 14cca1bf8).  
Probably what's happening is that the faulty compilers are deciding that  
the now-inlined assignment is a no-op and so they're not required to  
round to float4 width.  
  
We had a bunch of similar issues earlier this year in the degree-based  
trig functions, and eventually settled on using volatile intermediate  
variables as the least ugly method of forcing recalcitrant compilers  
to do what the C standard says (cf commit 82311bcdd).  Let's see if  
that method works here.  
  
Discussion: <[email protected]>  

M src/backend/catalog/pg_enum.c

Remove no-longer-useful SSL-specific Port.count field.

commit   : 679226337ac3f44e784de0a95a8599dfd86401e8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2016 09:24:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2016 09:24:19 -0400    

Click here for diff

Since we removed SSL renegotiation, there's no longer any reason to  
keep track of the amount of data transferred over the link.  
  
Daniel Gustafsson  
  
Discussion: <[email protected]>  

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

Use static inline functions for float <-> Datum conversions.

commit   : 14cca1bf8e31ed39dbc26dd6c610f1113e759972    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 31 Aug 2016 16:00:28 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 31 Aug 2016 16:00:28 +0300    

Click here for diff

Now that we are OK with using static inline functions, we can use them  
to avoid function call overhead of pass-by-val versions of Float4GetDatum,  
DatumGetFloat8, and Float8GetDatum. Those functions are only a few CPU  
instructions long, but they could not be written into macros previously,  
because we need a local union variable for the conversion.  
  
I kept the pass-by-ref versions as regular functions. They are very simple  
too, but they call palloc() anyway, so shaving a few instructions from the  
function call doesn't seem so important there.  
  
Discussion: <[email protected]>  

M src/backend/utils/fmgr/fmgr.c
M src/include/postgres.h

Prevent starting a standalone backend with standby_mode on.

commit   : 0e0f43d6fdc2e1fbd5261245ed4cf85302a3f653    
  
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   : 530fb68e0f10ba921922e7b88403fcd2bd263742    
  
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 a bunch of places that called malloc and friends with no NULL check.

commit   : 052cc223d5ce1b727f62afff75797c88d82f880b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 30 Aug 2016 18:22:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 30 Aug 2016 18:22:43 -0400    

Click here for diff

Where possible, use palloc or pg_malloc instead; otherwise, insert  
explicit NULL checks.  
  
Generally speaking, these are places where an actual OOM is quite  
unlikely, either because they're in client programs that don't  
allocate all that much, or they're very early in process startup  
so that we'd likely have had a fork() failure instead.  Hence,  
no back-patch, even though this is nominally a bug fix.  
  
Michael Paquier, with some adjustments by me  
  
Discussion: <CAB7nPqRu07Ot6iht9i9KRfYLpDaF2ZuUv5y_+72uP23ZAGysRg@mail.gmail.com>  

M contrib/pg_standby/pg_standby.c
M contrib/vacuumlo/vacuumlo.c
M src/backend/bootstrap/bootstrap.c
M src/backend/port/dynloader/darwin.c
M src/backend/utils/misc/ps_status.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/psql/command.c
M src/common/exec.c
M src/test/isolation/isolationtester.c
M src/test/isolation/specparse.y
M src/test/isolation/specscanner.l
M src/test/regress/pg_regress.c

Simplify correct use of simple_prompt().

commit   : 9daec77e165de461fca9d5bc3ece86a91aba5804    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 30 Aug 2016 17:02:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 30 Aug 2016 17:02:02 -0400    

Click here for diff

The previous API for this function had it returning a malloc'd string.  
That meant that callers had to check for NULL return, which few of them  
were doing, and it also meant that callers had to remember to free()  
the string later, which required extra logic in most cases.  
  
Instead, make simple_prompt() write into a buffer supplied by the caller.  
Anywhere that the maximum required input length is reasonably small,  
which is almost all of the callers, we can just use a local or static  
array as the buffer instead of dealing with malloc/free.  
  
A fair number of callers used "pointer == NULL" as a proxy for "haven't  
requested the password yet".  Maintaining the same behavior requires  
adding a separate boolean flag for that, which adds back some of the  
complexity we save by removing free()s.  Nonetheless, this nets out  
at a small reduction in overall code size, and considerably less code  
than we would have had if we'd added the missing NULL-return checks  
everywhere they were needed.  
  
In passing, clean up the API comment for simple_prompt() and get rid  
of a very-unnecessary malloc/free in its Windows code path.  
  
This is nominally a bug fix, but it does not seem worth back-patching,  
because the actual risk of an OOM failure in any of these places seems  
pretty tiny, and all of them are client-side not server-side anyway.  
  
This patch is by me, but it owes a great deal to Michael Paquier  
who identified the problem and drafted a patch for fixing it the  
other way.  
  
Discussion: <CAB7nPqRu07Ot6iht9i9KRfYLpDaF2ZuUv5y_+72uP23ZAGysRg@mail.gmail.com>  

M contrib/oid2name/oid2name.c
M contrib/vacuumlo/vacuumlo.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/nls.mk
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/bin/psql/startup.c
M src/bin/scripts/common.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropuser.c
M src/include/port.h
M src/port/sprompt.c

Fix initdb misbehavior when user mis-enters superuser password.

commit   : 37f6fd1eaab698983ca1fb2a036d52381347ac71    
  
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

Split hash.h ā†’ hash_xlog.h

commit   : 8e1e3f958fb3749fe01e9f2473f4554859c685a8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 29 Aug 2016 18:48:02 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 29 Aug 2016 18:48:02 -0300    

Click here for diff

Since the hash AM is going to be revamped to have WAL, this is a good  
opportunity to clean up the include file a little bit to avoid including  
a lot of extra stuff in the future.  
  
Author: Amit Kapila  

M src/backend/access/hash/hash.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/transam/rmgr.c
M src/bin/pg_xlogdump/rmgrdesc.c
M src/include/access/hash.h
A src/include/access/hash_xlog.h

Remove support for OpenSSL versions older than 0.9.8.

commit   : 9b7cd59af1afcfbd786921d5cf73befb5fefa2f7    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 29 Aug 2016 20:16:02 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 29 Aug 2016 20:16:02 +0300    

Click here for diff

OpenSSL officially only supports 1.0.1 and newer. Some OS distributions  
still provide patches for 0.9.8, but anything older than that is not  
interesting anymore. Let's simplify things by removing compatibility code.  
  
Andreas Karlsson, with small changes by me.  

M contrib/pgcrypto/openssl.c
M doc/src/sgml/installation.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/pgcrypto.sgml
M src/backend/libpq/be-secure-openssl.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h

Make AllocSetContextCreate throw an error for bad context-size parameters.

commit   : cf34fdbbe1452b9e19c0956bc48494889e1b2777    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Aug 2016 09:29:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Aug 2016 09:29:26 -0400    

Click here for diff

The previous behavior was to silently change them to something valid.  
That obscured the bugs fixed in commit ea268cdc9, and generally seems  
less useful than complaining.  Unlike the previous commit, though,  
we'll do this in HEAD only --- it's a bit too late to be possibly  
breaking third-party code in 9.6.  
  
Discussion: <CA+TgmobNcELVd3QmLD3tx=w7+CokRQiC4_U0txjz=WHpfdkU=w@mail.gmail.com>  

M src/backend/utils/mmgr/aset.c

Fix pg_receivexlog --synchronous

commit   : 49340627f9821e447f135455d942f7d5e96cae6d    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 29 Aug 2016 12:16:18 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 29 Aug 2016 12:16:18 +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 typos in comments.

commit   : bd082231edbaf25626a023913394b611fe7928e8    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 29 Aug 2016 16:06:40 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 29 Aug 2016 16:06:40 +0900    

Click here for diff

M src/backend/access/brin/brin_inclusion.c
M src/timezone/localtime.c

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

commit   : bab7823a49bb210b8920ae59e5126d27e4d63833    
  
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   : b899ccbb49cbcf8431b3af43fcf3faf91e6a28c6    
  
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   : 39d866433e6fb1c385eee8dc67843097b8703add    
  
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
M doc/src/sgml/spgist.sgml

Update 9.6 release notes through today.

commit   : a6f0dc701b2f84839761783e87c49d43cd3e31df    
  
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   : ea268cdc9a2631da4a5748b00059a9fd43470d0e    
  
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   : 26fa446da64716f12ab3a623434c644fcb344b2e    
  
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   : 78dcd027e8f7ed213f69da932853dc4b7cb9cb44    
  
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   : 45a36e68539dcd7095a257b49f6f38ae77dec30d    
  
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   : 8529036b53298c0555670b4a81ed7349c44aeeb4    
  
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   : fbf28b6b52c269188262a87247adb2c359acd6c5    
  
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

Support OID system column in postgres_fdw.

commit   : ae025a15988f5491903cd3a2075f308c2773f711    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 26 Aug 2016 16:33:57 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 26 Aug 2016 16:33:57 +0300    

Click here for diff

You can use ALTER FOREIGN TABLE SET WITH OIDS on a foreign table, but the  
oid column read out as zeros, because the postgres_fdw didn't know about  
it. Teach postgres_fdw how to fetch it.  
  
Etsuro Fujita, with an additional test case by me.  
  
Discussion: <[email protected]>  

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

Fix instability in parallel regression tests.

commit   : 2533ff0aa518d4d31391db279cf08e538fae5931    
  
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   : ae4760d667c71924932ab32e14996b5be1831fc6    
  
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   : ca9cb940d23dc8869a635fa27a08e60837b17c07    
  
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

postgres_fdw: Cosmetic cleanup.

commit   : dcb7a54bd1cdbf5cca9549e8485cd34a28c7cf87    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 24 Aug 2016 16:29:10 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 24 Aug 2016 16:29:10 -0400    

Click here for diff

Etsuro Fujita  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c

Fix improper repetition of previous results from a hashed aggregate.

commit   : 2c00fad2864350508f666da1a2c04e0cbe9cbf58    
  
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   : 5cd3864075622b203d530f1a710818777859304e    
  
author   : Kevin Grittner <[email protected]>    
date     : Wed, 24 Aug 2016 13:17:21 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Wed, 24 Aug 2016 13:17:21 -0500    

Click here for diff

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

M src/include/storage/bufmgr.h

doc: Fix XSLT speedup with older upstream stylesheet versions

commit   : 0e4cc1fc51c77b3af22d8ff7163565c5ba96f310    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Aug 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Aug 2016 12:00:00 -0400    

Click here for diff

From: Alexander Law <[email protected]>  

M doc/src/sgml/stylesheet-speedup-xhtml.xsl

Build libpgfeutils before src/bin/pg_basebackup programs.

commit   : 03951987283b99d5002227ab89f896bab772b7ec    
  
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

Oversight in commit 9132c014290d02435999c81892fa8b0b384497d8.  

M src/bin/pg_basebackup/Makefile

Build libpgfeutils before pg_isready.

commit   : b6418a0919c2c161cf2ed65bc930a06c9c2d85da    
  
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   : 71e006f031310f77ab72881c47a7d8f41df748bb    
  
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

Fix network_spgist.c build failures from missing AF_INET definition.

commit   : 32909a57f9fb131eab8971a6d9845b55bbcb9091    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2016 16:25:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2016 16:25:35 -0400    

Click here for diff

AF_INET is apparently defined in something that's pulled in automatically  
on Linux, but the buildfarm says that's not true everywhere.  Comparing  
to network_gist.c suggests that including <sys/socket.h> ought to fix it,  
and the POSIX standard concurs.  

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

Create an SP-GiST opclass for inet/cidr.

commit   : 77e2906821e2aec3c0807866a84c2934feeac8be    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2016 15:16:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2016 15:16:21 -0400    

Click here for diff

This seems to offer significantly better search performance than the  
existing GiST opclass for inet/cidr, at least on data with a wide mix  
of network mask lengths.  (That may suggest that the data splitting  
heuristics in the GiST opclass could be improved.)  
  
Emre Hasegeli, with mostly-cosmetic adjustments by me  
  
Discussion: <CAE2gYzxtth9qatW_OAqdOjykS0bxq7AYHLuyAQLPgT7H9ZU0Cw@mail.gmail.com>  

M doc/src/sgml/spgist.sgml
M src/backend/utils/adt/Makefile
A src/backend/utils/adt/network_spgist.c
M src/include/catalog/catversion.h
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/inet.h
M src/test/regress/expected/inet.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/inet.sql

Extend dsm API with a new function dsm_unpin_segment.

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

Click here for diff

If you have previously pinned a segment and decide that you don't  
actually want to keep it around until shutdown, this new API lets you  
remove the pin.  This is pretty trivial except on Windows, where it  
requires closing the duplicate handle that was used to implement the  
pin.  
  
Thomas Munro and Amit Kapila, reviewed by Amit Kapila and by me.  

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

Remove duplicate function prototype.

commit   : 19998730aea97137e2516af0516c683a1261ba1f    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 23 Aug 2016 13:44:18 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 23 Aug 2016 13:44:18 -0400    

Click here for diff

Kyotaro Horiguchi  

M src/backend/libpq/pqcomm.c

doc: fix incorrect 'literal' tags

commit   : ff066481b0485b1a4e414de3abcaae0bda02b1e1    
  
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

Improve SP-GiST opclass API to better support unlabeled nodes.

commit   : d2ddee63b43b27d6c6af169342af10db19bd3a1a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2016 12:10:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2016 12:10:25 -0400    

Click here for diff

Previously, the spgSplitTuple action could only create a new upper tuple  
containing a single labeled node.  This made it useless for opclasses  
that prefer to work with fixed sets of nodes (labeled or otherwise),  
which meant that restrictive prefixes could not be used with such  
node definitions.  Change the output field set for the choose() method  
to allow it to specify any valid node set for the new upper tuple,  
and to specify which of these nodes to place the modified lower tuple in.  
  
In addition to its primary use for fixed node sets, this feature could  
allow existing opclasses that use variable node sets to skip a separate  
spgAddNode action when splitting a tuple, by setting up the node needed  
for the incoming value as part of the spgSplitTuple action.  However, care  
would have to be taken to add the extra node only when it would not make  
the tuple bigger than before.  (spgAddNode can enlarge the tuple,  
spgSplitTuple can't.)  
  
This is a prerequisite for an upcoming SP-GiST inet opclass, but is  
being committed separately to increase the visibility of the API change.  
  
In passing, improve the documentation about the traverse-values feature  
that was added by commit ccd6eb49a.  
  
Emre Hasegeli, with cosmetic adjustments and documentation rework by me  
  
Discussion: <CAE2gYzxtth9qatW_OAqdOjykS0bxq7AYHLuyAQLPgT7H9ZU0Cw@mail.gmail.com>  

M doc/src/sgml/spgist.sgml
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spgtextproc.c
M src/include/access/spgist.h

Add txid_current_ifassigned().

commit   : 86f31695f3b54211226949de519063bbf248e8c4    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 23 Aug 2016 10:30:52 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 23 Aug 2016 10:30:52 -0400    

Click here for diff

Add a variant of txid_current() that returns NULL if no transaction ID  
is assigned.  This version can be used even on a standby server,  
although it will always return NULL since no transaction IDs can be  
assigned during recovery.  
  
Craig Ringer, per suggestion from Jim Nasby.  Reviewed by Petr Jelinek  
and by me.  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/txid.c
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h
M src/test/regress/expected/txid.out
M src/test/regress/sql/txid.sql

Remove duplicate word from comment.

commit   : ff36700c3ba2180047b4103de440ffaa34889b72    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 23 Aug 2016 10:05:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 23 Aug 2016 10:05:13 -0400    

Click here for diff

Erik Rijkers  

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

Refactor some network.c code to create cidr_set_masklen_internal().

commit   : 7b405b3e04779fc0a026c9c6ac3e06194948b253    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2016 09:39:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2016 09:39:54 -0400    

Click here for diff

Merge several copies of "copy an inet value and adjust the mask length"  
code to create a single, conveniently C-callable function.  This function  
is exported for future use by inet SPGiST support, but it's good cleanup  
anyway since we had three slightly-different-for-no-good-reason copies.  
  
(Extracted from a larger patch, to separate new code from refactoring  
of old code)  
  
Emre Hasegeli  

M src/backend/utils/adt/network.c
M src/include/utils/inet.h

doc: fix typo in recent patch

commit   : f2e016f8d55ee029c5d6ec853ff6802aaf49fb0a    
  
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   : 008c4135ccf67e74239a17a85f912d1a51b6349e    
  
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

Improve header comment for LockHasWaitersRelation.

commit   : af5743851d7d526fadfeb9726e2b3d8b1fc5026d    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 22 Aug 2016 11:52:43 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 22 Aug 2016 11:52:43 -0400    

Click here for diff

Dimitry Ivanov spotted a typo, and I added a bit of wordsmithing.  

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

Run select_parallel test by itself

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

Click here for diff

Remove the plpgsql wrapping that hides the context.  So now the test  
will fail if the work doesn't actually happen in a parallel worker.  Run  
the test in its own test group to ensure it won't run out of resources  
for that.  

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

initdb now needs submake-libpq and submake-libpgfeutils.

commit   : 234309fa87739f7a3ac99de815d181b50f2542e7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 Aug 2016 08:01:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 22 Aug 2016 08:01:12 -0400    

Click here for diff

More fallout from commit a00c58314.  Pointed out by Michael Paquier.  

M src/bin/initdb/Makefile

Retire escapeConnectionParameter().

commit   : 9132c014290d02435999c81892fa8b0b384497d8    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 21 Aug 2016 22:05:57 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 21 Aug 2016 22:05:57 -0400    

Click here for diff

It is redundant with appendConnStrVal(), which became an extern function  
in commit 41f18f021a0882eccbeca62e2ed4b66c6b96e9c9.  This changes the  
handling of out-of-memory and of certain inputs for which quoting is  
optional, but pg_basebackup has no need for unusual treatment thereof.  

M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/pg_basebackup.c

initdb now needs to reference libpq include files in MSVC builds.

commit   : 04164deb7cb8e572302e2b43786fa24de3c40da3    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 20 Aug 2016 16:53:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 20 Aug 2016 16:53:25 -0400    

Click here for diff

Fallout from commit a00c58314.  Per buildfarm.  

M src/tools/msvc/Mkvcbuild.pm

Make initdb's suggested "pg_ctl start" command line more reliable.

commit   : a00c58314745772f6c6a49b6d02a9572cd600bda    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 20 Aug 2016 15:05:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 20 Aug 2016 15:05:25 -0400    

Click here for diff

The original coding here was not nearly careful enough about quoting  
special characters, and it didn't get corner cases right for constructing  
the pg_ctl path either.  Use join_path_components() and appendShellString()  
to do it honestly, so that the string will more likely work if blindly  
copied-and-pasted.  
  
While at it, teach appendShellString() not to quote strings that clearly  
don't need it, so that the output from initdb doesn't become uglier than  
it was before in typical cases where quoting is not needed.  
  
Ryan Murphy, reviewed by Michael Paquier and myself  
  
Discussion: <CAHeEsBeAe1FeBypT3E8R1ZVZU0e8xv3A-7BHg6bEOi=jZny2Uw@mail.gmail.com>  

M src/bin/initdb/Makefile
M src/bin/initdb/initdb.c
M src/fe_utils/string_utils.c

Allow empty queries in pgbench.

commit   : 6471045230f5d891ad724c54d406e2214f3c96d9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Aug 2016 17:32:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Aug 2016 17:32:59 -0400    

Click here for diff

This might have been too much of a foot-gun before 9.6, but with the  
new commands-end-at-semicolons parsing rule, the only way to get an  
empty query into a script is to explicitly write an extra ";".  
So we may as well allow the case.  
  
Fabien Coelho  
  
Patch: <alpine.DEB.2.20.1607090922170.3412@sto>  

M src/bin/pgbench/pgbench.c

Use LEFT JOINs in some system views in case referenced row doesn't exist.

commit   : 8299471c37fff0b0f5a777a12f920125310c0efe    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Aug 2016 17:13:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Aug 2016 17:13:47 -0400    

Click here for diff

In particular, left join to pg_authid so that rows in pg_stat_activity  
don't disappear if the session's owning user has been dropped.  
Also convert a few joins to pg_database to left joins, in the same spirit,  
though that case might be harder to hit.  We were doing this in other  
views already, so it was a bit inconsistent that these views didn't.  
  
Oskari Saarenmaa, with some further tweaking by me  
  
Discussion: <[email protected]>  

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

Guard against parallel-restricted functions in VALUES expressions.

commit   : 65a603e90328a7a8fb3ab30ed96f24bf8eb4cf84    
  
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

Speed up planner's scanning for parallel-query hazards.

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

Click here for diff

We need to scan the whole parse tree for parallel-unsafe functions.  
If there are none, we'll later need to determine whether particular  
subtrees contain any parallel-restricted functions.  The previous coding  
retained no knowledge from the first scan, even though this is very  
wasteful in the common case where the query contains only parallel-safe  
functions.  We can bypass all of the later scans by remembering that fact.  
This provides a small but measurable speed improvement when the case  
applies, and shouldn't cost anything when it doesn't.  
  
Patch by me, reviewed by Robert Haas  
  
Discussion: <[email protected]>  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/allpaths.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/pathnode.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/relation.h
M src/include/optimizer/clauses.h

reorderbuffer: preserve errno while reporting error

commit   : 6f79ae7fe549bed8bbd1f54ddd9b98f8f9a315f5    
  
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

Clean up another pre-ANSI-C-ism in regex code: get rid of pcolor typedef.

commit   : a859e640035680db31531ccd19a67292dd726baf    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Aug 2016 13:31:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Aug 2016 13:31:10 -0400    

Click here for diff

pcolor was used to represent function arguments that are nominally of  
type color, but when using a pre-ANSI C compiler would be passed as the  
promoted integer type.  We really don't need that anymore.  

M src/backend/regex/regc_color.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/include/regex/regguts.h

Remove typedef celt from the regex library, along with macro NOCELT.

commit   : 6eefd2422ef232aec2fe12465d9ec4018c63814d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Aug 2016 12:51:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Aug 2016 12:51:02 -0400    

Click here for diff

The regex library used to have a notion of a "collating element" that was  
distinct from a "character", but Henry Spencer never actually implemented  
his planned support for multi-character collating elements, and the Tcl  
crew ripped out most of the stubs for that years ago.  The only thing left  
that distinguished the "celt" typedef from the "chr" typedef was that  
"celt" was supposed to also be able to hold the not-a-character "NOCELT"  
value.  However, NOCELT was not used anywhere after the MCCE stub removal  
changes, which means there's no need for celt to be different from chr.  
Removing the separate typedef simplifies matters and also removes a trap  
for the unwary, in that celt is signed while chr may not be, so comparisons  
could mean different things.  There's no bug there today because we  
restrict CHR_MAX to be less than INT_MAX, but I think there may have been  
such bugs before we did that, and there could be again if anyone ever  
decides to fool with the range of chr.  
  
This patch also removes assorted unnecessary casts to "chr" of values  
that are already chrs.  Many of these seem to be leftover from days when  
the code was compatible with pre-ANSI C.  

M src/backend/regex/regc_cvec.c
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

doc: requirepeer is a way to avoid spoofing

commit   : 5285c5e873d8b622da7007c1628e5afa80f372fb    
  
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   : 9595383bc6fc24d25970374e2eddd5ce6f977f9e    
  
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

Remove obsolete replacement system() on darwin

commit   : 1d2e73a3dfdbd7168b323fa39879c60df6076412    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Aug 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Aug 2016 12:00:00 -0400    

Click here for diff

Per comment in the file, this was fixed around OS X 10.2.  

M src/backend/port/Makefile
D src/backend/port/darwin/Makefile
D src/backend/port/darwin/README
D src/backend/port/darwin/system.c

Update line count totals for psql help displays.

commit   : c5d4f40cb5e231eb2cbc533b5f094f3a4829e2ef    
  
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   : 5697522d8411135d26a5d807f9e4afa182502f64    
  
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

doc: Speed up XSLT builds

commit   : e8306745e3504c642f7abad411139d5630e29fac    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Aug 2016 12:00:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Aug 2016 12:00:00 -0400    

Click here for diff

The upstream XSLT stylesheets use some very general XPath expressions in  
some places that end up being very slow.  We can optimize them with  
knowledge about the DocBook document structure and our particular use  
thereof.  For example, when counting preceding chapters to get a number  
for the current chapter, we only need to count preceding sibling  
nodes (more or less) instead of searching through the entire node tree  
for chapter elements.  
  
This change attacks the slowest pieces as identified by xsltproc  
--profile.  This makes the HTML build roughly 10 times faster, resulting  
in the new total build time being about the same as the old DSSSL-based  
build.  Some of the non-HTML build targets (especially FO) will also  
benefit a bit, but they have not been specifically analyzed.  
  
With this, also remove the pg.fast parameter, which was previously a  
hack to get the build to a manageable speed.  
  
Alexander Lakhin <[email protected]>, with some additional  
tweaking by me  

M doc/src/sgml/stylesheet-common.xsl
A doc/src/sgml/stylesheet-speedup-common.xsl
A doc/src/sgml/stylesheet-speedup-xhtml.xsl
M doc/src/sgml/stylesheet.xsl

Improve psql's tab completion for \l.

commit   : 8019b5a89c3cefbaa69ab58c00281419f7e46601    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2016 11:29:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2016 11:29:16 -0400    

Click here for diff

Offer a list of database names; formerly no help was offered.  
  
Ian Barwick, reviewed by Gerdan Santos  
  
Patch: <[email protected]>  

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

Improve psql's tab completion for ALTER EXTENSION foo UPDATE ...

commit   : 49917dbd76ba0b4179a82fcf033ef5a10b8e3488    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2016 11:17:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2016 11:17:10 -0400    

Click here for diff

Offer a list of available versions for that extension.  Formerly, since  
there was no special support for this, it triggered off the UPDATE  
keyword and offered a list of table names --- not too helpful.  
  
Jeff Janes, reviewed by Gerdan Santos  
  
Patch: <CAMkU=1z0gxEOLg2BWa69P4X4Ot8xBxipGUiGkXe_tC+raj79-Q@mail.gmail.com>  

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

Support the new regexp_match() function for citext.

commit   : f9d747a4e908ad09520cad4c0e8c915074e9964c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2016 10:52:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2016 10:52:31 -0400    

Click here for diff

Emre Hasegeli  
  
Patch: <CAE2gYzzF24ZHWqkMukkHwqa0otbES9Rex22LrjQUNbi=oKziNQ@mail.gmail.com>  

M contrib/citext/Makefile
A contrib/citext/citext–1.3–1.4.sql
R096 contrib/citext/citext–1.3.sql contrib/citext/citext–1.4.sql
M contrib/citext/citext.control
M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/citext/sql/citext.sql
M doc/src/sgml/citext.sgml

Improve formatting of comments in plpgsql.h

commit   : 9f31e45a6d36a2564423a20601d5066939ea83c1    
  
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

This file had some unusual comment layout.  Most of the comments  
introducing structs ended up to the right of the screen and following  
the start of the struct.  Some comments for struct members ended up  
after the member definition.  
  
Fix that by moving comments consistently before what they are  
describing.  Also add missing struct tags where missing so that it is  
easier to tell what the struct is.  

M src/pl/plpgsql/src/plpgsql.h

Refactor RandomSalt to handle salts of different lengths.

commit   : fa878703f456b804b01b61a9d94008f57967cdd0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 18 Aug 2016 13:41:17 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 18 Aug 2016 13:41:17 +0300    

Click here for diff

All we need is 4 bytes at the moment, for MD5 authentication. But in  
upcomint patches for SCRAM authentication, SCRAM will need a salt of  
different length. It's less scary for the caller to pass the buffer  
length anyway, than assume a certain-sized output buffer.  
  
Author: Michael Paquier  
Discussion: <CAB7nPqQvO4sxLFeS9D+NM3wpy08ieZdAj_6e117MQHZAfxBFsg@mail.gmail.com>  

M src/backend/postmaster/postmaster.c

Update Windows timezone mapping from Windows 7 and 10

commit   : a79a68562240c58f21680483a8d2e137803bd48f    
  
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

Refactor sendAuthRequest.

commit   : 8d3b9cce81c173da55b9500353e5d773f8449a66    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 18 Aug 2016 13:25:31 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 18 Aug 2016 13:25:31 +0300    

Click here for diff

This way sendAuthRequest doesn't need to know the details of all the  
different authentication methods. This is in preparation for adding SCRAM  
authentication, which will add yet another authentication request message  
type, with different payload.  
  
Reviewed-By: Michael Paquier  
Discussion: <CAB7nPqQvO4sxLFeS9D+NM3wpy08ieZdAj_6e117MQHZAfxBFsg@mail.gmail.com>  

M src/backend/libpq/auth.c

Fix deletion of speculatively inserted TOAST on conflict

commit   : 07ef035129586ca26a713c4cd15e550dfe35e643    
  
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

Implement regexp_match(), a simplified alternative to regexp_matches().

commit   : cf9b0fea5f6d1bcc9b2c66f5c30ecb04684a0919    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Aug 2016 18:32:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Aug 2016 18:32:56 -0400    

Click here for diff

regexp_match() is like regexp_matches(), but it disallows the 'g' flag  
and in consequence does not need to return a set.  Instead, it returns  
a simple text array value, or NULL if there's no match.  Previously people  
usually got that behavior with a sub-select, but this way is considerably  
more efficient.  
  
Documentation adjusted so that regexp_match() is presented first and then  
regexp_matches() is introduced as a more complicated version.  This is  
a bit historically revisionist but seems pedagogically better.  
  
Still TODO: extend contrib/citext to support this function.  
  
Emre Hasegeli, reviewed by David Johnston  
  
Discussion: <CAE2gYzy42sna2ME_e3y1KLQ-4UBrB-eVF0SWn8QG39sQSeVhEw@mail.gmail.com>  

M doc/src/sgml/func.sgml
M src/backend/catalog/information_schema.sql
M src/backend/utils/adt/regexp.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/regex.out
M src/test/regress/expected/strings.out
M src/test/regress/sql/regex.sql

Properly re-initialize replication slot shared memory upon creation.

commit   : 2d7e591007a6f44e5e27e2b6c1098483105c0d10    
  
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   : 6657acc0100ec79304b868a6346db4d8eb2f6b83    
  
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

Improve plpgsql's memory management to fix some function-lifespan leaks.

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

Click here for diff

In some cases, exiting out of a plpgsql statement due to an error, then  
catching the error in a surrounding exception block, led to leakage of  
temporary data the statement was working with, because we kept all such  
data in the function-lifespan SPI Proc context.  Iterating such behavior  
many times within one function call thus led to noticeable memory bloat.  
  
To fix, create an additional memory context meant to have statement  
lifespan.  Since many plpgsql statements, particularly the simpler/more  
common ones, don't need this, create it only on demand.  Reset this context  
at the end of any statement that uses it, and arrange for exception cleanup  
to reset it too, thereby fixing the memory-leak issue.  Allow a stack of  
such contexts to exist to handle cases where a compound statement needs  
statement-lifespan data that persists across calls of inner statements.  
  
While at it, clean up code and improve comments referring to the existing  
short-term memory context, which by plpgsql convention is the per-tuple  
context of the eval_econtext ExprContext.  We now uniformly refer to that  
as the eval_mcontext, whereas the new statement-lifespan memory contexts  
are called stmt_mcontext.  
  
This change adds some context-creation overhead, but on the other hand  
it allows removal of some retail pfree's in favor of context resets.  
On balance it seems to be about a wash performance-wise.  
  
In principle this is a bug fix, but it seems too invasive for a back-patch,  
and the infrequency of complaints weighs against taking the risk in the  
back branches.  So we'll fix it only in HEAD, at least for now.  
  
Tom Lane, reviewed by Pavel Stehule  
  
Discussion: <[email protected]>  

M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h

Disable update_process_title by default on Windows

commit   : 092155465710b22ec9a99820ce6400a889580805    
  
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   : d125d25790901683d5ad16bfc96e9de4ccc9a581    
  
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

Improve parsetree representation of special functions such as CURRENT_DATE.

commit   : 0bb51aa96783e8a6c473c2b5e3725e23e95db834    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Aug 2016 20:33:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Aug 2016 20:33:01 -0400    

Click here for diff

We implement a dozen or so parameterless functions that the SQL standard  
defines special syntax for.  Up to now, that was done by converting them  
into more or less ad-hoc constructs such as "'now'::text::date".  That's  
messy for multiple reasons: it exposes what should be implementation  
details to users, and performance is worse than it needs to be in several  
cases.  To improve matters, invent a new expression node type  
SQLValueFunction that can represent any of these parameterless functions.  
  
Bump catversion because this changes stored parsetrees for rules.  
  
Discussion: <[email protected]>  

M contrib/pg_stat_statements/pg_stat_statements.c
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/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_target.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/timestamp.c
M src/include/catalog/catversion.h
M src/include/nodes/nodes.h
M src/include/nodes/primnodes.h
M src/include/utils/date.h
M src/include/utils/timestamp.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/select_views.out
M src/test/regress/expected/select_views_1.out

Suppress -Wunused-result warning for strtol().

commit   : 4bc4cfe3bd186b4a1d1b01279bfd0e6ab11268b2    
  
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   : 7f61fd10ceb715eceece49451f6dfe9058044e15    
  
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/backend/utils/fmgr/dfmgr.c
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   : 639166641102871e09f9c4aebc71df57566a0a4a    
  
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   : f0fe1c8f70bacb65513f1cbaea14eb384d346ee8    
  
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

Automate the maintenance of SO_MINOR_VERSION for our shared libraries.

commit   : a3bce17ef1ca6408e8d1e7b10fb767aef1729be6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Aug 2016 13:58:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Aug 2016 13:58:44 -0400    

Click here for diff

Up to now we've manually adjusted these numbers in several different  
Makefiles at the start of each development cycle.  While that's not  
much work, it's easily forgotten, so let's get rid of it by setting  
the SO_MINOR_VERSION values directly from $(MAJORVERSION).  
  
In the case of libpq, this dev cycle's value of SO_MINOR_VERSION happens  
to be "10" anyway, so this switch is transparent.  For ecpg's shared  
libraries, this will result in skipping one or two minor version numbers  
between v9.6 and v10, which seems like no big problem; and it was a bit  
inconsistent that they didn't have equal minor version numbers anyway.  
  
Discussion: <[email protected]>  

M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/libpq/Makefile
M src/tools/RELEASE_CHANGES

Fix possible crash due to incorrect allocation context.

commit   : 41fb35fabf03bffa812caddf24323d4d06f811ba    
  
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

Remove separate version numbering for ecpg preprocessor.

commit   : a7b5573d665c8a37fad9bc69f44c5b4e8760a73b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Aug 2016 12:49:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Aug 2016 12:49:30 -0400    

Click here for diff

Once upon a time, it made sense for the ecpg preprocessor to have its  
own version number, because it used a manually-maintained grammar that  
wasn't always in sync with the core grammar.  But those days are  
thankfully long gone, leaving only a maintenance nuisance behind.  
Let's use the PG v10 version numbering changeover as an excuse to get  
rid of the ecpg version number and just have ecpg identify itself by  
PG_VERSION.  From the user's standpoint, ecpg will go from "4.12" in  
the 9.6 branch to "10" in the 10 branch, so there's no failure of  
monotonicity.  
  
Discussion: <[email protected]>  

M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/ecpg.c
M src/tools/RELEASE_CHANGES
M src/tools/msvc/Mkvcbuild.pm

Doc: copy-editing in create_access_method.sgml.

commit   : 9b002cc9fec557fcfe17d67f55b53804447230e5    
  
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   : 8fc571b7dd9fa1659536a26bb085584b50a65a51    
  
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

Once again allow LWLocks to be used within DSM segments.

commit   : b25b6c9701e5c18e3ad3b701df62380f8d138ba0    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 15 Aug 2016 18:09:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 15 Aug 2016 18:09:55 -0400    

Click here for diff

Prior to commit 7882c3b0b95640e361f1533fe0f2d02e4e5d8610, it was  
possible to use LWLocks within DSM segments, but that commit broke  
this use case by switching from a doubly linked list to a circular  
linked list.  Switch back, using a new bit of general infrastructure  
for maintaining lists of PGPROCs.  
  
Thomas Munro, reviewed by me.  

M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h
M src/include/storage/proc.h
A src/include/storage/proclist.h
A src/include/storage/proclist_types.h
M src/tools/pgindent/typedefs.list

Allow .so minor version numbers above 9 in .gitignore.

commit   : 2bf06f756142f4c398270cdc30bbba9b9dfbd38b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Aug 2016 17:35:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Aug 2016 17:35:35 -0400    

Click here for diff

Needed now that libpq.so's minor version has reached 10.  

M .gitignore

Update git_changelog to know that there's a 9.6 branch.

commit   : 3149a12166120d0b476f5ca7837ebcf0e7124703    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Aug 2016 15:24:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Aug 2016 15:24:54 -0400    

Click here for diff

Missed this in the main 10devel version stamping patch.  

M src/tools/git_changelog

Stamp shared-library minor version numbers for v10.

commit   : 0b9358d4406b9b45a06855d53f491cc7ce9550a9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Aug 2016 14:35:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Aug 2016 14:35:55 -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 10devel.

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

Click here for diff

This is a good bit more complicated than the average new-version stamping  
commit, because it includes various adjustments in pursuit of changing  
from three-part to two-part version numbers.  It's likely some further  
work will be needed around that change; but this is enough to get through  
the regression tests, at least in Unix builds.  
  
Peter Eisentraut and Tom Lane  

M configure
M configure.in
M doc/bug.template
M doc/src/sgml/runtime.sgml
M src/backend/catalog/genbki.pl
M src/backend/utils/init/miscinit.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/server.c
M src/include/pg_config.h.win32
M src/interfaces/libpq/libpq.rc.in
M src/port/win32ver.rc
M src/tools/msvc/Solution.pm
M src/tools/version_stamp.pl