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]